HCWindow::HCWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); cb_game_engine->addItem("Generations"); //cb_game_engine->addItem("Unleashed"); // TO VERIFY //cb_game_engine->addItem("Lost World"); // TO VERIFY cb_game_engine->setCurrentIndex(0); connect(action_open_settings, SIGNAL(triggered()), this, SLOT(openSettingsTriggered())); connect(action_save_settings, SIGNAL(triggered()), this, SLOT(saveSettingsTriggered())); connect(action_about, SIGNAL(triggered()), this, SLOT(aboutTriggered())); connect(action_about_qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(action_close, SIGNAL(triggered()), this, SLOT(close())); connect(action_community_guide, SIGNAL(triggered()), this, SLOT(communityGuideTriggered())); connect(chk_gen_materials, SIGNAL(stateChanged(int)), this, SLOT(generateMaterialsChanged(int))); connect(chk_copy_convert_textures, SIGNAL(stateChanged(int)), this, SLOT(copyConvertTexturesChanged(int))); connect(pb_add_source_models, SIGNAL(released()), this, SLOT(addSourceModelsTriggered())); connect(pb_remove_source_model, SIGNAL(released()), this, SLOT(removeSourceModelTriggered())); connect(pb_clear_source_models, SIGNAL(released()), this, SLOT(clearSourceModelsTriggered())); connect(pb_source_textures, SIGNAL(released()), this, SLOT(browseTexturesTriggered())); connect(pb_terrain_output, SIGNAL(released()), this, SLOT(browseOutputTriggered())); connect(pb_reset_transform, SIGNAL(released()), this, SLOT(resetTransformTriggered())); connect(pb_tag_sheet, SIGNAL(released()), this, SLOT(tagCheatSheetTriggered())); connect(pb_convert, SIGNAL(released()), this, SLOT(convertTriggered())); te_progress->setReadOnly(true); // Reset log file QFile log_file(LogPath); log_file.open(QIODevice::WriteOnly); log_file.close(); logProgress(ProgressNormal, "Logging progress to " + LogPath); if (!QFileInfo(DefaultSettingsPath).exists()) { // Default settings converter_settings.model_source_paths = QStringList(); converter_settings.texture_source_path = ""; converter_settings.terrain_output_path = ""; converter_settings.game_engine = Generations; converter_settings.merge_existing = true; converter_settings.generate_materials = true; converter_settings.copy_and_convert_textures = true; converter_settings.force_tags_layers = true; converter_settings.remove_material_tags = true; converter_settings.remove_model_tags = true; converter_settings.use_model_groups = true; converter_settings.convert_lights = true; converter_settings.group_cell_size = 25.0; converter_settings.position_x = converter_settings.position_y = converter_settings.position_z = 0.0; converter_settings.scale_x = converter_settings.scale_y = converter_settings.scale_z = 100.0; converter_settings.rotation_x = converter_settings.rotation_y = converter_settings.rotation_z = 0.0; saveSettings(DefaultSettingsPath); } else { loadSettings(DefaultSettingsPath); } updateUiFromSettings(); }
HKWindow::HKWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); cb_mode->addItem("Collision"); //cb_mode->addItem("Rigid Bodies"); // TO IMPLEMENT //cb_mode->addItem("Animation"); // TO IMPLEMENT cb_mode->setCurrentIndex(0); havok_enviroment = NULL; connect(action_open_settings, SIGNAL(triggered()), this, SLOT(openSettingsTriggered())); connect(action_save_settings, SIGNAL(triggered()), this, SLOT(saveSettingsTriggered())); connect(action_about, SIGNAL(triggered()), this, SLOT(aboutTriggered())); connect(action_about_qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(action_close, SIGNAL(triggered()), this, SLOT(close())); connect(action_community_guide, SIGNAL(triggered()), this, SLOT(communityGuideTriggered())); connect(pb_add_source_models, SIGNAL(released()), this, SLOT(addSourceModelsTriggered())); connect(pb_remove_source_model, SIGNAL(released()), this, SLOT(removeSourceModelTriggered())); connect(pb_clear_source_models, SIGNAL(released()), this, SLOT(clearSourceModelsTriggered())); connect(pb_output_file, SIGNAL(released()), this, SLOT(browseOutputTriggered())); connect(pb_reset_transform, SIGNAL(released()), this, SLOT(resetTransformTriggered())); connect(pb_up, SIGNAL(released()), this, SLOT(tagMoveUpTriggered())); connect(pb_down, SIGNAL(released()), this, SLOT(tagMoveDownTriggered())); connect(pb_new, SIGNAL(released()), this, SLOT(newTagTriggered())); connect(pb_delete, SIGNAL(released()), this, SLOT(deleteTagTriggered())); connect(tb_properties, SIGNAL(cellChanged(int, int)), this, SLOT(tagChangedTriggered(int, int))); connect(tb_properties, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(tagDoubleClickTriggered(int, int))); connect(pb_convert, SIGNAL(released()), this, SLOT(convertTriggered())); te_progress->setReadOnly(true); // Reset log file QFile log_file(LogPath); log_file.open(QIODevice::WriteOnly); log_file.close(); logProgress(ProgressNormal, "Logging progress to " + LogPath); if (!QFileInfo(DefaultSettingsPath).exists()) { // Default settings converter_settings.mode = Collision; converter_settings.model_source_paths = QStringList(); converter_settings.output_file = ""; converter_settings.position_x = converter_settings.position_y = converter_settings.position_z = 0.0; converter_settings.scale_x = converter_settings.scale_y = converter_settings.scale_z = 100.0; converter_settings.rotation_x = converter_settings.rotation_y = converter_settings.rotation_z = 0.0; saveSettings(DefaultSettingsPath); } else { loadSettings(DefaultSettingsPath); } updateUiFromSettings(); }
UbuntuTray::UbuntuTray(Main *qtnote, QObject *parent) : TrayImpl(parent), qtnote(qtnote), contextMenu(0) { menuUpdateTimer = new QTimer(this); menuUpdateTimer->setInterval(1000); menuUpdateTimer->setSingleShot(true); connect(menuUpdateTimer, SIGNAL(timeout()), SLOT(rebuildMenu())); sti = new QSystemTrayIcon(QIcon::fromTheme("qtnote", QIcon(":/icons/trayicon")), this); connect(sti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SIGNAL(newNoteTriggered())); actQuit = new QAction(QIcon(":/icons/exit"), tr("&Quit"), this); actNew = new QAction(QIcon(":/icons/new"), tr("&New"), this); actAbout = new QAction(QIcon(":/icons/trayicon"), tr("&About"), this); actOptions = new QAction(QIcon(":/icons/options"), tr("&Options"), this); actManager = new QAction(QIcon(":/icons/manager"), tr("&Note Manager"), this); connect(actQuit, SIGNAL(triggered()), SIGNAL(exitTriggered())); connect(actNew, SIGNAL(triggered()), SIGNAL(newNoteTriggered())); connect(actManager, SIGNAL(triggered()), SIGNAL(noteManagerTriggered())); connect(actOptions, SIGNAL(triggered()), SIGNAL(optionsTriggered())); connect(actAbout, SIGNAL(triggered()), SIGNAL(aboutTriggered())); advancedMenu = new QMenu; advancedMenu->addAction(actOptions); advancedMenu->addAction(actManager); advancedMenu->addAction(actAbout); advancedMenu->addSeparator(); advancedMenu->addAction(actQuit); advancedMenu->setTitle(tr("More..")); connect(NoteManager::instance(), SIGNAL(storageAdded(StorageItem)), menuUpdateTimer, SLOT(start())); connect(NoteManager::instance(), SIGNAL(storageRemoved(StorageItem)), menuUpdateTimer, SLOT(start())); connect(NoteManager::instance(), SIGNAL(storageChanged(StorageItem)), menuUpdateTimer, SLOT(start())); menuUpdateTimer->start(); }
KDEIntegrationTray::KDEIntegrationTray(Main *qtnote, QObject *parent) : TrayImpl(parent), qtnote(qtnote) { sni = new KStatusNotifierItem("qtnote", this); sni->setIconByName("qtnote"); // TODO review dev mode when no icon in /usr/share sni->setStatus(KStatusNotifierItem::Active); sni->setTitle("Notes"); auto *contextMenu = new Menu; sni->setContextMenu(contextMenu); actNew = new QAction(QIcon(":/icons/new"), tr("&New"), this); contextMenu->addAction(actNew); contextMenu->addSeparator(); contextMenu->addAction(QIcon(":/icons/manager"), tr("&Note Manager"), this, SIGNAL(noteManagerTriggered())); contextMenu->addAction(QIcon(":/icons/options"), tr("&Options"), this, SIGNAL(optionsTriggered())); contextMenu->addAction(QIcon(":/icons/trayicon"), tr("&About"), this, SIGNAL(aboutTriggered())); connect(actNew, SIGNAL(triggered()), SIGNAL(newNoteTriggered())); connect(sni, SIGNAL(activateRequested(bool,QPoint)), SLOT(showNotes(bool,QPoint))); connect(sni, SIGNAL(secondaryActivateRequested(QPoint)), SIGNAL(newNoteTriggered())); }
void MainWindow::init() { /* MenuBar */ setMenuBar(new MenuBar(addToolBar(tr("")), this)); connect(menuBar(), SIGNAL(newTabTriggered()), this, SLOT(newTab())); connect(menuBar(), SIGNAL(openTriggered()), this, SLOT(openTriggered())); connect(menuBar(), SIGNAL(openClipboardTriggered()), this, SLOT(openClipboardTriggered())); connect(menuBar(), SIGNAL(saveAsTriggered()), this, SLOT(saveAsTriggered())); connect(menuBar(), SIGNAL(saveHtmlTriggered()), this, SLOT(saveHtmlTriggered())); connect(menuBar(), SIGNAL(printTriggered()), this, SLOT(printTriggered())); connect(menuBar(), SIGNAL(closeTabTriggered()), this, SLOT(closeTabTriggered())); connect(menuBar(), SIGNAL(quitTriggered()), this, SLOT(close())); connect(menuBar(), SIGNAL(findNextTriggered()), this, SLOT(findNextTriggered())); connect(menuBar(), SIGNAL(findPreviousTriggered()), this, SLOT(findPreviousTriggered())); connect(menuBar(), SIGNAL(gotoLineTriggered()), this, SLOT(gotoLineTriggered())); connect(menuBar(), SIGNAL(reloadTriggered()), this, SLOT(reloadTriggered())); connect(menuBar(), SIGNAL(zoomInTriggered()), this, SLOT(zoomInTriggered())); connect(menuBar(), SIGNAL(zoomOutTriggered()), this, SLOT(zoomOutTriggered())); connect(menuBar(), SIGNAL(zoomNormalTriggered()), this, SLOT(zoomNormalTriggered())); connect(menuBar(), SIGNAL(lineWrapTriggered()), this, SLOT(lineWrapTriggered())); connect(menuBar(), SIGNAL(optionTriggered()), this, SLOT(optionTriggered())); connect(menuBar(), SIGNAL(updateTriggered()), this, SLOT(updateTriggered())); connect(menuBar(), SIGNAL(reportBugTriggered()), this, SLOT(reportBugTriggered())); connect(menuBar(), SIGNAL(requestFeatureTriggered()), this, SLOT(requestFeatureTriggered())); connect(menuBar(), SIGNAL(aboutTriggered()), this, SLOT(aboutTriggered())); connect(menuBar(), SIGNAL(openRecentFiles(QAction*)), this, SLOT(openRecentFiles(QAction*))); connect(menuBar(), SIGNAL(fileBrowserVisibleChanged(bool)), this, SLOT(fileBrowserVisibleChanged(bool))); connect(menuBar(), SIGNAL(resultViewVisibleChanged(bool)), this, SLOT(resultViewVisibleChanged(bool))); connect(menuBar(), SIGNAL(chartViewVisibleChanged(bool)), this, SLOT(chartViewVisibleChanged(bool))); connect(static_cast<MenuBar*>(menuBar())->searchLineEdit(), SIGNAL(returnPressed()), this, SLOT(findNextTriggered())); /* StatusBar */ setStatusBar(new StatusBar(this)); connect(static_cast<StatusBar*>(statusBar()), SIGNAL(textEncodingChanged(QString)), this, SLOT(textEncodingChanged(QString))); /* TabWidget */ m_tabWidget = new TabWidget(this); connect(m_tabWidget, SIGNAL(newTab()), this, SLOT(newTab())); connect(m_tabWidget, SIGNAL(closeAll()), this, SLOT(closeAll())); connect(m_tabWidget, SIGNAL(closeOthers(int)), this, SLOT(closeOthers(int))); connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); newTab(); setCentralWidget(m_tabWidget); /* DockWidget */ createDockWidget(); /* Keyword Button Group */ connect(keywordButtonGroup(), SIGNAL(buttonReloaded()), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupReloaded())); connect(keywordButtonGroup(), SIGNAL(buttonClicked(QWidget*,QButtonGroup*)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupClicked(QWidget*,QButtonGroup*))); connect(keywordButtonGroup(), SIGNAL(buttonAdded(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupAdded(QStringList&))); connect(keywordButtonGroup(), SIGNAL(buttonRemoved(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupRemoved(QStringList&))); /* File Load Manager */ connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), this, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadProgress(QWidget*,QString*,int)), this, SLOT(fileLoadProgress(QWidget*,QString*,int))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), this, SLOT(fileLoadProgress(QWidget*,QString*))); connect(FILELOADMANAGER(), SIGNAL(codecDected(QString)), this, SLOT(codecDected(QString))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), m_tabWidget, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), m_tabWidget, SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), LOGVIEWERMANAGER(), SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), LOGVIEWERMANAGER(), SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(fileSizeNotify(QWidget*,long)), LOGVIEWERMANAGER(), SLOT(fileSizeNotified(QWidget*,long))); connect(FILELOADMANAGER(), SIGNAL(fileNameNotify(QWidget*,QString)), LOGVIEWERMANAGER(), SLOT(fileNameNotified(QWidget*,QString))); /* Log Viewer */ connect(LOGVIEWERMANAGER(), SIGNAL(selectionChanged(QWidget*)), this, SLOT(selectionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(cursorPositionChanged(QWidget*)), this, SLOT(cursorPositionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(fileDropped(QString)), this, SLOT(fileDropped(QString))); connect(LOGVIEWERMANAGER(), SIGNAL(modelCreated(QWidget*, QStandardItemModel*)), this, SLOT(modelCreated(QWidget*, QStandardItemModel*))); connect(LOGVIEWERMANAGER(), SIGNAL(chartLoaded(QWidget*, QPixmap*)), this, SLOT(chartLoaded(QWidget*, QPixmap*))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { pDetectorProgress = NULL; mLogAllXmlRpcOutput = false; mDbUpdated = false; // mSyncRequests tracks how many sync requests have been made // in order to know when to re-enable the widgets mSyncRequests = 0; // mSyncPosition is used to iterate through the backend list, // so we only sync one repository at a time, rather than flinging // requests at all of them at once. mSyncPosition = 0; mUploading = false; QSettings settings("Entomologist"); pManager = new QNetworkAccessManager(); connect(pManager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)), this, SLOT(handleSslErrors(QNetworkReply *, const QList<QSslError> &))); ui->setupUi(this); QToolBar *toolBar = new QToolBar("Main Toolbar"); toolBar->setObjectName("Main ToolBar"); toolBar->setIconSize(QSize(32,32)); refreshButton = toolBar->addAction(style()->standardIcon(QStyle::SP_BrowserReload), ""); refreshButton->setToolTip("Resync all trackers"); uploadButton = toolBar->addAction(style()->standardIcon(QStyle::SP_ArrowUp), ""); uploadButton->setToolTip("Upload changes"); changelogButton = toolBar->addAction(style()->standardIcon(QStyle::SP_FileDialogInfoView), ""); changelogButton->setToolTip("Show changelog"); toolBar->setMovable(false); addToolBar(Qt::TopToolBarArea, toolBar); setupTrayIcon(); // Setup the "Show" menu and "Work Offline" ui->actionMy_Bugs->setChecked(settings.value("show-my-bugs", true).toBool()); ui->actionMy_Reports->setChecked(settings.value("show-my-reports", true).toBool()); ui->actionMy_CCs->setChecked(settings.value("show-my-ccs", true).toBool()); ui->actionMonitored_Components->setChecked(settings.value("show-my-monitored", true).toBool()); ui->action_Work_Offline->setChecked(settings.value("work-offline", false).toBool()); // Set the default network status pStatusIcon = new QLabel(); pStatusIcon->setPixmap(QPixmap(":/online")); pStatusMessage = new QLabel(""); ui->statusBar->addPermanentWidget(pStatusMessage); ui->statusBar->addPermanentWidget(pStatusIcon); // We use a spinner animation to show that we're doing things pSpinnerMovie = new QMovie(this); pSpinnerMovie->setFileName(":/spinner"); pSpinnerMovie->setScaledSize(QSize(48,48)); ui->spinnerLabel->setMovie(pSpinnerMovie); ui->spinnerLabel->hide(); ui->syncingLabel->hide(); // Set up the resync timer pUpdateTimer = new QTimer(this); connect(pUpdateTimer, SIGNAL(timeout()), this, SLOT(resync())); setTimer(); // Keyboard shortcuts for search bar focus / upload changes. QShortcut* searchFocus; QShortcut* uploadChange; QShortcut *logXmlRpc; searchFocus = new QShortcut(QKeySequence(Qt::META + Qt::Key_Space),this); searchFocus->setContext(Qt::ApplicationShortcut); connect(searchFocus,SIGNAL(activated()),this,SLOT(searchFocusTriggered())); uploadChange = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this); uploadChange->setContext(Qt::ApplicationShortcut); connect(uploadChange,SIGNAL(activated()),this,SLOT(upload())); logXmlRpc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this); logXmlRpc->setContext(Qt::ApplicationShortcut); connect(logXmlRpc, SIGNAL(activated()), this, SLOT(toggleXmlRpcLogging())); // Menu actions connect(ui->action_Add_Tracker, SIGNAL(triggered()), this, SLOT(addTrackerTriggered())); connect(ui->action_Refresh_Tracker,SIGNAL(triggered()), this, SLOT(resync())); connect(ui->actionShow_ToDo_List, SIGNAL(triggered()), this, SLOT(showTodoList())); connect(ui->action_About, SIGNAL(triggered()), this, SLOT(aboutTriggered())); connect(ui->action_Web_Site, SIGNAL(triggered()), this, SLOT(websiteTriggered())); connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefsTriggered())); connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(quitEvent())); connect(ui->actionMy_Bugs, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMy_CCs, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMy_Reports, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionMonitored_Components, SIGNAL(triggered()), this, SLOT(showActionTriggered())); connect(ui->actionEdit_Monitored_Components, SIGNAL(triggered()), this, SLOT(showEditMonitoredComponents())); connect(ui->action_Work_Offline, SIGNAL(triggered()), this, SLOT(workOfflineTriggered())); // Set up the search button connect(changelogButton, SIGNAL(triggered()), this, SLOT(changelogTriggered())); connect(ui->trackerTab, SIGNAL(showMenu(int)), this, SLOT(showMenu(int))); ui->trackerTab->removeTab(0); ui->trackerTab->removeTab(0); // And finally set up the various other widgets connect(refreshButton, SIGNAL(triggered()), this, SLOT(resync())); connect(uploadButton, SIGNAL(triggered()), this, SLOT(upload())); restoreGeometry(settings.value("window-geometry").toByteArray()); // Set the network status bar and check for updates if possible if (isOnline()) if (settings.value("update-check", true).toBool() == true) checkForUpdates(); setupDB(); toggleButtons(); // Now we need the todo list widget pToDoDock = new QDockWidget(tr("ToDo List"), this); pToDoDock->setObjectName("ToDoDock"); pToDoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); pToDoListWidget = new ToDoListWidget(pToDoDock); pToDoDock->setWidget(pToDoListWidget); addDockWidget(Qt::LeftDockWidgetArea, pToDoDock); pToDoDock->hide(); restoreState(settings.value("entomologist-state").toByteArray()); connect(pToDoDock, SIGNAL(visibilityChanged(bool)), this, SLOT(dockVisibilityChanged(bool))); if (pToDoDock->isVisible()) ui->actionShow_ToDo_List->setText("Hide ToDo List"); else ui->actionShow_ToDo_List->setText("Show ToDo List"); pSearchTab = new SearchTab(this); connect(pSearchTab, SIGNAL(openSearchedBug(QString,QString)), this, SLOT(openSearchedBug(QString,QString))); loadTrackers(); ui->trackerTab->addTab(pSearchTab, QIcon(":/search"), "Search"); if ((settings.value("startup-sync", false).toBool() == true) || (mDbUpdated)) syncNextTracker(); }