2018-04-30 18:33:05 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
2019-02-22 15:07:32 +00:00
|
|
|
* Copyright (C) 2016-2019 - Brad Parker
|
2018-04-30 18:33:05 +00:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _QT_UI
|
|
|
|
#define _QT_UI
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTreeView>
|
2018-09-18 18:09:25 +00:00
|
|
|
#include <QListWidget>
|
2018-12-12 19:45:19 +00:00
|
|
|
#include <QTableView>
|
2018-07-25 04:29:48 +00:00
|
|
|
#include <QFrame>
|
2018-04-30 18:33:05 +00:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <QPalette>
|
|
|
|
#include <QPlainTextEdit>
|
2018-05-03 04:49:43 +00:00
|
|
|
#include <QFutureWatcher>
|
2018-05-03 06:47:40 +00:00
|
|
|
#include <QPixmap>
|
2018-05-03 04:49:43 +00:00
|
|
|
#include <QImage>
|
2018-05-07 18:29:54 +00:00
|
|
|
#include <QPointer>
|
2018-07-23 02:05:57 +00:00
|
|
|
#include <QProgressBar>
|
2018-07-29 03:15:00 +00:00
|
|
|
#include <QElapsedTimer>
|
2018-08-07 00:52:47 +00:00
|
|
|
#include <QSslError>
|
|
|
|
#include <QNetworkReply>
|
2018-12-12 19:45:19 +00:00
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QCache>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QDir>
|
2019-01-07 19:56:23 +00:00
|
|
|
|
|
|
|
#include "qt/filedropwidget.h"
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2019-01-14 05:56:16 +00:00
|
|
|
#ifndef CXX_BUILD
|
2018-04-30 18:33:05 +00:00
|
|
|
extern "C" {
|
2019-01-14 05:56:16 +00:00
|
|
|
#endif
|
|
|
|
|
2018-07-25 10:24:07 +00:00
|
|
|
#include <retro_assert.h>
|
2018-04-30 18:33:05 +00:00
|
|
|
#include <retro_common_api.h>
|
2018-08-27 03:24:43 +00:00
|
|
|
#include <queues/task_queue.h>
|
2018-04-30 18:33:05 +00:00
|
|
|
#include "../ui_companion_driver.h"
|
2018-08-14 04:47:10 +00:00
|
|
|
#include "../../gfx/video_driver.h"
|
2019-01-14 05:56:16 +00:00
|
|
|
|
|
|
|
#ifndef CXX_BUILD
|
2018-04-30 18:33:05 +00:00
|
|
|
}
|
2019-01-14 05:56:16 +00:00
|
|
|
#endif
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2018-08-17 02:48:31 +00:00
|
|
|
#define ALL_PLAYLISTS_TOKEN "|||ALL|||"
|
|
|
|
#define ICON_PATH "/xmb/dot-art/png/"
|
|
|
|
#define THUMBNAIL_BOXART "Named_Boxarts"
|
2018-08-25 05:00:18 +00:00
|
|
|
#define THUMBNAIL_SCREENSHOT "Named_Snaps"
|
|
|
|
#define THUMBNAIL_TITLE "Named_Titles"
|
2018-08-17 02:48:31 +00:00
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
class QApplication;
|
|
|
|
class QCloseEvent;
|
|
|
|
class QKeyEvent;
|
|
|
|
class QTimer;
|
|
|
|
class QFileSystemModel;
|
|
|
|
class QListWidgetItem;
|
|
|
|
class QTableWidgetItem;
|
|
|
|
class QResizeEvent;
|
|
|
|
class QDockWidget;
|
|
|
|
class QComboBox;
|
|
|
|
class QPushButton;
|
|
|
|
class QToolButton;
|
|
|
|
class QTabWidget;
|
|
|
|
class QPixmap;
|
|
|
|
class QPaintEvent;
|
|
|
|
class QSettings;
|
|
|
|
class QCheckBox;
|
2018-07-25 05:43:57 +00:00
|
|
|
class QSpinBox;
|
2018-04-30 18:33:05 +00:00
|
|
|
class QFormLayout;
|
|
|
|
class QStyle;
|
|
|
|
class QScrollArea;
|
2018-05-03 06:47:40 +00:00
|
|
|
class QSlider;
|
2018-07-28 14:39:21 +00:00
|
|
|
class QDragEnterEvent;
|
|
|
|
class QDropEvent;
|
2018-08-07 00:52:47 +00:00
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
|
|
|
class QProgressDialog;
|
2018-04-30 18:33:05 +00:00
|
|
|
class LoadCoreWindow;
|
|
|
|
class MainWindow;
|
2018-05-03 03:04:10 +00:00
|
|
|
class ThumbnailWidget;
|
2018-05-03 04:49:43 +00:00
|
|
|
class ThumbnailLabel;
|
2018-12-12 19:45:19 +00:00
|
|
|
class GridView;
|
2018-08-17 02:48:31 +00:00
|
|
|
class ShaderParamsDialog;
|
2018-08-29 15:34:36 +00:00
|
|
|
class CoreOptionsDialog;
|
2018-08-17 02:48:31 +00:00
|
|
|
class CoreInfoDialog;
|
|
|
|
class PlaylistEntryDialog;
|
|
|
|
class ViewOptionsDialog;
|
2018-05-03 03:04:10 +00:00
|
|
|
|
2018-08-21 17:39:16 +00:00
|
|
|
enum SpecialPlaylist
|
|
|
|
{
|
|
|
|
SPECIAL_PLAYLIST_HISTORY
|
|
|
|
};
|
|
|
|
|
2018-12-12 19:45:19 +00:00
|
|
|
enum ThumbnailType
|
|
|
|
{
|
|
|
|
THUMBNAIL_TYPE_BOXART,
|
|
|
|
THUMBNAIL_TYPE_SCREENSHOT,
|
|
|
|
THUMBNAIL_TYPE_TITLE_SCREEN,
|
|
|
|
};
|
|
|
|
|
|
|
|
class PlaylistModel : public QAbstractListModel
|
2018-05-03 03:04:10 +00:00
|
|
|
{
|
2018-05-07 18:29:54 +00:00
|
|
|
Q_OBJECT
|
2018-12-12 19:45:19 +00:00
|
|
|
|
2018-05-07 18:29:54 +00:00
|
|
|
public:
|
2018-12-12 19:45:19 +00:00
|
|
|
enum Roles
|
|
|
|
{
|
|
|
|
HASH = Qt::UserRole + 1,
|
|
|
|
THUMBNAIL
|
|
|
|
};
|
|
|
|
|
|
|
|
PlaylistModel(QObject *parent = 0);
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
void addPlaylistItems(const QStringList &paths, bool add = false);
|
|
|
|
void addDir(QString path, QFlags<QDir::Filter> showHidden);
|
|
|
|
void setThumbnailType(const ThumbnailType type);
|
|
|
|
void loadThumbnail(const QModelIndex &index);
|
|
|
|
void reloadThumbnail(const QModelIndex &index);
|
|
|
|
void reloadThumbnailPath(const QString path);
|
|
|
|
void reloadSystemThumbnails(const QString system);
|
|
|
|
void setThumbnailCacheLimit(int limit);
|
2019-01-23 20:21:30 +00:00
|
|
|
bool isSupportedImage(const QString path) const;
|
|
|
|
QString getPlaylistThumbnailsDir(const QString playlistName) const;
|
|
|
|
QString getSanitizedThumbnailName(QString label) const;
|
2018-12-12 19:45:19 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void imageLoaded(const QImage image, const QModelIndex &index, const QString &path);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onImageLoaded(const QImage image, const QModelIndex &index, const QString &path);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QVector<QHash<QString, QString> > m_contents;
|
|
|
|
QCache<QString, QPixmap> m_cache;
|
|
|
|
QSet<QString> m_pendingImages;
|
|
|
|
QVector<QByteArray> m_imageFormats;
|
|
|
|
QRegularExpression m_fileSanitizerRegex;
|
|
|
|
ThumbnailType m_thumbnailType = THUMBNAIL_TYPE_BOXART;
|
|
|
|
QString getThumbnailPath(const QModelIndex &index, QString type) const;
|
2019-01-23 20:21:30 +00:00
|
|
|
QString getThumbnailPath(const QHash<QString, QString> &hash, QString type) const;
|
2018-12-12 19:45:19 +00:00
|
|
|
QString getCurrentTypeThumbnailPath(const QModelIndex &index) const;
|
|
|
|
void getPlaylistItems(QString path);
|
|
|
|
void loadImage(const QModelIndex &index, const QString &path);
|
2018-05-03 03:04:10 +00:00
|
|
|
};
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2019-01-30 20:26:33 +00:00
|
|
|
class ThumbnailWidget : public QStackedWidget
|
2018-04-30 18:33:05 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ThumbnailWidget(QWidget *parent = 0);
|
2019-01-23 18:28:59 +00:00
|
|
|
ThumbnailWidget(ThumbnailType type, QWidget *parent = 0);
|
2018-07-25 12:44:17 +00:00
|
|
|
ThumbnailWidget(const ThumbnailWidget& other) { retro_assert(false && "DONT EVER USE THIS"); }
|
2018-07-25 04:29:48 +00:00
|
|
|
|
2019-01-30 20:26:33 +00:00
|
|
|
void setPixmap(const QPixmap &pixmap, bool acceptDrops);
|
2018-07-23 15:17:58 +00:00
|
|
|
signals:
|
2019-01-23 18:28:59 +00:00
|
|
|
void filesDropped(const QImage& image, ThumbnailType type);
|
2018-05-03 20:31:46 +00:00
|
|
|
private:
|
|
|
|
QSize m_sizeHint;
|
2019-01-23 18:28:59 +00:00
|
|
|
ThumbnailType m_thumbnailType;
|
2019-01-30 20:26:33 +00:00
|
|
|
ThumbnailLabel *m_thumbnailLabel;
|
|
|
|
QLabel *m_dropIndicator;
|
2018-04-30 18:33:05 +00:00
|
|
|
protected:
|
2019-01-23 18:28:59 +00:00
|
|
|
void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
void dragMoveEvent(QDragMoveEvent *event);
|
|
|
|
void dropEvent(QDropEvent *event);
|
2018-04-30 18:33:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ThumbnailLabel : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ThumbnailLabel(QWidget *parent = 0);
|
|
|
|
~ThumbnailLabel();
|
|
|
|
QSize sizeHint() const;
|
|
|
|
public slots:
|
|
|
|
void setPixmap(const QPixmap &pixmap);
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *event);
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
private:
|
2019-01-07 19:56:23 +00:00
|
|
|
void updateMargins();
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2019-01-07 19:56:23 +00:00
|
|
|
QPixmap *m_pixmap;
|
|
|
|
int m_pixmapWidth;
|
|
|
|
int m_pixmapHeight;
|
2018-04-30 18:33:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TreeView : public QTreeView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
TreeView(QWidget *parent = 0);
|
|
|
|
signals:
|
|
|
|
void itemsSelected(QModelIndexList selectedIndexes);
|
|
|
|
protected slots:
|
|
|
|
void columnCountChanged(int oldCount, int newCount);
|
|
|
|
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
|
|
|
};
|
|
|
|
|
2018-12-12 19:45:19 +00:00
|
|
|
class TableView : public QTableView
|
2018-04-30 18:33:05 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-12-12 19:45:19 +00:00
|
|
|
TableView(QWidget *parent = 0);
|
2018-09-18 03:12:08 +00:00
|
|
|
bool isEditorOpen();
|
2018-04-30 18:33:05 +00:00
|
|
|
};
|
|
|
|
|
2018-09-18 18:09:25 +00:00
|
|
|
class ListWidget : public QListWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ListWidget(QWidget *parent = 0);
|
|
|
|
bool isEditorOpen();
|
|
|
|
signals:
|
|
|
|
void enterPressed();
|
|
|
|
void deletePressed();
|
|
|
|
protected:
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
};
|
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
class AppHandler : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
AppHandler(QObject *parent = 0);
|
|
|
|
~AppHandler();
|
|
|
|
void exit();
|
|
|
|
bool isExiting() const;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onLastWindowClosed();
|
|
|
|
};
|
|
|
|
|
|
|
|
class CoreInfoLabel : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
CoreInfoLabel(QString text = QString(), QWidget *parent = 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CoreInfoWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
CoreInfoWidget(CoreInfoLabel *label, QWidget *parent = 0);
|
|
|
|
QSize sizeHint() const;
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *event);
|
|
|
|
private:
|
|
|
|
CoreInfoLabel *m_label;
|
|
|
|
QScrollArea *m_scrollArea;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LogTextEdit : public QPlainTextEdit
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LogTextEdit(QWidget *parent = 0);
|
|
|
|
public slots:
|
|
|
|
void appendMessage(const QString& text);
|
|
|
|
};
|
|
|
|
|
2018-12-22 23:45:00 +00:00
|
|
|
/* Used to store styling since delegates don't inherit QWidget. */
|
|
|
|
class GridItem : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(QString thumbnailvalign READ getThumbnailVerticalAlign WRITE setThumbnailVerticalAlign)
|
|
|
|
Q_PROPERTY(int padding READ getPadding WRITE setPadding)
|
|
|
|
|
|
|
|
public:
|
|
|
|
GridItem(QWidget* parent);
|
|
|
|
|
|
|
|
Qt::AlignmentFlag thumbnailVerticalAlignmentFlag;
|
|
|
|
int padding;
|
|
|
|
|
|
|
|
int getPadding() const;
|
|
|
|
void setPadding(const int value);
|
|
|
|
QString getThumbnailVerticalAlign() const;
|
|
|
|
void setThumbnailVerticalAlign(const QString valign);
|
|
|
|
};
|
|
|
|
|
2019-01-07 19:56:23 +00:00
|
|
|
class FileSystemProxyModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
|
|
|
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
|
|
|
};
|
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-05-07 06:36:00 +00:00
|
|
|
enum ViewType
|
|
|
|
{
|
|
|
|
VIEW_TYPE_ICONS,
|
|
|
|
VIEW_TYPE_LIST
|
|
|
|
};
|
|
|
|
|
2019-01-07 19:56:23 +00:00
|
|
|
enum BrowserType
|
|
|
|
{
|
|
|
|
BROWSER_TYPE_PLAYLISTS,
|
|
|
|
BROWSER_TYPE_FILES
|
|
|
|
};
|
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
enum Theme
|
|
|
|
{
|
|
|
|
THEME_SYSTEM_DEFAULT,
|
|
|
|
THEME_DARK,
|
|
|
|
THEME_CUSTOM
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MessageBoxType
|
|
|
|
{
|
|
|
|
MSGBOX_TYPE_INFO,
|
|
|
|
MSGBOX_TYPE_WARNING,
|
|
|
|
MSGBOX_TYPE_ERROR,
|
2018-08-08 16:49:29 +00:00
|
|
|
MSGBOX_TYPE_QUESTION_YESNO,
|
|
|
|
MSGBOX_TYPE_QUESTION_OKCANCEL,
|
2018-04-30 18:33:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
MainWindow(QWidget *parent = NULL);
|
|
|
|
~MainWindow();
|
|
|
|
TreeView* dirTreeView();
|
2018-12-12 19:45:19 +00:00
|
|
|
PlaylistModel* playlistModel();
|
2018-09-18 18:09:25 +00:00
|
|
|
ListWidget* playlistListWidget();
|
2019-01-07 19:56:23 +00:00
|
|
|
QStackedWidget* centralWidget();
|
2018-12-12 19:45:19 +00:00
|
|
|
TableView* contentTableView();
|
2019-01-07 19:56:23 +00:00
|
|
|
QTableView* fileTableView();
|
|
|
|
FileDropWidget* playlistViews();
|
2018-12-12 19:45:19 +00:00
|
|
|
GridView* contentGridView();
|
2019-01-13 22:34:47 +00:00
|
|
|
QWidget* playlistViewsAndFooter();
|
2018-04-30 18:33:05 +00:00
|
|
|
QWidget* searchWidget();
|
|
|
|
QLineEdit* searchLineEdit();
|
|
|
|
QComboBox* launchWithComboBox();
|
|
|
|
QToolButton* startCorePushButton();
|
|
|
|
QToolButton* coreInfoPushButton();
|
|
|
|
QToolButton* runPushButton();
|
|
|
|
QToolButton* stopPushButton();
|
|
|
|
QTabWidget* browserAndPlaylistTabWidget();
|
2018-05-06 05:36:47 +00:00
|
|
|
QVector<QHash<QString, QString> > getPlaylistDefaultCores();
|
2018-04-30 18:33:05 +00:00
|
|
|
ViewOptionsDialog* viewOptionsDialog();
|
|
|
|
QSettings* settings();
|
2018-05-06 05:36:47 +00:00
|
|
|
QVector<QHash<QString, QString> > getCoreInfo();
|
2018-04-30 18:33:05 +00:00
|
|
|
void setTheme(Theme theme = THEME_SYSTEM_DEFAULT);
|
|
|
|
Theme theme();
|
|
|
|
Theme getThemeFromString(QString themeString);
|
|
|
|
QString getThemeString(Theme theme);
|
|
|
|
QHash<QString, QString> getSelectedCore();
|
|
|
|
void showStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush);
|
2018-08-08 16:49:29 +00:00
|
|
|
bool showMessageBox(QString msg, MessageBoxType msgType = MSGBOX_TYPE_INFO, Qt::WindowModality modality = Qt::ApplicationModal, bool showDontAsk = true, bool *dontAsk = NULL);
|
2018-04-30 18:33:05 +00:00
|
|
|
bool setCustomThemeFile(QString filePath);
|
|
|
|
void setCustomThemeString(QString qss);
|
|
|
|
const QString& customThemeString() const;
|
2018-05-07 06:36:00 +00:00
|
|
|
void setCurrentViewType(ViewType viewType);
|
2018-07-23 15:17:58 +00:00
|
|
|
QString getCurrentViewTypeString();
|
|
|
|
ViewType getCurrentViewType();
|
2018-12-12 19:45:19 +00:00
|
|
|
void setCurrentThumbnailType(ThumbnailType thumbnailType);
|
|
|
|
QString getCurrentThumbnailTypeString();
|
|
|
|
ThumbnailType getCurrentThumbnailType();
|
|
|
|
ThumbnailType getThumbnailTypeFromString(QString thumbnailType);
|
2018-07-25 19:24:26 +00:00
|
|
|
void setAllPlaylistsListMaxCount(int count);
|
|
|
|
void setAllPlaylistsGridMaxCount(int count);
|
2018-12-12 19:45:19 +00:00
|
|
|
void setThumbnailCacheLimit(int count);
|
2018-07-28 03:45:48 +00:00
|
|
|
PlaylistEntryDialog* playlistEntryDialog();
|
2018-07-28 14:39:21 +00:00
|
|
|
void addFilesToPlaylist(QStringList files);
|
2018-07-29 02:34:00 +00:00
|
|
|
QString getCurrentPlaylistPath();
|
2018-12-12 19:45:19 +00:00
|
|
|
QModelIndex getCurrentContentIndex();
|
2018-07-29 02:34:00 +00:00
|
|
|
QHash<QString, QString> getCurrentContentHash();
|
2019-01-07 19:56:23 +00:00
|
|
|
QHash<QString, QString> getFileContentHash(const QModelIndex &index);
|
2018-08-17 02:58:35 +00:00
|
|
|
static double lerp(double x, double y, double a, double b, double d);
|
2018-08-21 17:39:16 +00:00
|
|
|
QString getSpecialPlaylistPath(SpecialPlaylist playlist);
|
2018-08-26 21:17:39 +00:00
|
|
|
QVector<QPair<QString, QString> > getPlaylists();
|
2018-08-29 04:42:34 +00:00
|
|
|
QString getScrubbedString(QString str);
|
2018-12-22 23:45:00 +00:00
|
|
|
void setDefaultCustomProperties();
|
2019-01-07 19:56:23 +00:00
|
|
|
void setIconViewZoom(int zoomValue);
|
2018-04-30 18:33:05 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void thumbnailChanged(const QPixmap &pixmap);
|
|
|
|
void thumbnail2Changed(const QPixmap &pixmap);
|
|
|
|
void thumbnail3Changed(const QPixmap &pixmap);
|
|
|
|
void gotLogMessage(const QString &msg);
|
|
|
|
void gotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush);
|
|
|
|
void gotReloadPlaylists();
|
2018-08-15 01:38:52 +00:00
|
|
|
void gotReloadShaderParams();
|
2018-08-29 15:34:36 +00:00
|
|
|
void gotReloadCoreOptions();
|
2018-08-09 15:55:42 +00:00
|
|
|
void showErrorMessageDeferred(QString msg);
|
2018-08-16 12:42:40 +00:00
|
|
|
void showInfoMessageDeferred(QString msg);
|
2018-08-27 03:24:43 +00:00
|
|
|
void extractArchiveDeferred(QString path, QString extractionDir, QString tempExtension, retro_task_callback_t cb);
|
2018-08-25 05:00:18 +00:00
|
|
|
void itemChanged();
|
2018-12-12 19:45:19 +00:00
|
|
|
void updateThumbnails();
|
2018-08-28 03:29:44 +00:00
|
|
|
void gridItemChanged(QString title);
|
2018-08-25 05:00:18 +00:00
|
|
|
void gotThumbnailDownload(QString system, QString title);
|
2018-09-02 01:24:59 +00:00
|
|
|
void scrollToDownloads(QString path);
|
|
|
|
void scrollToDownloadsAgain(QString path);
|
2018-04-30 18:33:05 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void onBrowserDownloadsClicked();
|
|
|
|
void onBrowserUpClicked();
|
|
|
|
void onBrowserStartClicked();
|
|
|
|
void initContentTableWidget();
|
|
|
|
void onViewClosedDocksAboutToShow();
|
|
|
|
void onShowHiddenDockWidgetAction();
|
|
|
|
void setCoreActions();
|
|
|
|
void onRunClicked();
|
2018-07-23 15:17:58 +00:00
|
|
|
void loadContent(const QHash<QString, QString> &contentHash);
|
2018-04-30 18:33:05 +00:00
|
|
|
void onStartCoreClicked();
|
2018-12-12 19:45:19 +00:00
|
|
|
void onDropWidgetEnterPressed();
|
2018-04-30 18:33:05 +00:00
|
|
|
void selectBrowserDir(QString path);
|
2019-01-30 20:26:33 +00:00
|
|
|
void setThumbnail(QString widgetName, QPixmap &pixmap, bool acceptDrop);
|
|
|
|
void onResizeThumbnailOne(QPixmap &pixmap, bool acceptDrop);
|
|
|
|
void onResizeThumbnailTwo(QPixmap &pixmap, bool acceptDrop);
|
|
|
|
void onResizeThumbnailThree(QPixmap &pixmap, bool acceptDrop);
|
2018-04-30 18:33:05 +00:00
|
|
|
void appendLogMessage(const QString &msg);
|
|
|
|
void onGotLogMessage(const QString &msg);
|
|
|
|
void onGotStatusMessage(QString msg, unsigned priority, unsigned duration, bool flush);
|
|
|
|
void reloadPlaylists();
|
|
|
|
void deferReloadPlaylists();
|
|
|
|
void onGotReloadPlaylists();
|
2018-08-15 01:38:52 +00:00
|
|
|
void onGotReloadShaderParams();
|
2018-08-29 15:34:36 +00:00
|
|
|
void onGotReloadCoreOptions();
|
2018-04-30 18:33:05 +00:00
|
|
|
void showWelcomeScreen();
|
2018-05-07 06:36:00 +00:00
|
|
|
void onIconViewClicked();
|
|
|
|
void onListViewClicked();
|
|
|
|
void onTabWidgetIndexChanged(int index);
|
2018-07-28 15:48:24 +00:00
|
|
|
void deleteCurrentPlaylistItem();
|
2018-07-29 02:34:00 +00:00
|
|
|
void onFileDropWidgetContextMenuRequested(const QPoint &pos);
|
2018-08-03 03:21:39 +00:00
|
|
|
void showAbout();
|
2018-08-04 01:14:27 +00:00
|
|
|
void showDocs();
|
2018-08-07 00:52:47 +00:00
|
|
|
void updateRetroArchNightly();
|
|
|
|
void onUpdateRetroArchFinished(bool success);
|
2018-08-27 03:24:43 +00:00
|
|
|
void onThumbnailPackExtractFinished(bool success);
|
2018-08-15 01:38:52 +00:00
|
|
|
void deferReloadShaderParams();
|
2018-08-25 05:00:18 +00:00
|
|
|
void downloadThumbnail(QString system, QString title, QUrl url = QUrl());
|
2018-08-27 03:24:43 +00:00
|
|
|
void downloadAllThumbnails(QString system, QUrl url = QUrl());
|
2018-08-28 03:29:44 +00:00
|
|
|
void downloadPlaylistThumbnails(QString playlistPath);
|
|
|
|
void downloadNextPlaylistThumbnail(QString system, QString title, QString type, QUrl url = QUrl());
|
2018-12-12 19:45:19 +00:00
|
|
|
void changeThumbnailType(ThumbnailType type);
|
2019-01-23 18:28:59 +00:00
|
|
|
void onThumbnailDropped(const QImage &image, ThumbnailType type);
|
2018-04-30 18:33:05 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onLoadCoreClicked(const QStringList &extensionFilters = QStringList());
|
|
|
|
void onUnloadCoreMenuAction();
|
|
|
|
void onTimeout();
|
|
|
|
void onCoreLoaded();
|
2018-12-12 19:45:19 +00:00
|
|
|
void onCurrentTableItemDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
|
2018-04-30 18:33:05 +00:00
|
|
|
void onCurrentListItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
2018-09-18 18:09:25 +00:00
|
|
|
void onCurrentListItemDataChanged(QListWidgetItem *item);
|
2019-01-07 19:56:23 +00:00
|
|
|
void onCurrentItemChanged(const QModelIndex &index);
|
|
|
|
void onCurrentItemChanged(const QHash<QString, QString> &hash);
|
|
|
|
void onCurrentFileChanged(const QModelIndex &index);
|
2018-04-30 18:33:05 +00:00
|
|
|
void onSearchEnterPressed();
|
|
|
|
void onSearchLineEditEdited(const QString &text);
|
2018-12-12 19:45:19 +00:00
|
|
|
void onContentItemDoubleClicked(const QModelIndex &index);
|
2019-01-07 19:56:23 +00:00
|
|
|
void onFileDoubleClicked(const QModelIndex &index);
|
2018-04-30 18:33:05 +00:00
|
|
|
void onCoreLoadWindowClosed();
|
|
|
|
void onTreeViewItemsSelected(QModelIndexList selectedIndexes);
|
|
|
|
void onSearchResetClicked();
|
|
|
|
void onLaunchWithComboBoxIndexChanged(int index);
|
|
|
|
void onFileBrowserTreeContextMenuRequested(const QPoint &pos);
|
|
|
|
void onPlaylistWidgetContextMenuRequested(const QPoint &pos);
|
|
|
|
void onStopClicked();
|
2018-05-03 06:47:40 +00:00
|
|
|
void onZoomValueChanged(int value);
|
2018-07-28 14:39:21 +00:00
|
|
|
void onPlaylistFilesDropped(QStringList files);
|
2018-08-14 04:47:10 +00:00
|
|
|
void onShaderParamsClicked();
|
2018-08-29 15:34:36 +00:00
|
|
|
void onCoreOptionsClicked();
|
2018-08-27 03:24:43 +00:00
|
|
|
void onShowErrorMessage(QString msg);
|
|
|
|
void onShowInfoMessage(QString msg);
|
|
|
|
void onContributorsClicked();
|
|
|
|
void onItemChanged();
|
2018-09-02 01:24:59 +00:00
|
|
|
void onFileSystemDirLoaded(const QString &path);
|
2019-01-07 19:56:23 +00:00
|
|
|
void onFileBrowserTableDirLoaded(const QString &path);
|
2018-09-02 01:24:59 +00:00
|
|
|
void onDownloadScroll(QString path);
|
|
|
|
void onDownloadScrollAgain(QString path);
|
2018-08-27 03:24:43 +00:00
|
|
|
int onExtractArchive(QString path, QString extractionDir, QString tempExtension, retro_task_callback_t cb);
|
|
|
|
|
2018-08-07 00:52:47 +00:00
|
|
|
void onUpdateNetworkError(QNetworkReply::NetworkError code);
|
|
|
|
void onUpdateNetworkSslErrors(const QList<QSslError> &errors);
|
|
|
|
void onRetroArchUpdateDownloadFinished();
|
|
|
|
void onUpdateDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
void onUpdateDownloadReadyRead();
|
|
|
|
void onUpdateDownloadCanceled();
|
2018-08-27 03:24:43 +00:00
|
|
|
|
2018-08-25 05:00:18 +00:00
|
|
|
void onThumbnailDownloadNetworkError(QNetworkReply::NetworkError code);
|
|
|
|
void onThumbnailDownloadNetworkSslErrors(const QList<QSslError> &errors);
|
|
|
|
void onThumbnailDownloadFinished();
|
|
|
|
void onThumbnailDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
void onThumbnailDownloadReadyRead();
|
|
|
|
void onThumbnailDownloadCanceled();
|
|
|
|
void onDownloadThumbnail(QString system, QString title);
|
2018-08-27 03:24:43 +00:00
|
|
|
|
|
|
|
void onThumbnailPackDownloadNetworkError(QNetworkReply::NetworkError code);
|
|
|
|
void onThumbnailPackDownloadNetworkSslErrors(const QList<QSslError> &errors);
|
|
|
|
void onThumbnailPackDownloadFinished();
|
|
|
|
void onThumbnailPackDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
void onThumbnailPackDownloadReadyRead();
|
|
|
|
void onThumbnailPackDownloadCanceled();
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2018-08-28 03:29:44 +00:00
|
|
|
void onPlaylistThumbnailDownloadNetworkError(QNetworkReply::NetworkError code);
|
|
|
|
void onPlaylistThumbnailDownloadNetworkSslErrors(const QList<QSslError> &errors);
|
|
|
|
void onPlaylistThumbnailDownloadFinished();
|
|
|
|
void onPlaylistThumbnailDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
void onPlaylistThumbnailDownloadReadyRead();
|
|
|
|
void onPlaylistThumbnailDownloadCanceled();
|
|
|
|
|
2018-12-12 19:45:19 +00:00
|
|
|
void startTimer();
|
|
|
|
void updateVisibleItems();
|
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
private:
|
|
|
|
void setCurrentCoreLabel();
|
|
|
|
void getPlaylistFiles();
|
|
|
|
bool isCoreLoaded();
|
|
|
|
bool isContentLessCore();
|
2018-07-30 03:51:14 +00:00
|
|
|
bool updateCurrentPlaylistEntry(const QHash<QString, QString> &contentHash);
|
2018-08-07 00:52:47 +00:00
|
|
|
int extractArchive(QString path);
|
|
|
|
void removeUpdateTempFiles();
|
2018-08-31 03:06:34 +00:00
|
|
|
bool addDirectoryFilesToList(QProgressDialog *dialog, QStringList &list, QDir &dir, QStringList &extensions);
|
2018-09-18 18:09:25 +00:00
|
|
|
void renamePlaylistItem(QListWidgetItem *item, QString newName);
|
2018-09-21 20:32:38 +00:00
|
|
|
bool currentPlaylistIsSpecial();
|
|
|
|
bool currentPlaylistIsAll();
|
2019-01-07 19:56:23 +00:00
|
|
|
void applySearch();
|
|
|
|
void updateItemsCount();
|
2019-01-23 18:28:59 +00:00
|
|
|
QString changeThumbnail(const QImage &image, QString type);
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2018-12-12 19:45:19 +00:00
|
|
|
PlaylistModel *m_playlistModel;
|
|
|
|
QSortFilterProxyModel *m_proxyModel;
|
2019-01-07 19:56:23 +00:00
|
|
|
FileSystemProxyModel *m_proxyFileModel;
|
2018-04-30 18:33:05 +00:00
|
|
|
LoadCoreWindow *m_loadCoreWindow;
|
|
|
|
QTimer *m_timer;
|
|
|
|
QString m_currentCore;
|
|
|
|
QString m_currentCoreVersion;
|
|
|
|
QLabel *m_statusLabel;
|
|
|
|
TreeView *m_dirTree;
|
|
|
|
QFileSystemModel *m_dirModel;
|
2019-01-07 19:56:23 +00:00
|
|
|
QFileSystemModel *m_fileModel;
|
2018-09-18 18:09:25 +00:00
|
|
|
ListWidget *m_listWidget;
|
2019-01-07 19:56:23 +00:00
|
|
|
QStackedWidget *m_centralWidget;
|
2018-12-12 19:45:19 +00:00
|
|
|
TableView *m_tableView;
|
2019-01-07 19:56:23 +00:00
|
|
|
QTableView *m_fileTableView;
|
|
|
|
FileDropWidget *m_playlistViews;
|
2018-04-30 18:33:05 +00:00
|
|
|
QWidget *m_searchWidget;
|
|
|
|
QLineEdit *m_searchLineEdit;
|
|
|
|
QDockWidget *m_searchDock;
|
|
|
|
QStringList m_playlistFiles;
|
|
|
|
QComboBox *m_launchWithComboBox;
|
|
|
|
QToolButton *m_startCorePushButton;
|
|
|
|
QToolButton *m_coreInfoPushButton;
|
|
|
|
QToolButton *m_runPushButton;
|
|
|
|
QToolButton *m_stopPushButton;
|
|
|
|
QTabWidget *m_browserAndPlaylistTabWidget;
|
|
|
|
bool m_pendingRun;
|
|
|
|
QPixmap *m_thumbnailPixmap;
|
|
|
|
QPixmap *m_thumbnailPixmap2;
|
|
|
|
QPixmap *m_thumbnailPixmap3;
|
|
|
|
QSettings *m_settings;
|
|
|
|
ViewOptionsDialog *m_viewOptionsDialog;
|
|
|
|
CoreInfoDialog *m_coreInfoDialog;
|
|
|
|
QStyle *m_defaultStyle;
|
|
|
|
QPalette m_defaultPalette;
|
|
|
|
Theme m_currentTheme;
|
|
|
|
QDockWidget *m_coreInfoDock;
|
|
|
|
CoreInfoLabel *m_coreInfoLabel;
|
|
|
|
CoreInfoWidget *m_coreInfoWidget;
|
|
|
|
QDockWidget *m_logDock;
|
2019-01-14 19:06:07 +00:00
|
|
|
QFrame *m_logWidget;
|
2018-04-30 18:33:05 +00:00
|
|
|
LogTextEdit *m_logTextEdit;
|
|
|
|
QVector<QByteArray> m_imageFormats;
|
|
|
|
QListWidgetItem *m_historyPlaylistsItem;
|
|
|
|
QIcon m_folderIcon;
|
|
|
|
QString m_customThemeString;
|
2018-12-12 19:45:19 +00:00
|
|
|
GridView *m_gridView;
|
2019-01-13 22:34:47 +00:00
|
|
|
QWidget *m_playlistViewsAndFooter;
|
2018-05-03 06:47:40 +00:00
|
|
|
QWidget *m_gridLayoutWidget;
|
|
|
|
QSlider *m_zoomSlider;
|
|
|
|
int m_lastZoomSliderValue;
|
2018-05-07 06:36:00 +00:00
|
|
|
ViewType m_viewType;
|
2018-12-12 19:45:19 +00:00
|
|
|
ThumbnailType m_thumbnailType;
|
2018-07-23 02:05:57 +00:00
|
|
|
QProgressBar *m_gridProgressBar;
|
|
|
|
QWidget *m_gridProgressWidget;
|
2018-07-23 15:17:58 +00:00
|
|
|
QHash<QString, QString> m_currentGridHash;
|
2018-07-25 04:29:48 +00:00
|
|
|
QPointer<ThumbnailWidget> m_currentGridWidget;
|
2018-07-25 19:24:26 +00:00
|
|
|
int m_allPlaylistsListMaxCount;
|
|
|
|
int m_allPlaylistsGridMaxCount;
|
2018-07-28 03:45:48 +00:00
|
|
|
PlaylistEntryDialog *m_playlistEntryDialog;
|
2018-07-29 03:15:00 +00:00
|
|
|
QElapsedTimer m_statusMessageElapsedTimer;
|
2018-08-15 01:38:52 +00:00
|
|
|
QPointer<ShaderParamsDialog> m_shaderParamsDialog;
|
2018-08-29 15:34:36 +00:00
|
|
|
QPointer<CoreOptionsDialog> m_coreOptionsDialog;
|
2018-08-07 00:52:47 +00:00
|
|
|
QNetworkAccessManager *m_networkManager;
|
2018-08-27 03:24:43 +00:00
|
|
|
|
2018-08-07 00:52:47 +00:00
|
|
|
QProgressDialog *m_updateProgressDialog;
|
|
|
|
QFile m_updateFile;
|
|
|
|
QPointer<QNetworkReply> m_updateReply;
|
2018-08-27 03:24:43 +00:00
|
|
|
|
2018-08-25 05:00:18 +00:00
|
|
|
QProgressDialog *m_thumbnailDownloadProgressDialog;
|
|
|
|
QFile m_thumbnailDownloadFile;
|
|
|
|
QPointer<QNetworkReply> m_thumbnailDownloadReply;
|
|
|
|
QStringList m_pendingThumbnailDownloadTypes;
|
2018-04-30 18:33:05 +00:00
|
|
|
|
2018-08-27 03:24:43 +00:00
|
|
|
QProgressDialog *m_thumbnailPackDownloadProgressDialog;
|
|
|
|
QFile m_thumbnailPackDownloadFile;
|
|
|
|
QPointer<QNetworkReply> m_thumbnailPackDownloadReply;
|
|
|
|
|
2018-08-28 03:29:44 +00:00
|
|
|
QProgressDialog *m_playlistThumbnailDownloadProgressDialog;
|
|
|
|
QFile m_playlistThumbnailDownloadFile;
|
|
|
|
QPointer<QNetworkReply> m_playlistThumbnailDownloadReply;
|
|
|
|
QVector<QHash<QString, QString> > m_pendingPlaylistThumbnails;
|
|
|
|
unsigned m_downloadedThumbnails;
|
|
|
|
unsigned m_failedThumbnails;
|
2018-08-28 13:01:25 +00:00
|
|
|
bool m_playlistThumbnailDownloadWasCanceled;
|
2018-09-02 01:24:59 +00:00
|
|
|
QString m_pendingDirScrollPath;
|
2018-08-28 03:29:44 +00:00
|
|
|
|
2018-12-12 19:45:19 +00:00
|
|
|
QTimer *m_thumbnailTimer;
|
2018-12-22 23:45:00 +00:00
|
|
|
GridItem m_gridItem;
|
2019-01-07 19:56:23 +00:00
|
|
|
BrowserType m_currentBrowser;
|
|
|
|
QRegExp m_searchRegExp;
|
|
|
|
QByteArray m_fileTableHeaderState;
|
|
|
|
QWidget *m_zoomWidget;
|
|
|
|
QString m_itemsCountLiteral;
|
|
|
|
QLabel *m_itemsCountLabel;
|
2018-12-12 19:45:19 +00:00
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
};
|
|
|
|
|
2018-07-25 04:29:48 +00:00
|
|
|
Q_DECLARE_METATYPE(ThumbnailWidget)
|
2018-05-07 18:29:54 +00:00
|
|
|
Q_DECLARE_METATYPE(QPointer<ThumbnailWidget>)
|
2018-08-14 04:47:10 +00:00
|
|
|
Q_DECLARE_METATYPE(struct video_shader_parameter*)
|
2018-05-07 18:29:54 +00:00
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct ui_application_qt
|
|
|
|
{
|
|
|
|
QApplication *app;
|
|
|
|
} ui_application_qt_t;
|
|
|
|
|
|
|
|
typedef struct ui_window_qt
|
|
|
|
{
|
|
|
|
MainWindow *qtWindow;
|
|
|
|
} ui_window_qt_t;
|
|
|
|
|
|
|
|
RETRO_END_DECLS
|
|
|
|
|
|
|
|
#endif
|