1 #ifndef QMC2MAIN_H 2 #define QMC2MAIN_H 3 4 #include <qglobal.h> 5 #include <QApplication> 6 #include <QCloseEvent> 7 #include <QSocketNotifier> 8 #include <QTimer> 9 #include <QTime> 10 #include <QNetworkReply> 11 #include <QWidgetAction> 12 #include <QProxyStyle> 13 #include <QMovie> 14 #include <QPoint> 15 #include <QList> 16 #include <QMap> 17 18 #include "settings.h" 19 #include "ui_qmc2main.h" 20 #include "ui_options.h" 21 #include "macros.h" 22 #if QMC2_USE_PHONON_API 23 #include "qmc2_phonon.h" 24 #endif 25 #if QMC2_MULTIMEDIA_ENABLED 26 #include <QMediaPlayer> 27 #endif 28 #include "imagewidget.h" 29 #include "rankitemwidget.h" 30 #include "swldbmgr.h" 31 #include "romstatefilter.h" 32 #include "machinelistviewer.h" 33 34 class ProxyStyle : public QProxyStyle 35 { 36 public: 37 int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const { 38 if ( hint == QStyle::SH_ItemView_ActivateItemOnSingleClick ) 39 return 0; 40 else 41 return QProxyStyle::styleHint(hint, option, widget, returnData); 42 } 43 }; 44 45 class MainEventFilter : public QObject 46 { 47 Q_OBJECT 48 49 public: QObject(parent)50 MainEventFilter(QObject *parent = 0) : QObject(parent) { ; } 51 52 protected: 53 bool eventFilter(QObject *, QEvent *); 54 }; 55 56 class SearchBoxKeyEventFilter : public QObject 57 { 58 Q_OBJECT 59 60 public: QObject(parent)61 SearchBoxKeyEventFilter(QObject *parent = 0) : QObject(parent) { ; } 62 63 protected: 64 bool eventFilter(QObject *obj, QEvent *event); 65 }; 66 67 class MainWindow : public QMainWindow, public Ui::MainWindow 68 { 69 Q_OBJECT 70 71 public: 72 bool isActiveState; 73 QString defaultStyle; 74 QTimer searchTimer; 75 QTimer updateTimer; 76 ProxyStyle *proxyStyle; 77 ImagePixmap qmc2GhostImagePixmap; 78 QPushButton *pushButtonGlobalEmulatorOptionsExportToFile; 79 QMenu *selectMenuGlobalEmulatorOptionsExportToFile; 80 QPushButton *pushButtonGlobalEmulatorOptionsImportFromFile; 81 QMenu *selectMenuGlobalEmulatorOptionsImportFromFile; 82 QPushButton *pushButtonCurrentEmulatorOptionsExportToFile; 83 QMenu *selectMenuCurrentEmulatorOptionsExportToFile; 84 QPushButton *pushButtonCurrentEmulatorOptionsImportFromFile; 85 QMenu *selectMenuCurrentEmulatorOptionsImportFromFile; 86 QLabel *labelEmuSelector; 87 QComboBox *comboBoxEmuSelector; 88 QMenu *menuRomStatusFilter; 89 QMenu *menuTabWidgetMachineList; 90 QMenu *menuTabWidgetMachineDetail; 91 QMenu *menuTabWidgetLogsAndEmulators; 92 QMenu *menuTabWidgetSoftwareDetail; 93 QMenu *menuHorizontalSplitter; 94 QMenu *menuVerticalSplitter; 95 QMenu *menuMachineListHeader; 96 QMenu *menuHierarchyHeader; 97 QMenu *menuCategoryHeader; 98 QAction *actionMenuMachineListHeaderCategory; 99 QAction *actionMenuHierarchyHeaderCategory; 100 QAction *actionMenuCategoryHeaderVersion; 101 QAction *actionMenuVersionHeaderCategory; 102 QMenu *menuVersionHeader; 103 QAction *actionMenuMachineListHeaderVersion; 104 QAction *actionMenuHierarchyHeaderVersion; 105 QAction *actionCustomView; 106 QWidgetAction *stateFilterAction; 107 QList<QAction *> rebuildRomActions; 108 QList<QAction *> contextMenuPlayActions; 109 QStringList videoSnapAllowedFormatExtensions; 110 #if QMC2_JOYSTICK == 1 111 int joyIndex; 112 #endif 113 #if QMC2_USE_PHONON_API 114 Phonon::MediaObject *phononAudioPlayer; 115 Phonon::AudioOutput *phononAudioOutput; 116 Phonon::Path phononAudioPath; 117 bool audioFastForwarding; 118 bool audioFastBackwarding; 119 bool audioSkippingTracks; 120 Phonon::State audioState; 121 #endif 122 #if QMC2_MULTIMEDIA_ENABLED 123 QMediaPlayer *mediaPlayer; 124 bool audioFastForwarding; 125 bool audioFastBackwarding; 126 bool audioSkippingTracks; 127 QMediaPlayer::State audioState; 128 #endif 129 #if (defined(QMC2_OS_UNIX) && QT_VERSION < 0x050000) || defined(QMC2_OS_WIN) 130 QWidget *widgetEmbeddedEmus; 131 QWidget *embedderCornerWidget; 132 QHBoxLayout *embedderCornerLayout; 133 QToolButton *toolButtonEmbedderMaximizeToggle; 134 #endif 135 #if defined(QMC2_OS_UNIX) 136 QToolButton *toolButtonEmbedderAutoPause; 137 QMenu *menuAutoPause; 138 #endif 139 QTimer messDevCfgTimer; 140 QList<int> hSplitterSizes; 141 QList<int> vSplitterSizes; 142 QList<int> vSplitterSizesSoftwareDetail; 143 QRect desktopGeometry; 144 QWidget *hSplitterWidget0; 145 QWidget *vSplitterWidget0; 146 QTimer activityCheckTimer; 147 int retry_tabWidgetMachineDetail_currentIndex; 148 QString urlSectionRegExp; 149 QString foreignEmuName; 150 QString foreignID; 151 QString foreignDescription; 152 QWidgetAction *widgetActionToolbarSearch; 153 QComboBox *comboBoxToolbarSearch; 154 QMenu *menuSearchOptions; 155 QAction *actionNegateSearch; 156 QAction *actionSearchIncludeDeviceSets; 157 QAction *actionSearchIncludeBiosSets; 158 QList<QAction *> criticalActions; 159 QMovie *loadAnimMovie; 160 QMovie *nullMovie; 161 bool activityState; 162 bool isCreatingSoftList; 163 bool negatedMatch; 164 bool launchForeignID; 165 bool searchActive; 166 bool stopSearch; 167 bool lastPageSoftware; 168 169 static QColor qmc2StatusColorGreen; 170 static QColor qmc2StatusColorYellowGreen; 171 static QColor qmc2StatusColorRed; 172 static QColor qmc2StatusColorBlue; 173 static QColor qmc2StatusColorGrey; 174 static QList<MachineListViewer *> machineListViewers; 175 176 QToolButton *floatToggleButtonSoftwareDetail; 177 178 int sortCriteriaLogicalIndex(); 179 QPoint adjustedWidgetPosition(QPoint, QWidget *); 180 QStringList &getXmlChoices(const QString &, const QString &, const QString &optionAttribute = QString(), QString *defaultChoice = 0); 181 static bool qStringListLessThan(const QString &, const QString &); 182 SoftwareListXmlDatabaseManager *swlDb; 183 RomStateFilter *romStateFilter; rankItemWidgets()184 QList<RankItemWidget *> &rankItemWidgets() { return m_rankItemWidgets; } attachedViewer()185 MachineListViewer *attachedViewer() { return m_attachedViewer; } 186 187 MainWindow(QWidget *parent = 0); 188 ~MainWindow(); 189 190 void commonWebSearch(QString, QTreeWidgetItem *); 191 void processGlobalEmuConfig(); 192 void prepareShortcuts(); clearSortedItemMap()193 void clearSortedItemMap() { m_sortedItemMap.clear(); } 194 195 public slots: 196 // machine menu 197 void on_actionPlay_triggered(bool checked = false); 198 void on_actionPlayEmbedded_triggered(bool checked = false); 199 void on_actionPlayTagged_triggered(bool checked = false); 200 void on_actionPlayEmbeddedTagged_triggered(bool checked = false); 201 void on_actionToFavorites_triggered(bool checked = false); 202 void on_actionToFavoritesTagged_triggered(bool checked = false); 203 void on_actionReload_triggered(bool checked = false); 204 void on_actionExitStop_triggered(bool checked = false); 205 void on_actionCheckCurrentROM_triggered(bool checked = false); 206 void on_actionCheckROMStateTagged_triggered(bool checked = false); 207 void on_actionAnalyseCurrentROM_triggered(bool checked = false); 208 void on_actionAnalyseROMTagged_triggered(bool checked = false); 209 void on_actionRunRomTool_triggered(bool checked = false); 210 void on_actionRunRomToolTagged_triggered(bool checked = false); 211 void on_actionSetTag_triggered(bool checked = false); 212 void on_actionUnsetTag_triggered(bool checked = false); 213 void on_actionToggleTag_triggered(bool checked = false); 214 void on_actionToggleTagCursorDown_triggered(bool checked = false); 215 void on_actionToggleTagCursorUp_triggered(bool checked = false); 216 void on_actionTagAll_triggered(bool checked = false); 217 void on_actionUntagAll_triggered(bool checked = false); 218 void on_actionInvertTags_triggered(bool checked = false); 219 void on_actionTagVisible_triggered(bool checked = false); 220 void on_actionUntagVisible_triggered(bool checked = false); 221 void on_actionInvertVisibleTags_triggered(bool checked = false); 222 void on_actionSearchDuckDuckGo_triggered(bool checked = false); 223 void on_actionSearchGoogle_triggered(bool checked = false); 224 void on_actionSearchWikipedia_triggered(bool checked = false); 225 void on_actionSearchYandex_triggered(bool checked = false); 226 void on_actionSearchInternalBrowser_triggered(bool checked = false); on_actionRebuildROM_triggered(bool)227 void on_actionRebuildROM_triggered(bool) { actionRebuildRom_triggered(); } 228 void on_actionRebuildROMTagged_triggered(bool checked = false); 229 void on_actionManualOpenInViewer_triggered(bool checked = false); 230 void on_actionManualInternalViewer_triggered(bool checked = false); 231 232 // arcade menu 233 void on_actionLaunchArcade_triggered(bool checked = false); 234 void on_actionArcadeSetup_triggered(bool checked = false); 235 236 // tools menu 237 void on_actionCheckROMs_triggered(bool checked = false); 238 void on_actionCheckSamples_triggered(bool checked = false); 239 void on_actionCheckImagesAndIcons_triggered(bool checked = false); 240 void on_actionSystemROMAlyzer_triggered(bool checked = false); 241 void on_actionSoftwareROMAlyzer_triggered(bool checked = false); 242 void on_actionExportROMStatus_triggered(bool checked = false); 243 void on_actionDemoMode_triggered(bool checked = false); 244 void on_actionNewBrowserWindow_triggered(bool checked = false); 245 void on_actionNewPdfViewer_triggered(bool checked = false); 246 void on_actionNewFilteredView_triggered(bool checked = false); 247 void on_actionClearImageCache_triggered(bool checked = false); 248 void on_actionClearIconCache_triggered(bool checked = false); 249 void on_actionClearProjectMESSCache_triggered(bool checked = false); 250 #if defined(QMC2_YOUTUBE_ENABLED) 251 void on_actionClearYouTubeCache_triggered(bool checked = false); 252 #endif 253 void on_actionRecreateTemplateMap_triggered(bool checked = false); 254 void on_actionCheckTemplateMap_triggered(bool checked = false); 255 void on_actionClearROMStateCache_triggered(bool checked = false); 256 void on_actionClearMachineListCache_triggered(bool checked = false); 257 void on_actionClearXMLCache_triggered(bool checked = false); 258 void on_actionClearSoftwareListCache_triggered(bool checked = false); 259 void on_actionClearAllEmulatorCaches_triggered(bool complete = false); 260 void on_actionOptions_triggered(bool checked = false); 261 void on_actionRelaunchSetupWizard_triggered(bool checked = false); 262 263 // display menu 264 void on_actionFullscreenToggle_triggered(bool checked = false); 265 266 // help menu 267 void on_actionDocumentation_triggered(bool checked = false); 268 void on_actionAbout_triggered(bool checked = false); 269 void on_actionHomepage_triggered(bool checked = false); 270 void on_actionWiki_triggered(bool checked = false); 271 void on_actionForum_triggered(bool checked = false); 272 void on_actionBugTracker_triggered(bool checked = false); 273 void on_actionAboutQt_triggered(bool checked = false); 274 275 // search widget 276 void on_comboBoxSearch_editTextChanged(const QString &); 277 void comboBoxSearch_editTextChanged_delayed(); 278 void on_comboBoxSearch_activated(const QString &); 279 void on_listWidgetSearch_itemActivated(QListWidgetItem *); 280 void on_listWidgetSearch_currentItemChanged(QListWidgetItem *, QListWidgetItem *); 281 void on_listWidgetSearch_itemPressed(QListWidgetItem *); 282 void on_listWidgetSearch_itemSelectionChanged(); 283 284 // favorites & played widgets 285 void on_listWidgetFavorites_itemSelectionChanged(); 286 void on_listWidgetFavorites_itemActivated(QListWidgetItem *); 287 void on_listWidgetPlayed_itemSelectionChanged(); 288 void on_listWidgetPlayed_itemActivated(QListWidgetItem *); 289 290 // context menus 291 void on_treeWidgetMachineList_customContextMenuRequested(const QPoint &); 292 void on_treeWidgetHierarchy_customContextMenuRequested(const QPoint &); 293 void on_listWidgetSearch_customContextMenuRequested(const QPoint &); 294 void on_listWidgetFavorites_customContextMenuRequested(const QPoint &); 295 void on_listWidgetPlayed_customContextMenuRequested(const QPoint &); 296 void on_treeWidgetEmulators_customContextMenuRequested(const QPoint &); 297 void on_tabWidgetMachineList_customContextMenuRequested(const QPoint &); 298 void tabWidgetMachineList_actionSwitchTab_triggered(bool checked = false); 299 void on_tabWidgetMachineDetail_customContextMenuRequested(const QPoint &); 300 void tabWidgetMachineDetail_actionSwitchTab_triggered(bool checked = false); 301 void on_tabWidgetLogsAndEmulators_customContextMenuRequested(const QPoint &); 302 void tabWidgetLogsAndEmulators_actionSwitchTab_triggered(bool checked = false); 303 void on_tabWidgetSoftwareDetail_customContextMenuRequested(const QPoint &p); 304 void tabWidgetSoftwareDetail_actionSwitchTab_triggered(bool checked = false); 305 306 // joystick functions 307 #if QMC2_JOYSTICK == 1 308 void joystickAxisValueChanged(int, int); 309 void joystickButtonValueChanged(int, bool); 310 void joystickHatValueChanged(int, int); 311 void joystickTrackballValueChanged(int, int, int); 312 void mapJoystickFunction(QString); 313 #endif 314 315 // audio player functions 316 void on_actionAudioPreviousTrack_triggered(bool checked = false); 317 void toolButtonAudioPreviousTrack_resetButton(); 318 void on_actionAudioNextTrack_triggered(bool checked = false); 319 void toolButtonAudioNextTrack_resetButton(); 320 void on_actionAudioFastBackward_triggered(bool checked = false); 321 void on_toolButtonAudioFastBackward_clicked(bool checked = false); 322 void toolButtonAudioFastBackward_resetButton(); 323 void on_actionAudioFastForward_triggered(bool checked = false); 324 void on_toolButtonAudioFastForward_clicked(bool checked = false); 325 void toolButtonAudioFastForward_resetButton(); 326 void on_actionAudioStopTrack_triggered(bool checked = false); 327 void on_actionAudioPauseTrack_triggered(bool checked = false); 328 void on_actionAudioPlayTrack_triggered(bool checked = false); 329 void on_toolButtonAudioAddTracks_clicked(); 330 void on_toolButtonAudioAddURL_clicked(); 331 void on_toolButtonAudioRemoveTracks_clicked(); 332 void on_toolButtonAudioSetupEffects_clicked(); 333 void on_listWidgetAudioPlaylist_itemSelectionChanged(); 334 void on_dialAudioVolume_valueChanged(int); 335 void on_actionAudioRaiseVolume_triggered(bool checked = false); 336 void on_actionAudioLowerVolume_triggered(bool checked = false); 337 void audioFinished(); 338 #if QMC2_MULTIMEDIA_ENABLED 339 void audioStateChanged(QMediaPlayer::MediaStatus); 340 #endif 341 void audioTick(qint64); 342 void audioTotalTimeChanged(qint64); 343 void audioFade(int); 344 void audioMetaDataChanged(); 345 void audioBufferStatus(int); 346 void audioScrollToCurrentItem(); 347 348 // download manager widget 349 void on_checkBoxRemoveFinishedDownloads_stateChanged(int); 350 351 // tab widget position callbacks 352 void menuTabWidgetMachineList_North_activated(); 353 void menuTabWidgetMachineList_South_activated(); 354 void menuTabWidgetMachineList_West_activated(); 355 void menuTabWidgetMachineList_East_activated(); 356 void menuTabWidgetMachineList_Setup_activated(); 357 void menuTabWidgetMachineDetail_North_activated(); 358 void menuTabWidgetMachineDetail_South_activated(); 359 void menuTabWidgetMachineDetail_West_activated(); 360 void menuTabWidgetMachineDetail_East_activated(); 361 void menuTabWidgetMachineDetail_Setup_activated(); 362 void menuTabWidgetLogsAndEmulators_North_activated(); 363 void menuTabWidgetLogsAndEmulators_South_activated(); 364 void menuTabWidgetLogsAndEmulators_West_activated(); 365 void menuTabWidgetLogsAndEmulators_East_activated(); 366 void menuTabWidgetLogsAndEmulators_Setup_activated(); 367 void menuTabWidgetSoftwareDetail_North_activated(); 368 void menuTabWidgetSoftwareDetail_South_activated(); 369 void menuTabWidgetSoftwareDetail_West_activated(); 370 void menuTabWidgetSoftwareDetail_East_activated(); 371 void menuTabWidgetSoftwareDetail_Setup_activated(); 372 373 // other 374 void on_tabWidgetMachineDetail_currentChanged(int); retry_tabWidgetMachineDetail_currentChanged()375 void retry_tabWidgetMachineDetail_currentChanged() { on_tabWidgetMachineDetail_currentChanged(retry_tabWidgetMachineDetail_currentIndex); }; 376 void tabWidgetMachineList_tabMoved(int, int); 377 void tabWidgetMachineDetail_tabMoved(int, int); 378 void tabWidgetLogsAndEmulators_tabMoved(int, int); 379 void tabWidgetSoftwareDetail_tabMoved(int, int); 380 void on_tabWidgetMachineList_currentChanged(int); 381 void on_tabWidgetLogsAndEmulators_currentChanged(int); tabWidgetLogsAndEmulators_updateCurrent()382 void tabWidgetLogsAndEmulators_updateCurrent() { on_tabWidgetLogsAndEmulators_currentChanged(tabWidgetLogsAndEmulators->currentIndex()); }; 383 void on_tabWidgetSoftwareDetail_currentChanged(int); tabWidgetSoftwareDetail_updateCurrent()384 void tabWidgetSoftwareDetail_updateCurrent() { on_tabWidgetSoftwareDetail_currentChanged(tabWidgetSoftwareDetail->currentIndex()); }; 385 void on_treeWidgetMachineList_itemActivated(QTreeWidgetItem *, int); 386 void on_treeWidgetMachineList_itemDoubleClicked(QTreeWidgetItem *, int); 387 void on_treeWidgetMachineList_itemExpanded(QTreeWidgetItem *); 388 void on_treeWidgetMachineList_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); 389 void on_treeWidgetMachineList_itemSelectionChanged(); 390 void treeWidgetMachineList_itemSelectionChanged_delayed(); 391 void on_treeWidgetHierarchy_itemActivated(QTreeWidgetItem *, int); 392 void on_treeWidgetHierarchy_itemDoubleClicked(QTreeWidgetItem *, int); 393 void on_treeWidgetHierarchy_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); 394 void on_treeWidgetHierarchy_itemSelectionChanged(); 395 void on_stackedWidgetView_currentChanged(int); 396 void pushButtonGlobalEmulatorOptionsExportToFile_clicked(QString useFileName = QString()); 397 void pushButtonGlobalEmulatorOptionsSelectExportFile_clicked(); 398 void pushButtonGlobalEmulatorOptionsImportFromFile_clicked(QString useFileName = QString()); 399 void pushButtonGlobalEmulatorOptionsSelectImportFile_clicked(); 400 void pushButtonCurrentEmulatorOptionsExportToFile_clicked(QString useFileName = QString()); 401 void pushButtonCurrentEmulatorOptionsSelectExportFile_clicked(); 402 void pushButtonCurrentEmulatorOptionsImportFromFile_clicked(QString useFileName = QString()); 403 void pushButtonCurrentEmulatorOptionsSelectImportFile_clicked(); 404 #if (defined(QMC2_OS_UNIX) && QT_VERSION < 0x050000) || defined(QMC2_OS_WIN) 405 void action_embedEmulator_triggered(); 406 void on_tabWidgetEmbeddedEmulators_tabCloseRequested(int); 407 void embedderOptions_toggled(bool); 408 void closeEmbeddedEmuTab(); 409 void toolButtonEmbedderMaximizeToggle_toggled(bool); 410 void embedderOptionsMenu_KillEmulator_activated(); 411 void embedderOptionsMenu_ToFavorites_activated(); 412 void embedderOptionsMenu_CopyCommand_activated(); 413 #if defined(QMC2_OS_UNIX) 414 void action_embedderScanPauseKey_triggered(); 415 #endif 416 #endif 417 void action_killEmulator_triggered(); 418 void action_copyEmulatorCommand_triggered(); 419 void action_removeFromFavorites_triggered(); 420 void action_clearAllFavorites_triggered(); 421 void action_saveFavorites_triggered(); 422 void action_removeFromPlayed_triggered(); 423 void action_clearAllPlayed_triggered(); 424 void action_savePlayed_triggered(); 425 void scrollToCurrentItem(); 426 void checkCurrentSearchSelection(); 427 void checkCurrentFavoritesSelection(); 428 void checkCurrentPlayedSelection(); 429 void log(int, const QString &); logFE(const QString & message)430 void logFE(const QString &message) { log(QMC2_LOG_FRONTEND, message); } logEMU(const QString & message)431 void logEMU(const QString &message) { log(QMC2_LOG_EMULATOR, message); } 432 void logScrollToEnd(int); 433 void init(); 434 void setupStyle(QString); 435 void setupStyleSheet(QString); 436 void setupPalette(QString); 437 void viewFullDetail(); 438 void viewParentClones(); 439 void loadMachineInfoDB(); 440 void loadEmuInfoDB(); 441 void loadSoftwareInfoDB(); 442 #if defined(QMC2_YOUTUBE_ENABLED) 443 void loadYouTubeVideoInfoMap(); 444 #endif 445 void on_treeWidgetMachineList_itemEntered(QTreeWidgetItem *, int); 446 void on_treeWidgetMachineList_itemPressed(QTreeWidgetItem *, int); 447 void on_treeWidgetHierarchy_itemEntered(QTreeWidgetItem *, int); 448 void on_treeWidgetHierarchy_itemPressed(QTreeWidgetItem *, int); 449 void on_treeWidgetCategoryView_itemEntered(QTreeWidgetItem *, int); 450 void on_treeWidgetCategoryView_itemPressed(QTreeWidgetItem *, int); 451 void treeWidgetCategoryView_headerSectionClicked(int); 452 void on_treeWidgetCategoryView_itemActivated(QTreeWidgetItem *, int); 453 void on_treeWidgetCategoryView_itemDoubleClicked(QTreeWidgetItem *, int); 454 void on_treeWidgetCategoryView_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); 455 void on_treeWidgetCategoryView_itemSelectionChanged(); 456 void on_treeWidgetCategoryView_customContextMenuRequested(const QPoint &); 457 void viewByCategory(); 458 void on_treeWidgetVersionView_itemEntered(QTreeWidgetItem *, int); 459 void on_treeWidgetVersionView_itemPressed(QTreeWidgetItem *, int); 460 void treeWidgetVersionView_headerSectionClicked(int); 461 void on_treeWidgetVersionView_itemActivated(QTreeWidgetItem *, int); 462 void on_treeWidgetVersionView_itemDoubleClicked(QTreeWidgetItem *, int); 463 void on_treeWidgetVersionView_currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); 464 void on_treeWidgetVersionView_itemSelectionChanged(); 465 void on_treeWidgetVersionView_customContextMenuRequested(const QPoint &); 466 void viewByVersion(); 467 void actionCustomView_triggered(); 468 void projectMessSystemLoadStarted(); 469 void projectMessSystemLoadFinished(bool); 470 void projectMessLoadStarted(); 471 void projectMessLoadFinished(bool); 472 void processOutputNotifier(int, const QString &, const QString &); 473 void on_hSplitter_splitterMoved(int, int); 474 void on_vSplitter_splitterMoved(int, int); 475 void on_comboBoxViewSelect_currentIndexChanged(int); processEvents()476 void processEvents() { qApp->processEvents(); } 477 void treeWidgetMachineList_headerSectionClicked(int); 478 void treeWidgetHierarchy_headerSectionClicked(int); 479 QString &messWikiToHtml(QString &); 480 void startDownload(QWidget *, QNetworkReply *, QString saveAsName = QString(), QString savePath = QString()); 481 void on_pushButtonClearFinishedDownloads_clicked(); 482 void on_pushButtonReloadSelectedDownloads_clicked(); 483 void on_pushButtonStopSelectedDownloads_clicked(); 484 void emuSelector_currentIndexChanged(const QString &); 485 void checkActivity(); 486 void enableContextMenuPlayActions(bool); 487 void softwareLoadInterrupted(); 488 void checkRomPath(); 489 void negateSearchTriggered(bool); 490 void searchIncludeBiosSetsTriggered(bool); 491 void searchIncludeDeviceSetsTriggered(bool); 492 void updateTabWidgets(); 493 void viewPdf(QString filePath = QString()); 494 void viewHtml(QString filePath = QString()); 495 void showLoadAnim(QString text, bool enable = true); hideLoadAnim()496 void hideLoadAnim() { showLoadAnim(QString(), false); } 497 void actionRebuildRom_triggered(bool checked = false); 498 void update_rebuildRomActions_visibility(); 499 500 // float toggle button callbacks for 'special' widgets 501 void floatToggleButtonSoftwareDetail_toggled(bool); 502 void adjustSplitter(QSplitter *, QTabWidget *, QList<int> &, bool); 503 void stackedWidgetSpecial_setCurrentIndex(int); 504 505 // callbacks for list view header context menu requests 506 void treeWidgetMachineListHeader_customContextMenuRequested(const QPoint &); 507 void actionMachineListHeader_triggered(); 508 void treeWidgetHierarchyHeader_customContextMenuRequested(const QPoint &); 509 void actionHierarchyHeader_triggered(); 510 void treeWidgetCategoryViewHeader_customContextMenuRequested(const QPoint &); 511 void actionCategoryHeader_triggered(); 512 void treeWidgetVersionViewHeader_customContextMenuRequested(const QPoint &); 513 void actionVersionHeader_triggered(); 514 void comboBoxToolbarSearch_editTextChanged(const QString &); 515 void comboBoxToolbarSearch_activated(const QString &); comboBoxToolbarSearch_activated()516 void comboBoxToolbarSearch_activated() { comboBoxToolbarSearch_activated(comboBoxToolbarSearch->currentText()); } 517 signalStyleSetupRequested(QString style)518 void signalStyleSetupRequested(QString style) { emit styleSetupRequested(style); } signalStyleSheetSetupRequested(QString styleSheet)519 void signalStyleSheetSetupRequested(QString styleSheet) { emit styleSheetSetupRequested(styleSheet); } signalPaletteSetupRequested(QString style)520 void signalPaletteSetupRequested(QString style) { emit paletteSetupRequested(style); } 521 522 // callbacks for dynamically updated list contents (ranks and comments) 523 void treeWidgetMachineList_verticalScrollChanged(int value = -1); 524 void treeWidgetMachineList_updateRanks(); 525 void treeWidgetHierarchy_verticalScrollChanged(int value = -1); 526 void treeWidgetHierarchy_updateRanks(); 527 void on_treeWidgetHierarchy_itemExpanded(QTreeWidgetItem *); 528 void treeWidgetCategoryView_verticalScrollChanged(int value = -1); 529 void treeWidgetCategoryView_updateRanks(); 530 void on_treeWidgetCategoryView_itemExpanded(QTreeWidgetItem *); 531 void treeWidgetVersionView_verticalScrollChanged(int value = -1); 532 void treeWidgetVersionView_updateRanks(); 533 void on_treeWidgetVersionView_itemExpanded(QTreeWidgetItem *); 534 void updateUserData(); 535 void on_actionIncreaseRank_triggered(bool); 536 void on_actionDecreaseRank_triggered(bool); 537 void on_actionRankImageGradient_triggered(bool checked = false); 538 void on_actionRankImageFlat_triggered(bool checked = false); 539 void on_actionRankImagePlain_triggered(bool checked = false); 540 void on_actionRankImageColor_triggered(bool); 541 void on_actionSetRank0_triggered(bool); 542 void on_actionSetRank1_triggered(bool); 543 void on_actionSetRank2_triggered(bool); 544 void on_actionSetRank3_triggered(bool); 545 void on_actionSetRank4_triggered(bool); 546 void on_actionSetRank5_triggered(bool); 547 void on_actionTaggedIncreaseRank_triggered(bool); 548 void on_actionTaggedDecreaseRank_triggered(bool); 549 void on_actionTaggedSetRank0_triggered(bool); 550 void on_actionTaggedSetRank1_triggered(bool); 551 void on_actionTaggedSetRank2_triggered(bool); 552 void on_actionTaggedSetRank3_triggered(bool); 553 void on_actionTaggedSetRank4_triggered(bool); 554 void on_actionTaggedSetRank5_triggered(bool); 555 void on_actionLockRanks_triggered(bool); 556 void menuRank_enableActions(bool); 557 void menuRank_aboutToShow(); 558 RankItemWidget *getCurrentRankItemWidget(); 559 QList<RankItemWidget *> *getTaggedRankItemWidgets(); 560 561 // foreign IDs tree-widget 562 void on_treeWidgetForeignIDs_itemActivated(QTreeWidgetItem *, int); 563 void on_treeWidgetForeignIDs_itemDoubleClicked(QTreeWidgetItem *, int); 564 void on_treeWidgetForeignIDs_customContextMenuRequested(const QPoint &); 565 566 // selection and tag changes done by filtering machine list viewers 567 void machineListViewer_selectionChanged(const QString &id); 568 void machineListViewer_tagChanged(const QString &id, bool tagged); 569 570 // related to system manuals 571 void checkSystemManualAvailability(); 572 573 // Qt bug workarounds 574 void detailTabBarUpdate(int currentIndex); 575 576 // related to attached views 577 void showAttachedView(const QString &); 578 void attachedViewAction_triggered(bool); 579 580 protected: 581 void closeEvent(QCloseEvent *); 582 void showEvent(QShowEvent *); 583 void resizeEvent(QResizeEvent *); 584 585 signals: 586 void styleSetupRequested(QString); 587 void styleSheetSetupRequested(QString); 588 void paletteSetupRequested(QString); 589 590 // inform about selection changes done by ourself 591 void selectionChanged(const QString &); 592 void updateDetailTabBar(int); 593 594 private: 595 QTimer m_mlRankUpdateTimer; 596 QTimer m_hlRankUpdateTimer; 597 QTimer m_clRankUpdateTimer; 598 QTimer m_vlRankUpdateTimer; 599 bool m_ignoreSelectionChange; 600 bool m_ignoreDetailTabChange; 601 #if defined(QMC2_YOUTUBE_ENABLED) 602 bool m_videoInfoMapLoaded; 603 #endif 604 bool m_focusSearchResults; 605 MachineListViewer *m_lastMlvSender; 606 QList<RankItemWidget *> m_rankItemWidgets; 607 MachineListViewer *m_attachedViewer; 608 SearchBoxKeyEventFilter *m_searchBoxKeyEventFilter; 609 QMap<QString, QTreeWidgetItem *> m_sortedItemMap; 610 }; 611 612 #endif 613