bool QRecentFilesMenu::restoreState(const QByteArray &state) { int version = 0; QByteArray sd = state; QDataStream stream(&sd, QIODevice::ReadOnly); qint32 marker; qint32 v; stream >> marker; stream >> v; if (marker != RecentFilesMenuMagic || v != version) return false; stream >> m_files; updateRecentFileActions(); return true; }
void TxtReader::setCurrentFile(const QString &fileName) { curFile = fileName; setWindowTitle(tr("%1 - Txt Reader %2").arg(strippedName(curFile)) .arg(version)); QSettings settings("lsyer", "txtreader"); QStringList files = settings.value("recentFileList").toStringList(); files.removeAll(fileName); files.prepend(fileName); while (files.size() > MaxRecentFiles) files.removeLast(); settings.setValue("recentFileList", files); updateRecentFileActions(); return ; }
void MainWindow::createMenus() { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(newAct); fileMenu->addAction(openAct); fileMenu->addAction(saveAct); fileMenu->addAction(saveAsAct); separatorAct = fileMenu->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) fileMenu->addAction(recentFileActs[i]); fileMenu->addSeparator(); fileMenu->addAction(exitAct); updateRecentFileActions(); menuBar()->addSeparator(); helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(aboutAct); helpMenu->addAction(aboutQtAct); }
void MainWindow::downloadError(const QUrl& url, const QString& error) { statusBar()->showMessage(""); const QString scheme = url.scheme().toLower(); if (scheme == "http" || scheme == "ftp") { QMessageBox::warning(this, tr("Download Error"), tr("Failed to download %1: %2").arg(url.toString()).arg(error)); } else { QMessageBox::warning(this, tr("Open Error"), tr("Failed to open %1").arg(url.toString())); } recentFiles.removeAll(url.toString()); updateRecentFileActions(); report->setData(""); fileNamePane->setText(""); enableActions(); }
Void PlaYUVerApp::readSettings() { QSettings appSettings; QPoint pos = appSettings.value( "MainWindow/Position", QPoint( 200, 200 ) ).toPoint(); QSize size = appSettings.value( "MainWindow/Size", QSize( 500, 400 ) ).toSize(); move( pos ); resize( size ); m_cLastOpenPath = appSettings.value( "MainWindow/LastOpenPath", QDir::homePath() ).toString(); QVariant value = appSettings.value( "MainWindow/RecentFileList" ); m_aRecentFileStreamInfo = value.value<PlaYUVerStreamInfoVector>(); checkRecentFileActions(); updateRecentFileActions(); m_appModuleVideo->readSettings(); m_appModuleQuality->readSettings(); m_appModuleExtensions->readSettings(); m_pcWindowHandle->readSettings(); }
// Add the filename to the recent files list and update the title bar. void MainWindow::setCurrentFile( const QString& fileName ) { // Change the current file currentFile = fileName; QString shownName = tr( "Untitled" ); if ( !currentFile.isEmpty() ) { // (reload the list first in case another glogg changed it) GetPersistentInfo().retrieve( "recentFiles" ); recentFiles.addRecent( currentFile ); GetPersistentInfo().save( "recentFiles" ); updateRecentFileActions(); shownName = strippedName( currentFile ); } setWindowTitle( tr("%1 - %2").arg(shownName).arg(tr("glogg")) #ifdef GLOGG_COMMIT + " (dev build " GLOGG_VERSION ")" #endif ); }
void Window::createMenus() { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(newSceneAct); fileMenu->addAction(openSceneAct); fileMenu->addAction(saveSceneAct); fileMenu->addAction(saveSceneAsAct); fileMenu->addAction(revertAct); recentFilesMenu = new QMenu(tr("&Recent Scene")); for (int i = 0; i < MaxRecentFiles; ++i) recentFilesMenu->addAction(recentFileActs[i]); fileMenu->addMenu(recentFilesMenu); fileMenu->addSeparator(); fileMenu->addAction(importMeshAct); //fileMenu->addAction(importFDMAct); fileMenu->addAction(importBakeAct); fileMenu->addAction(exportBakeAct); fileMenu->addAction(exportStatAct); windowMenu = menuBar()->addMenu(tr("&Window")); windowMenu->addAction(showFeatherEditAct); windowMenu->addAction(showBarbEditAct); windowMenu->addAction(showBrushControlAct); windowMenu->addAction(showSceneEditAct); windowMenu->addAction(showTimeControlAct); windowMenu->addAction(showRenderEditAct); skinMenu = menuBar()->addMenu(tr("&Skin")); skinMenu->addAction(growOnAct); skinMenu->addAction(growOffAct); selectMapMenu = skinMenu->addMenu(tr("&Select Attribute Map")); selectMapMenu->addAction(selectGrowonAct); selectMapMenu->addAction(selectDistributeAct); selectMapMenu->addAction(selectDensityAct); updateRecentFileActions(); }
void MainWindow::initMenuFile() { //connect menu "File" Action connect(actionNew, SIGNAL(triggered()), _documentManager, SLOT(newDocument())); connect(actionOpen, SIGNAL(triggered()), _documentManager, SLOT(open())); connect(actionSave, SIGNAL(triggered()), _documentManager, SLOT(save())); connect(actionSaveAs, SIGNAL(triggered()), _documentManager, SLOT(saveAs())); connect(actionSaveACopyAs, SIGNAL(triggered()), _documentManager, SLOT(saveACopyAs())); connect(actionSaveAll, SIGNAL(triggered()), _documentManager, SLOT(saveAll())); connect(actionClose, SIGNAL(triggered()), _documentManager, SLOT(close())); connect(actionCloseAll, SIGNAL(triggered()), _documentManager, SLOT(closeAll())); connect(actionCloseAllExceptCurrentDocument, SIGNAL(triggered()), _documentManager, SLOT(closeAllExceptCurrentDocument())); connect(actionReload, SIGNAL(triggered()), _documentManager, SLOT(reload())); connect(actionPrint, SIGNAL(triggered()), _documentManager, SLOT(print())); connect(actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); connect(actionExportAsHTML, SIGNAL(triggered()), this, SLOT(exportDocument())); connect(actionNewSession, SIGNAL(triggered()), _sessionManager, SLOT(newSession())); connect(actionOpenSession, SIGNAL(triggered()), _sessionManager, SLOT(openSession())); connect(actionSwitchSession, SIGNAL(triggered()), _sessionManager, SLOT(switchSession())); connect(actionSaveSession, SIGNAL(triggered()), _sessionManager, SLOT(saveSession())); connect(actionSaveSessionAs, SIGNAL(triggered()), _sessionManager, SLOT(saveSessionAs())); connect(actionManageSessions, SIGNAL(triggered()), _sessionManager, SLOT(manageSessions())); //recent file actions connect(actionEmptyRecentFilesList, SIGNAL(triggered()), this, SLOT(clearRecentFile())); connect(actionOpenAllRecentFiles, SIGNAL(triggered()), this, SLOT(openAllRecentFile())); _recentFileSeparator = menuRecentFiles->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) { _recentFileActions[i] = new QAction(this); _recentFileActions[i]->setVisible(false); connect(_recentFileActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile())); menuRecentFiles->addAction(_recentFileActions[i]); } updateRecentFileActions(); }
void MainWindow::createFileMenu() { QAction* new_act = new QAction(QIcon(QString::fromLatin1(":/images/new.png")), tr("&New"), this); new_act->setShortcuts(QKeySequence::New); new_act->setStatusTip(tr("Create a new map")); new_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(new_act, &QAction::triggered, this, &MainWindow::showNewMapWizard); QAction* open_act = new QAction(QIcon(QString::fromLatin1(":/images/open.png")), tr("&Open..."), this); open_act->setShortcuts(QKeySequence::Open); open_act->setStatusTip(tr("Open an existing file")); open_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(open_act, &QAction::triggered, this, &MainWindow::showOpenDialog); open_recent_menu = new QMenu(tr("Open &recent"), this); open_recent_menu->setWhatsThis(Util::makeWhatThis("file_menu.html")); for (int i = 0; i < max_recent_files; ++i) { recent_file_act[i] = new QAction(this); connect(recent_file_act[i], &QAction::triggered, this, &MainWindow::openRecentFile); } open_recent_menu_inserted = false; // NOTE: if you insert something between open_recent_menu and save_act, adjust updateRecentFileActions()! save_act = new QAction(QIcon(QString::fromLatin1(":/images/save.png")), tr("&Save"), this); save_act->setShortcuts(QKeySequence::Save); save_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(save_act, &QAction::triggered, this, &MainWindow::save); auto save_as_act = new QAction(tr("Save &as..."), this); if (QKeySequence::keyBindings(QKeySequence::SaveAs).empty()) save_as_act->setShortcut(tr("Ctrl+Shift+S")); else save_as_act->setShortcuts(QKeySequence::SaveAs); save_as_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(save_as_act, &QAction::triggered, this, &MainWindow::showSaveAsDialog); settings_act = new QAction(tr("Settings..."), this); settings_act->setShortcut(QKeySequence::Preferences); settings_act->setMenuRole(QAction::PreferencesRole); connect(settings_act, &QAction::triggered, this, &MainWindow::showSettings); close_act = new QAction(QIcon(QString::fromLatin1(":/images/close.png")), tr("Close"), this); close_act->setShortcut(QKeySequence::Close); close_act->setStatusTip(tr("Close this file")); close_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(close_act, &QAction::triggered, this, &MainWindow::closeFile); QAction* exit_act = new QAction(tr("E&xit"), this); exit_act->setShortcuts(QKeySequence::Quit); exit_act->setStatusTip(tr("Exit the application")); exit_act->setMenuRole(QAction::QuitRole); exit_act->setWhatsThis(Util::makeWhatThis("file_menu.html")); connect(exit_act, &QAction::triggered, qApp, &QApplication::closeAllWindows); if (show_menu) { file_menu = menuBar()->addMenu(tr("&File")); } else { delete file_menu; file_menu = new QMenu(this); } file_menu->setWhatsThis(Util::makeWhatThis("file_menu.html")); file_menu->addAction(new_act); file_menu->addAction(open_act); file_menu->addAction(save_act); file_menu->addAction(save_as_act); file_menu->addSeparator(); file_menu->addAction(settings_act); file_menu->addSeparator(); file_menu->addAction(close_act); file_menu->addAction(exit_act); general_toolbar = new QToolBar(tr("General")); general_toolbar->setObjectName(QString::fromLatin1("General toolbar")); general_toolbar->addAction(new_act); general_toolbar->addAction(open_act); general_toolbar->addAction(save_act); save_act->setEnabled(has_opened_file); save_as_act->setEnabled(has_opened_file); close_act->setEnabled(has_opened_file); updateRecentFileActions(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); createStatusBar(); // Recent files for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); printer = new QPrinter; printer->setFullPage(true); printer->setPaperSize(QPrinter::Letter); printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch); report = new Report(printer, this); view = new ReportView(report, this); preview = new QPrintPreviewWidget(printer, this); setCentralWidget(preview); preview->fitToWidth(); QFontComboBox* fontComboBox = new QFontComboBox; fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts); fontComboBox->setCurrentFont(report->font().family()); ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont))); pageNumberComboBox = new QComboBox; ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox); connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int))); const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 }; zoomComboBox = new QComboBox; for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i) { zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i])); } zoomComboBox->setCurrentIndex(-1); ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox); connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString))); QActionGroup* orientationGroup = new QActionGroup(this); orientationGroup->addAction(ui->actionPortrait); orientationGroup->addAction(ui->actionLandscape); orientationChanged(report->orientation()); QActionGroup* heightGroup = new QActionGroup(this); heightGroup->addAction(ui->action6LPI); heightGroup->addAction(ui->action8LPI); heightGroup->addAction(ui->action9LPI); heightGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool))); QActionGroup* widthGroup = new QActionGroup(this); widthGroup->addAction(ui->actionDefaultWidth); widthGroup->addAction(ui->action10CPI); widthGroup->addAction(ui->action12CPI); widthGroup->addAction(ui->action17CPI); widthGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool))); QActionGroup* pageGroup = new QActionGroup(this); pageGroup->addAction(ui->actionSinglePage); pageGroup->addAction(ui->actionFacingPages); pageGroup->addAction(ui->actionAllPages); ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView); ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView); ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open())); connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup())); connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy())); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool))); connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool))); connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool))); connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool))); connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor())); connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor())); connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi())); connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi())); connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi())); connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault())); connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi())); connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi())); connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->actionFitWidth, SIGNAL(triggered()), preview, SLOT(fitToWidth())); connect(ui->actionFitHeight, SIGNAL(triggered()), preview, SLOT(fitInView())); connect(ui->actionPortrait, SIGNAL(triggered()), preview, SLOT(setPortraitOrientation())); connect(ui->actionLandscape, SIGNAL(triggered()), preview, SLOT(setLandscapeOrientation())); connect(ui->actionActualSize, SIGNAL(triggered()), this, SLOT(actualSize())); connect(ui->actionZoomIn, SIGNAL(triggered()), preview, SLOT(zoomIn())); connect(ui->actionZoomOut, SIGNAL(triggered()), preview, SLOT(zoomOut())); connect(ui->actionSinglePage, SIGNAL(triggered()), preview, SLOT(setSinglePageViewMode())); connect(ui->actionFacingPages, SIGNAL(triggered()), preview, SLOT(setFacingPagesViewMode())); connect(ui->actionAllPages, SIGNAL(triggered()), preview, SLOT(setAllPagesViewMode())); connect(ui->actionMainToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleMainToolbar(bool))); connect(ui->actionViewToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleViewToolbar(bool))); connect(ui->actionFontToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleFontToolbar(bool))); connect(ui->actionStatusBar, SIGNAL(triggered(bool)), this, SLOT(toggleStatusBar(bool))); connect(ui->menuToolbars, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(preview, SIGNAL(previewChanged()), this, SLOT(previewChanged())); connect(preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paint(QPrinter*))); connect(report, SIGNAL(loaded()), preview, SLOT(updatePreview())); connect(report, SIGNAL(changed()), preview, SLOT(updatePreview())); connect(report, SIGNAL(loaded()), this, SLOT(documentLoaded())); connect(report, SIGNAL(orientationChanged(QPrinter::Orientation)), this, SLOT(orientationChanged(QPrinter::Orientation))); connect(report, SIGNAL(lpiChanged(int)), this, SLOT(lpiChanged(int))); connect(report, SIGNAL(cpiChanged(int)), this, SLOT(cpiChanged(int))); connect(report, SIGNAL(boldChanged(bool)), ui->actionBold, SLOT(setChecked(bool))); connect(report, SIGNAL(fontChanged(QFont)), fontComboBox, SLOT(setCurrentFont(QFont))); QSettings settings; restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); recentFiles = settings.value("recentFiles").toStringList(); currentFolder = settings.value("currentFolder").toString(); ui->statusBar->setVisible(settings.value("statusBar", true).toBool()); updateRecentFileActions(); zoomTimer = new QTimer(this); connect(zoomTimer, SIGNAL(timeout()), this, SLOT(updateZoom())); connect(preview, SIGNAL(previewChanged()), this, SLOT(updateZoom())); zoomTimer->start(1000); }
void MainFrm::initUi() { //read this from the app settings this->setWindowTitle(qApp->applicationName() + qApp->applicationVersion()); connect(actionMedfisis_Help, SIGNAL(triggered()),this, SLOT(callAssistant() ),Qt::UniqueConnection); connect(actionAbout_this_project, SIGNAL(triggered()),this, SLOT(aboutThisProject () ),Qt::UniqueConnection); connect(actionLoad, SIGNAL(triggered()),this, SLOT(loadFile () ),Qt::UniqueConnection); connect(actionClose, SIGNAL(triggered()),this, SLOT(closeFile () ),Qt::UniqueConnection); connect(actionSave, SIGNAL(triggered()),this, SLOT(writeFile () ),Qt::UniqueConnection); connect(actionReports, SIGNAL(triggered()),this, SLOT(loadSecondaryFrm() ),Qt::UniqueConnection); connect(actionRebuild_Indexes, SIGNAL(triggered()),this, SLOT(RebuildIndexes() ),Qt::UniqueConnection); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } separatorAct = menuSampling_Operation->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) menuSampling_Operation->addAction(recentFileActs[i]); menuSampling_Operation->addSeparator(); updateRecentFileActions(); toolbar=addToolBar(tr("Main Toolbar")); toolbar->setFloatable(true); toolbar->setMovable(true); toolbar->addAction(this->actionNew); toolbar->addAction(this->actionLoad); toolbar->addAction(this->actionClose); toolbar->addAction(this->actionSave); toolbar->addSeparator(); toolbar->addAction(this->actionReports); //since it is impossible to remove it later, we must take care on inserting the separator here! if (m_roleDef->bAdmin || m_roleDef->bRep) toolbar->addSeparator(); toolbar->addAction(actionRebuild_Indexes); if (m_roleDef->bAdmin) toolbar->addSeparator(); toolbar->addAction(this->actionAbout_this_project); toolbar->addAction(this->actionMedfisis_Help); toolbar->addSeparator(); toolbar->addAction(this->actionExit); pFrmReports=new FrmReports(); initSecondaryFrm(pFrmReports); applyReportAdminPermissions(); }
MainWindow::MainWindow(QWidget *parent, const QString &fileName) : QMainWindow(parent) { setupUi(this); _zoom = new QLabel(); _zoom->setToolTip(QString("Zoom factor")); _zoom->setFrameStyle(QFrame::Sunken); _zoom->setAlignment(Qt::AlignHCenter); _zoom->setMaximumWidth(50); this->statusBar()->addPermanentWidget(_zoom, 1); setAcceptDrops(true); fileWatcher = 0; imageItem = 0; gViewResult->viewport()->setGeometry(QRect(0,0,0,0)); imageScene = new Scene(); connect(imageScene, SIGNAL(dropedFilename(QString)), this, SLOT(openImage(QString))); connect(imageScene, SIGNAL(sceneScaleChanged(qreal)), this, SLOT(changeSceneScale(qreal))); connect(imageScene, SIGNAL(rotateImage(int)), this, SLOT(rotate(int))); connect(imageScene, SIGNAL(imageInfoTriggered()), this, SLOT(imageInfo())); connect(imageScene, SIGNAL(detectOrientationSignal()), this, SLOT(on_actionDetectOrientation_triggered())); gViewResult->setScene(imageScene); gViewResult->setRenderHint(QPainter::Antialiasing); gViewResult->setCacheMode(QGraphicsView::CacheBackground); gViewResult->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); gViewResult->setOptimizationFlags(QGraphicsView::DontSavePainterState | QGraphicsView::DontAdjustForAntialiasing); gViewResult->viewport()->setSizeIncrement(gViewResult->sceneRect().width(),gViewResult->sceneRect().height()); gViewResult->viewport()->setSizeIncrement(gViewResult->sceneRect().width(),gViewResult->sceneRect().height()); connect(actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQt())); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } fSeparatorAct = menuFile->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) menuFile->addAction(recentFileActs[i]); updateRecentFileActions(); readSettings(true); if (fileName.isEmpty()) { // Open last file on init if there was no argument recentFile = recentFileActs[0]->data().toString(); } else { recentFile = fileName; setZoom(1.0); } if (!recentFile.isEmpty()) openImage(recentFile); // default values for Clean Dark Background blackval = 70; whiteval = 180; thresh = 60; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { Q_INIT_RESOURCE(resources); /* Tabs */ pisoar = new Pisoar(); jaguar = new Jaguar(); kasuar = new Kasuar(); tabs = new QTabWidget(); tabs->addTab(pisoar, "Přiřazení"); tabs->addTab(jaguar, "Náhled"); tabs->addTab(kasuar, "Výstup"); /* Menu */ menuFile = menuBar()->addMenu(tr("&Databáze")); menuTools = menuBar()->addMenu(tr("&Nástroje")); createNewMenuAction(menuNewAct, "&Nová", "Vytvořit novou databázi", QKeySequence::New, f->icon_new, &MainWindow::onMenuFileNew); createNewMenuAction(menuOpenAct, "&Otevřít", "Otevřít existující databázi", QKeySequence::Open, f->icon_open, &MainWindow::onMenuFileOpen); createNewMenuAction(menuSaveAct, "&Uložit", "Uložit databázi", QKeySequence::Save, f->icon_save, &MainWindow::onMenuFileSave); createNewMenuAction(menuQuitAct, "&Konec", "Ukončit program", QKeySequence::Quit, f->icon_close, &QWidget::close); createNewMenuAction(menuGenerateAct,"&Vygenerovat výstupy", "Vygenerovat obrázky pro všechny layouty", QKeySequence::UnknownKey, f->icon_save, &MainWindow::onMenuToolsGenerateLayouts); createNewMenuAction(menuBatchAddAct,"&Přidat více objektů", "Přidat více objektů najednou", QKeySequence::UnknownKey, f->icon_new, &MainWindow::onMenuToolsBatchAdd); createNewMenuAction(menuBatchScaleAct,"&Spustit proces měřítka", "Režim automatického vyhledání fotografií potřebujících měřítko", QKeySequence::UnknownKey, f->icon_ruler, &MainWindow::onMenuToolsBatchScale); createNewMenuAction(menuCheckIntegrity,"&Zkontrolovat integritu", "Zkontroluje databázi a souborový systém", QKeySequence::UnknownKey, f->icon_check, &MainWindow::onMenuToolsCheckIntegrity); createNewMenuAction(menuSettingsAct,"&Nastavení", "Nastavení parametrů programu", QKeySequence::UnknownKey, f->icon_settings, &MainWindow::onMenuToolsSettings); createNewMenuAction(menuAboutAct, "&O programu", "Další informace o programu", QKeySequence::UnknownKey, f->icon_help, &MainWindow::onMenuToolsAbout); for (int i = 0; i < MaxRecentFiles; ++i) { menuRecentFileActs[i] = new QAction(this); menuRecentFileActs[i]->setVisible(false); connect(menuRecentFileActs[i], &QAction::triggered, this, &MainWindow::onMenuFileOpenRecent); } menuFile->addAction(menuNewAct); menuFile->addAction(menuOpenAct); menuFile->addAction(menuSaveAct); menuSeparatorAct = menuFile->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) menuFile->addAction(menuRecentFileActs[i]); menuFile->addSeparator(); menuFile->addAction(menuQuitAct); updateRecentFileActions(); menuTools->addAction(menuGenerateAct); menuTools->addAction(menuSettingsAct); menuTools->addAction(menuBatchAddAct); menuTools->addAction(menuBatchScaleAct); menuTools->addAction(menuCheckIntegrity); menuTools->addSeparator(); menuTools->addAction(menuAboutAct); /* Hide tabs when no database */ tabs->hide(); connect(pisoar->db_list, &QListView::activated, this, &MainWindow::onPisoarDBListActivated); connect(jaguar->db_list, &QListView::activated, this, &MainWindow::onJaguarDBListActivated); /* Main window */ setWindowTitle("Pisoar - PIcture SOrter for ARchaelogy [*]"); setCentralWidget(tabs); showMaximized(); }
MainGui::MainGui(QWidget *p) : QMainWindow(p), currenthdr(NULL) { setupUi(this); setAcceptDrops(true); //main toolbar setup QActionGroup *toolBarOptsGroup = new QActionGroup(this); toolBarOptsGroup->addAction(actionText_Under_Icons); toolBarOptsGroup->addAction(actionIcons_Only); toolBarOptsGroup->addAction(actionText_Alongside_Icons); toolBarOptsGroup->addAction(actionText_Only); menuToolbars->addAction(toolBar->toggleViewAction()); mdiArea = new QMdiArea(this); mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); mdiArea->setBackground(QBrush(QColor::fromRgb(192, 192, 192)) ); setCentralWidget(mdiArea); qtpfsgui_options=QtpfsguiOptions::getInstance(); load_options(); setWindowTitle("Qtpfsgui "QTPFSGUIVERSION); connect(mdiArea,SIGNAL(subWindowActivated(QMdiSubWindow*)),this,SLOT(updateActions(QMdiSubWindow*))); connect(fileNewAction, SIGNAL(triggered()), this, SLOT(fileNewViaWizard())); connect(fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(fileSaveAsAction, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(TonemapAction, SIGNAL(triggered()), this, SLOT(tonemap_requested())); connect(rotateccw, SIGNAL(triggered()), this, SLOT(rotateccw_requested())); connect(rotatecw, SIGNAL(triggered()), this, SLOT(rotatecw_requested())); connect(actionResizeHDR, SIGNAL(triggered()), this, SLOT(resize_requested())); connect(action_Projective_Transformation, SIGNAL(triggered()), this, SLOT(projectiveTransf_requested())); connect(actionBatch_Tone_Mapping, SIGNAL(triggered()), this, SLOT(batch_requested())); connect(Low_dynamic_range,SIGNAL(triggered()),this,SLOT(current_mdi_ldr_exp())); connect(Fit_to_dynamic_range,SIGNAL(triggered()),this,SLOT(current_mdi_fit_exp())); connect(Shrink_dynamic_range,SIGNAL(triggered()),this,SLOT(current_mdi_shrink_exp())); connect(Extend_dynamic_range,SIGNAL(triggered()),this,SLOT(current_mdi_extend_exp())); connect(Decrease_exposure,SIGNAL(triggered()),this,SLOT(current_mdi_decrease_exp())); connect(Increase_exposure,SIGNAL(triggered()),this,SLOT(current_mdi_increase_exp())); connect(zoomInAct,SIGNAL(triggered()),this,SLOT(current_mdi_zoomin())); connect(zoomOutAct,SIGNAL(triggered()),this,SLOT(current_mdi_zoomout())); connect(fitToWindowAct,SIGNAL(toggled(bool)),this,SLOT(current_mdi_fit_to_win(bool))); connect(normalSizeAct,SIGNAL(triggered()),this,SLOT(current_mdi_original_size())); connect(documentationAction,SIGNAL(triggered()),this,SLOT(openDocumentation())); connect(actionWhat_s_This,SIGNAL(triggered()),this,SLOT(enterWhatsThis())); connect(actionAbout_Qt,SIGNAL(triggered()),qApp,SLOT(aboutQt())); connect(actionAbout_Qtpfsgui,SIGNAL(triggered()),this,SLOT(aboutQtpfsgui())); connect(OptionsAction,SIGNAL(triggered()),this,SLOT(preferences_called())); connect(Transplant_Exif_Data_action,SIGNAL(triggered()),this,SLOT(transplant_called())); connect(actionTile,SIGNAL(triggered()),mdiArea,SLOT(tileSubWindows())); connect(actionCascade,SIGNAL(triggered()),mdiArea,SLOT(cascadeSubWindows())); connect(fileExitAction, SIGNAL(triggered()), this, SLOT(fileExit())); connect(menuWindows, SIGNAL(aboutToShow()), this, SLOT(updateWindowMenu())); connect(actionSave_Hdr_Preview, SIGNAL(triggered()), this, SLOT(saveHdrPreview())); //QSignalMapper? connect(actionText_Under_Icons,SIGNAL(triggered()),this,SLOT(Text_Under_Icons())); connect(actionIcons_Only,SIGNAL(triggered()),this,SLOT(Icons_Only())); connect(actionText_Alongside_Icons,SIGNAL(triggered()),this,SLOT(Text_Alongside_Icons())); connect(actionText_Only,SIGNAL(triggered()),this,SLOT(Text_Only())); windowMapper = new QSignalMapper(this); connect(windowMapper,SIGNAL(mapped(QWidget*)),this,SLOT(setActiveSubWindow(QWidget*))); //recent files for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } separatorRecentFiles = menuFile->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) menuFile->addAction(recentFileActs[i]); updateRecentFileActions(); //this->showMaximized(); testTempDir(qtpfsgui_options->tempfilespath); statusBar()->showMessage(tr("Ready.... Now open an Hdr or create one!"),17000); }
void MainWindow::settingsChanged() { updateRecentFileActions(); }
void MainWindow::clearRecentFileMenu(void) { QSettings settings; settings.setValue("recentFileList", QStringList()); updateRecentFileActions(); }
void QRecentFilesMenu::clearMenu() { m_files.clear(); updateRecentFileActions(); }
void QRecentFilesMenu::setMaxCount(int count) { m_maxCount = count; updateRecentFileActions(); }
QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) : QObject(workbench), m_workbench(workbench), m_assistantClient(0), m_openDirectory(QString()) { Q_ASSERT(m_workbench != 0); m_core = m_workbench->core(); Q_ASSERT(m_core != 0); QDesignerFormWindowManagerInterface *formWindowManager = m_core->formWindowManager(); Q_ASSERT(formWindowManager != 0); QDesignerSettings settings; m_fileActions = new QActionGroup(this); m_fileActions->setExclusive(false); m_recentFilesActions = new QActionGroup(this); m_recentFilesActions->setExclusive(false); m_editActions = new QActionGroup(this); m_editActions->setExclusive(false); m_formActions = new QActionGroup(this); m_formActions->setExclusive(false); m_windowActions = new QActionGroup(this); m_windowActions->setExclusive(false); m_toolActions = new QActionGroup(this); m_toolActions->setExclusive(true); m_helpActions = new QActionGroup(this); m_helpActions->setExclusive(false); // // file actions // m_newFormAction = new QAction(tr("&New Form..."), this); m_newFormAction->setShortcut(tr("CTRL+N")); connect(m_newFormAction, SIGNAL(triggered()), this, SLOT(createForm())); m_fileActions->addAction(m_newFormAction); m_openFormAction = new QAction(tr("&Open Form..."), this); m_openFormAction->setShortcut(tr("CTRL+O")); connect(m_openFormAction, SIGNAL(triggered()), this, SLOT(openForm())); m_fileActions->addAction(m_openFormAction); QAction *act; // Need to insert this into the QAction. for (int i = 0; i < MaxRecentFiles; ++i) { act = new QAction(this); act->setVisible(false); connect(act, SIGNAL(triggered()), this, SLOT(openRecentForm())); m_recentFilesActions->addAction(act); } updateRecentFileActions(); act = new QAction(this); act->setSeparator(true); m_recentFilesActions->addAction(act); act = new QAction(tr("Clear &Menu"), this); connect(act, SIGNAL(triggered()), this, SLOT(clearRecentFiles())); m_recentFilesActions->addAction(act); QAction *sep = new QAction(this); sep->setSeparator(true); m_fileActions->addAction(sep); m_saveFormAction = new QAction(tr("&Save Form"), this); m_saveFormAction->setShortcut(tr("CTRL+S")); connect(m_saveFormAction, SIGNAL(triggered()), this, SLOT(saveForm())); m_fileActions->addAction(m_saveFormAction); m_saveFormAsAction = new QAction(tr("Save Form &As..."), this); connect(m_saveFormAsAction, SIGNAL(triggered()), this, SLOT(saveFormAs())); m_fileActions->addAction(m_saveFormAsAction); m_saveFormAsTemplateAction = new QAction(tr("Save Form As &Template..."), this); connect(m_saveFormAsTemplateAction, SIGNAL(triggered()), this, SLOT(saveFormAsTemplate())); m_fileActions->addAction(m_saveFormAsTemplateAction); sep = new QAction(this); sep->setSeparator(true); m_fileActions->addAction(sep); m_closeFormAction = new QAction(tr("&Close Form"), this); m_closeFormAction->setShortcut(tr("CTRL+W")); connect(m_closeFormAction, SIGNAL(triggered()), this, SLOT(closeForm())); m_fileActions->addAction(m_closeFormAction); sep = new QAction(this); sep->setSeparator(true); m_fileActions->addAction(sep); m_quitAction = new QAction(tr("&Quit"), this); m_quitAction->setShortcut(tr("CTRL+Q")); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(shutdown())); m_fileActions->addAction(m_quitAction); // // edit actions // m_undoAction = formWindowManager->actionUndo(); m_undoAction->setShortcut(tr("CTRL+Z")); m_editActions->addAction(m_undoAction); m_redoAction = formWindowManager->actionRedo(); m_redoAction->setShortcut(tr("CTRL+SHIFT+Z")); m_editActions->addAction(m_redoAction); sep = new QAction(this); sep->setSeparator(true); m_editActions->addAction(sep); m_cutAction = formWindowManager->actionCut(); m_editActions->addAction(m_cutAction); m_copyAction = formWindowManager->actionCopy(); m_editActions->addAction(m_copyAction); m_pasteAction = formWindowManager->actionPaste(); m_editActions->addAction(m_pasteAction); m_deleteAction = formWindowManager->actionDelete(); m_editActions->addAction(m_deleteAction); m_selectAllAction = formWindowManager->actionSelectAll(); m_editActions->addAction(m_selectAllAction); sep = new QAction(this); sep->setSeparator(true); m_editActions->addAction(sep); m_sendToBackAction = formWindowManager->actionLower(); m_editActions->addAction(m_sendToBackAction); m_bringToFrontAction = formWindowManager->actionRaise(); m_editActions->addAction(m_bringToFrontAction); // // edit mode actions // m_editWidgetsAction = new QAction(tr("Edit Widgets"), this); m_editWidgetsAction->setCheckable(true); m_editWidgetsAction->setShortcut(tr("F3")); m_editWidgetsAction->setIcon(QIcon(m_core->resourceLocation() + QLatin1String("/widgettool.png"))); connect(formWindowManager, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*))); connect(m_editWidgetsAction, SIGNAL(triggered()), this, SLOT(editWidgetsSlot())); m_toolActions->addAction(m_editWidgetsAction); m_editWidgetsAction->setChecked(true); m_editWidgetsAction->setEnabled(false); QList<QObject*> builtinPlugins = QPluginLoader::staticInstances(); builtinPlugins += m_core->pluginManager()->instances(); foreach (QObject *plugin, builtinPlugins) { if (QDesignerFormEditorPluginInterface *formEditorPlugin = qobject_cast<QDesignerFormEditorPluginInterface*>(plugin)) { m_toolActions->addAction(formEditorPlugin->action()); formEditorPlugin->action()->setCheckable(true); } } m_uiMode = new QActionGroup(this); m_uiMode->setExclusive(true); m_sdiAction = m_uiMode->addAction(tr("Multiple Top-Level Windows")); m_sdiAction->setCheckable(true); m_dockedMdiAction = m_uiMode->addAction(tr("Docked Window")); m_dockedMdiAction->setCheckable(true); switch (settings.uiMode()) { default: Q_ASSERT(0); break; case QDesignerWorkbench::TopLevelMode: m_sdiAction->setChecked(true); break; case QDesignerWorkbench::DockedMode: m_dockedMdiAction->setChecked(true); break; } connect(m_uiMode, SIGNAL(triggered(QAction*)), this, SLOT(updateUIMode(QAction*))); // // form actions // m_layoutHorizontallyAction = formWindowManager->actionHorizontalLayout(); m_formActions->addAction(m_layoutHorizontallyAction); m_layoutVerticallyAction = formWindowManager->actionVerticalLayout(); m_formActions->addAction(m_layoutVerticallyAction); m_layoutHorizontallyInSplitterAction = formWindowManager->actionSplitHorizontal(); m_formActions->addAction(m_layoutHorizontallyInSplitterAction); m_layoutVerticallyInSplitterAction = formWindowManager->actionSplitVertical(); m_formActions->addAction(m_layoutVerticallyInSplitterAction); m_layoutGridAction = formWindowManager->actionGridLayout(); m_formActions->addAction(m_layoutGridAction); m_breakLayoutAction = formWindowManager->actionBreakLayout(); m_formActions->addAction(m_breakLayoutAction); m_adjustSizeAction = formWindowManager->actionAdjustSize(); m_formActions->addAction(m_adjustSizeAction); sep = new QAction(this); sep->setSeparator(true); m_formActions->addAction(sep); m_previewFormAction = new QAction(tr("&Preview"), this); m_previewFormAction->setShortcut(tr("CTRL+R")); connect(m_previewFormAction, SIGNAL(triggered()), this, SLOT(previewFormLater())); m_formActions->addAction(m_previewFormAction); m_styleActions = new QActionGroup(this); m_styleActions->setExclusive(true); connect(m_styleActions, SIGNAL(triggered(QAction*)), this, SLOT(previewForm(QAction*))); QAction *sep2 = new QAction(this); sep2->setSeparator(true); m_formActions->addAction(sep2); m_formSettings = new QAction(tr("Form &Settings..."), this); m_formSettings->setEnabled(false); connect(m_formSettings, SIGNAL(triggered()), this, SLOT(showFormSettings())); m_formActions->addAction(m_formSettings); QStringList availableStyleList = QStyleFactory::keys(); foreach (QString style, availableStyleList) { QAction *a = new QAction(this); a->setText(tr("%1 Style").arg(style)); a->setObjectName(QLatin1String("__qt_action_style_") + style); m_styleActions->addAction(a); }
// Is this node of a type that is influenced by transforms? void MainWindow:: switchProjectType( ProjectProperties::ProjectTypes newType) { projectSettings.projectType = newType; switch (newType) { case ProjectProperties::noneProject: // File menu actionSaveLandmarks->setVisible(false); actionExportWarpedObject->setVisible(false); menuExport->menuAction()->setVisible(false); actionProjectProperties->setVisible(false); actionSeparator->setVisible(false); actionCloseProject->setVisible(false); actionLoadLandmarks->setVisible(false); actionOpenProject->setVisible(true); actionSaveProject->setVisible(false); actionSaveProjectAs->setVisible(false); // Export menu actionExportWarpTransform->setVisible(false); actionExportWarpedObject->setVisible(false); actionSaveLandmarks->setVisible(false); actionExportMesh->setVisible(false); // Edit menu actionGenerateMesh->setVisible(false); // Actions menu actionMove_vetex->setVisible(false); actionAdd_vertex->setVisible(false); actionDelete_vertex->setVisible(false); actionAdd_element->setVisible(false); actionDelete_element->setVisible(false); actionCut_mesh->setVisible(false); actionAddLandmark->setVisible(false); actionDeleteLandmark->setVisible(false); actionMoveLandmark->setVisible(false); actionShowLandmarks->setVisible(false); actionUpdate->setVisible(false); // View menu actionSourceView->setVisible(false); actionTargetView->setVisible(false); actionResultView->setVisible(false); actionSectionView->setVisible(false); menuToolbars->setVisible(false); //Settings menu actionAutoWarp->setVisible(true); actionShowMesh->setVisible(false); // Memu bar menubar->clear(); menubar->addAction(menuFile->menuAction()); menubar->addAction(menuHelp->menuAction()); break; case ProjectProperties::mesheditProject: // File menu actionOpenProject->setVisible(false); actionSaveLandmarks->setVisible(false); actionExportWarpedObject->setVisible(false); menuExport->menuAction()->setVisible(false); actionProjectProperties->setVisible(true); actionSeparator->setVisible(true); actionSeparator->setSeparator(true); actionCloseProject->setVisible(true); actionLoadLandmarks->setVisible(false); actionSaveProject->setVisible(true); actionSaveProjectAs->setVisible(true); // Export menu actionExportWarpTransform->setVisible(false); actionExportWarpedObject->setVisible(false); actionSaveLandmarks->setVisible(false); actionExportMesh->setVisible(true); // Edit menu actionGenerateMesh->setVisible(true); // Actions menu actionMove_vetex->setVisible(true); actionAdd_vertex->setVisible(true); actionDelete_vertex->setVisible(true); actionAdd_element->setVisible(true); actionDelete_element->setVisible(true); actionCut_mesh->setVisible(true); actionAddLandmark->setVisible(false); actionDeleteLandmark->setVisible(false); actionMoveLandmark->setVisible(false); actionShowLandmarks->setVisible(false); actionUpdate->setVisible(false); // View menu actionSourceView->setVisible(false); actionTargetView->setVisible(false); actionResultView->setVisible(false); actionSectionView->setVisible(false); //Settings menu actionAutoWarp->setVisible(true); actionShowMesh->setVisible(false); // Memu bar menubar->clear(); menuActions->setVisible(false); menubar->addAction(menuFile->menuAction()); menubar->addAction(menuEdit->menuAction()); menubar->addAction(menuActions->menuAction()); menubar->addAction(menuView->menuAction()); menubar->addAction(menuWindow->menuAction()); menubar->addAction(menuHelp->menuAction()); break; case ProjectProperties::warpingProject: // File menu actionSaveLandmarks->setVisible(true); actionExportWarpedObject->setVisible(true); menuExport->menuAction()->setVisible(true); actionProjectProperties->setVisible(true); actionLoadLandmarks->setVisible(true); actionOpenProject->setVisible(false); actionSeparator->setVisible(true); actionSeparator->setSeparator(true); actionCloseProject->setVisible(true); actionSaveProject->setVisible(true); actionSaveProjectAs->setVisible(true); // Export menu actionExportWarpTransform->setVisible(true); actionExportWarpedObject->setVisible(true); actionSaveLandmarks->setVisible(true); actionExportMesh->setVisible(false); // Edit menu actionGenerateMesh->setVisible(true); // Actions menu actionMove_vetex->setVisible(false); actionAdd_vertex->setVisible(false); actionDelete_vertex->setVisible(false); actionAdd_element->setVisible(false); actionDelete_element->setVisible(false); actionCut_mesh->setVisible(false); actionAddLandmark->setVisible(true); actionDeleteLandmark->setVisible(true); actionMoveLandmark->setVisible(true); actionShowLandmarks->setVisible(true); actionUpdate->setVisible(true); // View menu actionSourceView->setVisible(true); actionTargetView->setVisible(true); actionResultView->setVisible(true); actionSectionView->setVisible(false); //Settings menu actionAutoWarp->setVisible(true); actionShowMesh->setVisible(true); // Memu bar menubar->clear(); menuActions->setVisible(false); menubar->addAction(menuFile->menuAction()); menubar->addAction(menuEdit->menuAction()); menubar->addAction(menuActions->menuAction()); menubar->addAction(menuView->menuAction()); menubar->addAction(menuWindow->menuAction()); menubar->addAction(menuHelp->menuAction()); break; default: Q_ASSERT(FALSE); break; } updateRecentFileActions(); }
// creates all menus void WMain::createMenus() { fileMenu=new QMenu(this); wordMenu=new QMenu(this); testMenu=new QMenu(this); helpMenu=new QMenu(this); newAction=new QAction(tr("&New"), this); newAction->setShortcuts(QKeySequence::New); newAction->setStatusTip(tr("Create new dictionary")); openAction=new QAction(tr("&Open..."), this); openAction->setShortcuts(QKeySequence::Open); openAction->setStatusTip(tr("Open dictionary")); saveAction=new QAction(tr("&Save"), this); saveAction->setShortcuts(QKeySequence::Save); saveAction->setStatusTip(tr("Save dictionary")); saveasAction=new QAction(tr("&Save as..."), this); saveasAction->setShortcuts(QKeySequence::SaveAs); saveasAction->setStatusTip(tr("Save dictionary as")); printAction=new QAction(tr("&Print"), this); printAction->setShortcuts(QKeySequence::Print); printAction->setStatusTip(tr("Print dictionary")); settingsAction=new QAction(tr("&Settings"), this); settingsAction->setShortcut(QKeySequence("Ctrl+B")); settingsAction->setStatusTip(tr("Settings")); quitAction=new QAction(tr("&Quit"), this); quitAction->setShortcut(QKeySequence("Ctrl+Q")); quitAction->setStatusTip(tr("Quit dicto")); addAction=new QAction(tr("&Add..."), this); addAction->setShortcut(Qt::Key_Insert); addAction->setStatusTip(tr("Add new word")); editAction=new QAction(tr("&Edit..."), this); editAction->setStatusTip(tr("Edit current word")); deleteAction=new QAction(tr("&Delete"), this); deleteAction->setShortcut(Qt::Key_Delete); deleteAction->setStatusTip(tr("Delete current word")); sortAction=new QAction(tr("&Sort"), this); sortAction->setShortcut(QKeySequence("Ctrl+A")); sortAction->setStatusTip(tr("Sort dictionary")); testAction=new QAction(tr("&Test..."), this); testAction->setShortcut(QKeySequence("Ctrl+T")); testAction->setStatusTip(tr("Prepare test")); examAction=new QAction(tr("&Exam..."), this); examAction->setShortcut(QKeySequence("Ctrl+E")); examAction->setStatusTip(tr("Prepare exam")); statsAction=new QAction(tr("&Statistics..."), this); statsAction->setShortcut(QKeySequence("Ctrl+W")); statsAction->setStatusTip(tr("Show statistics")); aboutAction=new QAction(tr("&About"), this); aboutAction->setStatusTip(tr("About dicto")); fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(newAction); fileMenu->addAction(openAction); fileMenu->addAction(saveAction); fileMenu->addAction(saveasAction); fileMenu->addAction(printAction); fileMenu->addSeparator(); for (int i = 0; i < 10/*maxRecentFiles*/; ++i) { recentFilesActions[i] = new QAction(this); recentFilesActions[i]->setVisible(false); fileMenu->addAction(recentFilesActions[i]); connect(recentFilesActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile())); } updateRecentFileActions(); fileMenu->addSeparator(); fileMenu->addAction(settingsAction); fileMenu->addSeparator(); fileMenu->addAction(quitAction); wordMenu = menuBar()->addMenu(tr("&Words")); wordMenu->addAction(addAction); wordMenu->addAction(editAction); wordMenu->addAction(deleteAction); wordMenu->addSeparator(); wordMenu->addAction(sortAction); testMenu = menuBar()->addMenu(tr("&Test")); testMenu->addAction(testAction); testMenu->addAction(examAction); testMenu->addSeparator(); testMenu->addAction(statsAction); helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(aboutAction); connect(newAction, SIGNAL(triggered()), this, SLOT(newfile())); connect(openAction, SIGNAL(triggered()), this, SLOT(openfile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(savefile())); connect(saveasAction, SIGNAL(triggered()), this, SLOT(saveas())); connect(printAction, SIGNAL(triggered()), this, SLOT(print())); connect(settingsAction, SIGNAL(triggered()), this, SLOT(show_settings())); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(addAction, SIGNAL(triggered()), this, SLOT(addentry())); connect(editAction, SIGNAL(triggered()), this, SLOT(editentry())); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteentry())); connect(sortAction, SIGNAL(triggered()), this, SLOT(sortall())); connect(testAction, SIGNAL(triggered()), this, SLOT(preparetest())); connect(examAction, SIGNAL(triggered()), this, SLOT(prepareexam())); connect(statsAction, SIGNAL(triggered()), this, SLOT(stats())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); }
MainWindow:: MainWindow(): controler(NULL), separatorAct(NULL) { SoQt::init(this); SoVolumeRendering::init(); for(int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = NULL; } SnapSurfaceManip::initClass(); TranslateRadialManip::initClass(); CrossHairManip::initClass(); setupUi(this); // this sets up GUI switchProjectType(ProjectProperties::noneProject); setCentralWidget(mdiArea); showMaximized(); /* * If all SoQt windows are closed, then probably SoQt frees up some * local areas. This causes a segmentation fault after a new SoQt * viewer is opened. To avoid this problem, here a new examiner viewer * is created that is not freed during the whole lifespan of the * application, until the application is closed. */ new SoQtExaminerViewer; //Menu global menu signals connect(actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(actionCloseProject, SIGNAL(triggered()), this, SLOT(closeProject())); connect(actionExit, SIGNAL(triggered()), this, SLOT(close())); setDefaultConnections(); //set up toolbars in menus menuToolbars->addAction(toolBarWarpingMode->toggleViewAction()); menuToolbars->addAction(toolBarGeneral->toggleViewAction()); menuToolbars->addAction(toolBarModes->toggleViewAction()); menuToolbars->addAction(toolBarOperations->toggleViewAction()); toolBarModes->setVisible(true); toolBarModes->setVisible(false); toolBarWarpingMode->setVisible(false); toolBarOperations->setVisible(false); menuFile->removeAction(menuOpen_project->menuAction()); statusbar->showMessage("Application started", 5000); for(int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } for(int i = 0; i < MaxRecentFiles; ++i) { menuFile->insertAction(actionExit,recentFileActs[i]); } separatorAct = menuFile->insertSeparator(actionExit); updateRecentFileActions(); }
MainWindow::MainWindow(Application *app) : QMainWindow(), m_application(app) { app->setMainWindow(this); setUnifiedTitleAndToolBarOnMac(true); setDocumentMode(true); QCoreApplication::setOrganizationName("Dunnart"); QCoreApplication::setOrganizationDomain("dunnart.org"); QCoreApplication::setApplicationName("Dunnart"); // Correct the look of the tab bar on OS X cocoa. app->setStyleSheet( "QGraphicsView {" "border: 0px;" "}" #ifdef Q_WS_MAC "QTabBar::tab:top {" "font-family: \"Lucida Grande\";" "font-size: 11px;" "}" #endif ); // Set the window title. setWindowTitle("Dunnart"); m_tab_widget = new CanvasTabWidget(this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), this, SLOT(canvasChanged(Canvas*))); connect(m_tab_widget, SIGNAL(currentCanvasFileInfoChanged(QFileInfo)), this, SLOT(canvasFileInfoChanged(QFileInfo))); m_tab_widget->newTab(); setCentralWidget(m_tab_widget); app->setCanvasTabWidget(m_tab_widget); // Inital window size. resize(1020, 743); m_new_action = new QAction("New", this); m_new_action->setShortcut(QKeySequence::New); connect(m_new_action, SIGNAL(triggered()), this, SLOT(documentNew())); m_open_action = new QAction("Open...", this); m_open_action->setShortcut(QKeySequence::Open); connect(m_open_action, SIGNAL(triggered()), this, SLOT(documentOpen())); for (int i = 0; i < MAX_RECENT_FILES; ++i) { m_action_open_recent_file[i] = new QAction(this); m_action_open_recent_file[i]->setVisible(false); connect(m_action_open_recent_file[i], SIGNAL(triggered()), this, SLOT(documentOpenRecent())); } m_close_action = new QAction("Close", this); m_close_action->setShortcut(QKeySequence::Close); connect(m_close_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasClose())); m_save_action = new QAction("Save", this); m_save_action->setShortcut(QKeySequence::Save); connect(m_save_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasSave())); m_save_as_action = new QAction("Save As...", this); m_save_as_action->setShortcut(QKeySequence::SaveAs); connect(m_save_as_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasSaveAs())); m_export_action = new QAction("Export...", this); connect(m_export_action, SIGNAL(triggered()), this, SLOT(documentExport())); m_print_action = new QAction("Print...", this); m_print_action->setShortcut(QKeySequence::Print); connect(m_print_action, SIGNAL(triggered()), this, SLOT(documentPrint())); m_quit_action = new QAction(tr("Quit"), this); m_quit_action->setShortcut(QKeySequence::Quit); connect(m_quit_action, SIGNAL(triggered()), this, SLOT(close())); m_about_action = new QAction(tr("About"), this); connect(m_about_action, SIGNAL(triggered()), this, SLOT(about())); m_homepage_action = new QAction(tr("Dunnart homepage"), this); connect(m_homepage_action, SIGNAL(triggered()), this, SLOT(openHomepage())); m_action_show_zoom_level_dialog = new QAction( tr("Zoom Level"), this); m_action_show_zoom_level_dialog->setCheckable(true); m_action_show_properties_editor_dialog = new QAction( tr("Properties Editor"), this); m_action_show_properties_editor_dialog->setCheckable(true); m_action_show_layout_properties_dialog = new QAction( tr("Layout Properties"), this); m_action_show_layout_properties_dialog->setCheckable(true); m_action_show_connector_properties_dialog = new QAction( tr("Connector Properties"), this); m_action_show_connector_properties_dialog->setCheckable(true); m_action_show_create_alignment_dialog = new QAction( tr("Create Alignments"), this); m_action_show_create_alignment_dialog->setCheckable(true); m_action_show_create_distribution_dialog = new QAction( tr("Create Distributions"), this); m_action_show_create_distribution_dialog->setCheckable(true); m_action_show_create_separation_dialog = new QAction( tr("Create Separations"), this); m_action_show_create_separation_dialog->setCheckable(true); m_action_show_create_template_dialog = new QAction( tr("Create Templates"), this); m_action_show_create_template_dialog->setShortcut(tr("Ctrl+T")); m_action_show_create_template_dialog->setCheckable(true); m_action_show_shape_picker_dialog = new QAction( tr("Shape Picker"), this); m_action_show_shape_picker_dialog->setCheckable(true); m_action_clear_recent_files = new QAction(tr("Clear Menu"), this); connect(m_action_clear_recent_files, SIGNAL(triggered()), this, SLOT(clearRecentFileMenu())); m_action_show_undo_history_dialog = new QAction( tr("Undo History"), this); m_action_show_undo_history_dialog->setCheckable(true); m_action_show_canvas_overview_dialog = new QAction( tr("Canvas Overview"), this); m_action_show_canvas_overview_dialog->setCheckable(true); CanvasView *canvasview = m_tab_widget->currentCanvasView(); Canvas *canvas = m_tab_widget->currentCanvas(); m_action_auto_align_selection = new QAction(tr("Auto-align Selection"), this); connect(m_action_auto_align_selection, SIGNAL(triggered()), m_tab_widget, SLOT(alignSelection())); // Create statusBar, and assign it to the canvas. canvas->setStatusBar(statusBar()); #ifdef Q_WS_MAC // Make the status bar font size slightly smaller. QFont statusBarFont = statusBar()->font(); statusBarFont.setPointSize(statusBarFont.pointSize() - 2); statusBar()->setFont(statusBarFont); #endif m_file_menu = menuBar()->addMenu("File"); m_file_menu->addAction(m_new_action); m_file_menu->addAction(m_open_action); QMenu *recentsMenu = m_file_menu->addMenu(tr("Open Recent")); for (int i = 0; i < MAX_RECENT_FILES; ++i) { recentsMenu->addAction(m_action_open_recent_file[i]); } m_action_recent_file_separator = recentsMenu->addSeparator(); recentsMenu->addAction(m_action_clear_recent_files); updateRecentFileActions(); m_file_menu->addSeparator(); m_file_menu->addAction(m_close_action); m_file_menu->addAction(m_save_action); m_file_menu->addAction(m_save_as_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_export_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_print_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_quit_action); m_edit_menu = menuBar()->addMenu(tr("Edit")); m_tab_widget->addEditMenuActions(m_edit_menu); m_view_menu = menuBar()->addMenu(tr("View")); QMenu *dialogs_menu = m_view_menu->addMenu(tr("Show Dialogs")); dialogs_menu->addAction(m_action_show_canvas_overview_dialog); dialogs_menu->addAction(m_action_show_zoom_level_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_shape_picker_dialog); dialogs_menu->addAction(m_action_show_undo_history_dialog); dialogs_menu->addAction(m_action_show_properties_editor_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_create_alignment_dialog); dialogs_menu->addAction(m_action_show_create_distribution_dialog); dialogs_menu->addAction(m_action_show_create_separation_dialog); dialogs_menu->addAction(m_action_show_create_template_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_layout_properties_dialog); dialogs_menu->addAction(m_action_show_connector_properties_dialog); QMenu *overlays_menu = m_view_menu->addMenu(tr("Canvas Debug Layers")); m_tab_widget->addDebugOverlayMenuActions(overlays_menu); m_layout_menu = menuBar()->addMenu("Layout"); m_tab_widget->addLayoutMenuActions(m_layout_menu); m_layout_menu->addAction(m_action_auto_align_selection); m_edit_toolbar = addToolBar(tr("Edit toolbar")); m_edit_toolbar->setIconSize(QSize(24, 24)); m_edit_toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tab_widget->addEditToolBarActions(m_edit_toolbar); m_dialog_zoomLevel = new ZoomLevel(canvasview); connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)), m_dialog_zoomLevel, SLOT(changeCanvasView(CanvasView*))); connect(m_action_show_zoom_level_dialog, SIGNAL(triggered(bool)), m_dialog_zoomLevel, SLOT(setVisible(bool))); connect(m_dialog_zoomLevel, SIGNAL(visibilityChanged(bool)), m_action_show_zoom_level_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_zoomLevel); m_dialog_zoomLevel->show(); m_dialog_properties_editor = new PropertiesEditorDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_properties_editor, SLOT(changeCanvas(Canvas*))); connect(m_action_show_properties_editor_dialog, SIGNAL(triggered(bool)), m_dialog_properties_editor, SLOT(setVisible(bool))); connect(m_dialog_properties_editor, SIGNAL(visibilityChanged(bool)), m_action_show_properties_editor_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::BottomDockWidgetArea, m_dialog_properties_editor); m_dialog_properties_editor->hide(); m_dialog_shape_picker = new ShapePickerDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_shape_picker, SLOT(changeCanvas(Canvas*))); connect(m_action_show_shape_picker_dialog, SIGNAL(triggered(bool)), m_dialog_shape_picker, SLOT(setVisible(bool))); connect(m_dialog_shape_picker, SIGNAL(visibilityChanged(bool)), m_action_show_shape_picker_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_shape_picker); m_dialog_shape_picker->show(); m_dialog_layoutProps = new LayoutPropertiesDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_layoutProps, SLOT(changeCanvas(Canvas*))); connect(m_action_show_layout_properties_dialog, SIGNAL(triggered(bool)), m_dialog_layoutProps, SLOT(setVisible(bool))); connect(m_dialog_layoutProps, SIGNAL(visibilityChanged(bool)), m_action_show_layout_properties_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_layoutProps); m_dialog_layoutProps->show(); m_dialog_connectorProps = new ConnectorPropertiesDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_connectorProps, SLOT(changeCanvas(Canvas*))); connect(m_action_show_connector_properties_dialog, SIGNAL(triggered(bool)), m_dialog_connectorProps, SLOT(setVisible(bool))); connect(m_dialog_connectorProps, SIGNAL(visibilityChanged(bool)), m_action_show_connector_properties_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_connectorProps); m_dialog_connectorProps->hide(); m_dialog_alignment = new CreateAlignmentDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_alignment, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_alignment_dialog, SIGNAL(triggered(bool)), m_dialog_alignment, SLOT(setVisible(bool))); connect(m_dialog_alignment, SIGNAL(visibilityChanged(bool)), m_action_show_create_alignment_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_alignment); m_dialog_alignment->show(); m_dialog_distribution = new CreateDistributionDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_distribution, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_distribution_dialog, SIGNAL(triggered(bool)), m_dialog_distribution, SLOT(setVisible(bool))); connect(m_dialog_distribution, SIGNAL(visibilityChanged(bool)), m_action_show_create_distribution_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_distribution); m_dialog_distribution->show(); m_dialog_separation = new CreateSeparationDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_separation, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_separation_dialog, SIGNAL(triggered(bool)), m_dialog_separation, SLOT(setVisible(bool))); connect(m_dialog_separation, SIGNAL(visibilityChanged(bool)), m_action_show_create_separation_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_separation); m_dialog_separation->show(); m_dialog_template = new CreateTemplateDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_template, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_template_dialog, SIGNAL(triggered(bool)), m_dialog_template, SLOT(setVisible(bool))); connect(m_dialog_template, SIGNAL(visibilityChanged(bool)), m_action_show_create_template_dialog, SLOT(setChecked(bool))); m_dialog_template->hide(); m_dialog_undo_history = new UndoHistoryDialog( m_tab_widget->undoGroup(), this); connect(m_action_show_undo_history_dialog, SIGNAL(triggered(bool)), m_dialog_undo_history, SLOT(setVisible(bool))); connect(m_dialog_undo_history, SIGNAL(visibilityChanged(bool)), m_action_show_undo_history_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_undo_history); m_dialog_undo_history->hide(); m_dialog_canvas_overview = new CanvasOverviewDialog(canvasview, this); connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)), m_dialog_canvas_overview, SLOT(changeCanvasView(CanvasView*))); connect(m_action_show_canvas_overview_dialog, SIGNAL(triggered(bool)), m_dialog_canvas_overview, SLOT(setVisible(bool))); connect(m_dialog_canvas_overview, SIGNAL(visibilityChanged(bool)), m_action_show_canvas_overview_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_canvas_overview); m_dialog_canvas_overview->hide(); // Allow plugins to initialise themselves and add things like // menu items and dock widgets to the main window. PluginApplicationManager *appPluginManager = sharedPluginApplicationManager(); appPluginManager->applicationMainWindowInitialised(app); // Add help menu after everything else (if should be rightmost). m_help_menu = menuBar()->addMenu(tr("Help")); m_help_menu->addAction(m_homepage_action); m_help_menu->addSeparator(); m_help_menu->addAction(m_about_action); // Restore window geometry and Dock Widget geometry. QSettings settings; restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); }
/* ///////////////////////////////////////////////////////////////////////////// * Application main window constructor */ TTCutMainWindow::TTCutMainWindow() : QMainWindow() { // setup Qt Designer UI setupUi( this ); // images // -------------------------------------------------------------------------- TTCut::imgDownArrow = new QPixmap( downarrow_18_xpm ); TTCut::imgUpArrow = new QPixmap( uparrow_18_xpm ); TTCut::imgDelete = new QPixmap( cancel_18_xpm ); TTCut::imgFileOpen24 = new QPixmap( fileopen_24_xpm ); TTCut::imgFileNew = new QPixmap( filenew_16_xpm ); TTCut::imgFileOpen = new QPixmap( fileopen_16_xpm ); TTCut::imgFileSave = new QPixmap( filesave_16_xpm );; TTCut::imgFileSaveAs = new QPixmap( filesaveas_16_xpm ); TTCut::imgSaveImage = new QPixmap( saveimage_16_xpm ); TTCut::imgSettings = new QPixmap( settings_16_xpm ); TTCut::imgSettings18 = new QPixmap( settings_18_xpm ); TTCut::imgExit = new QPixmap( exit_16_xpm ); TTCut::imgPlay = new QPixmap( play_18_xpm ); TTCut::imgStop = new QPixmap( stop_18_xpm ); TTCut::imgSearch = new QPixmap( search_18_xpm ); TTCut::imgChapter = new QPixmap( chapter_18_xpm ); TTCut::imgPreview = new QPixmap( preview_18_xpm ); TTCut::imgCutAV = new QPixmap( cutav_18_xpm ); TTCut::imgCutAudio = new QPixmap( cutaudio_18_xpm ); TTCut::imgGoTo = new QPixmap( goto_18_xpm ); TTCut::imgMarker = new QPixmap( note_18_xpm ); TTCut::imgClock = new QPixmap( clock_16_xpm ); TTCut::imgApply = new QPixmap( apply_18_xpm ); TTCut::imgAddToList = new QPixmap( addtolist_18_xpm ); TTCut::imgFileClose = new QPixmap( fileclose_18_xpm ); setFocusPolicy(Qt::StrongFocus); // Message logger instance log = TTMessageLogger::getInstance(); // Get the current Qt version at runtime log->infoMsg(oName, "TTCut-Version: %s", qPrintable(TTCut::versionString)); log->infoMsg(oName, "Qt-Version: %s", qVersion()); #if QT_VERSION < 0x040100 // TODO: Show message box and abort session log->errorMsg(oName, "Qt-Version >= 4.1.0 required"); #endif // Settings TTCut::recentFileList.clear(); settings = new TTCutSettings(); settings->readSettings(); log->enableLogFile(TTCut::createLogFile); log->setLogModeConsole(TTCut::logModeConsole); log->setLogModeExtended(TTCut::logModeExtended); // Audio list audioList = new TTAudioListData(); audioFileInfo->setListData(audioList); // Mux list and mplex provider (later by plugin) muxListData = new TTMuxListData(); mplexProvider = new TTMplexProvider(); // no navigation navigationEnabled( false ); // init cutListData = NULL; mpegStream = NULL; TTCut::isVideoOpen = false; TTCut::projectFileName = ""; // Signal and slot connections // // Connect signals from main menu // -------------------------------------------------------------------------- connect(actionOpenVideo, SIGNAL(triggered()), videoFileInfo, SLOT(onFileOpen())); connect(actionOpenAudio, SIGNAL(triggered()), audioFileInfo, SLOT(onFileOpen())); connect(actionFileNew, SIGNAL(triggered()), SLOT(onFileNew())); connect(actionFileOpen, SIGNAL(triggered()), SLOT(onFileOpen())); connect(actionFileSave, SIGNAL(triggered()), SLOT(onFileSave())); connect(actionFileSaveAs, SIGNAL(triggered()), SLOT(onFileSaveAs())); connect(actionExit, SIGNAL(triggered()), SLOT(onFileExit())); connect(actionSaveCurrentFrame, SIGNAL(triggered()), SLOT(onActionSave())); connect(actionSettings, SIGNAL(triggered()), SLOT(onActionSettings())); connect(actionAbout, SIGNAL(triggered()), SLOT(onHelpAbout())); // recent files for (int i = 0; i < MaxRecentFiles; ++i) { recentFileAction[i] = new QAction(this); recentFileAction[i]->setVisible(false); menuRecentProjects->addAction(recentFileAction[i]); connect(recentFileAction[i], SIGNAL(triggered()), SLOT(onFileRecent())); } updateRecentFileActions(); // Connect signals from video and audio info // -------------------------------------------------------------------------- connect(videoFileInfo, SIGNAL(fileOpened(QString)), SLOT(onReadVideoStream(QString))); connect(audioFileInfo, SIGNAL(fileOpened(QString)), SLOT(onReadAudioStream(QString))); // Connect signals from navigation widget // -------------------------------------------------------------------------- connect(navigation, SIGNAL(prevIFrame()), currentFrame, SLOT(onPrevIFrame())); connect(navigation, SIGNAL(nextIFrame()), currentFrame, SLOT(onNextIFrame())); connect(navigation, SIGNAL(prevPFrame()), currentFrame, SLOT(onPrevPFrame())); connect(navigation, SIGNAL(nextPFrame()), currentFrame, SLOT(onNextPFrame())); connect(navigation, SIGNAL(prevBFrame()), currentFrame, SLOT(onPrevBFrame())); connect(navigation, SIGNAL(nextBFrame()), currentFrame, SLOT(onNextBFrame())); connect(navigation, SIGNAL(setCutOut(int)), currentFrame, SLOT(onSetCutOut(int))); connect(navigation, SIGNAL(setCutOut(int)), cutOutFrame, SLOT(onGotoCutOut(int))); connect(navigation, SIGNAL(setCutIn(int)), currentFrame, SLOT(onSetCutIn(int))); connect(navigation, SIGNAL(gotoCutIn(int)), currentFrame, SLOT(onGotoCutIn(int))); connect(navigation, SIGNAL(gotoCutOut(int)), currentFrame, SLOT(onGotoCutOut(int))); connect(navigation, SIGNAL(addCutRange(int, int)), cutList, SLOT(onAddEntry(int, int))); connect(navigation, SIGNAL(gotoMarker(int)), currentFrame, SLOT(onGotoMarker(int))); connect(navigation, SIGNAL(moveNumSteps(int)), currentFrame, SLOT(onMoveNumSteps(int))); connect(navigation, SIGNAL(moveToHome()), currentFrame, SLOT(onMoveToHome())); connect(navigation, SIGNAL(moveToEnd()), currentFrame, SLOT(onMoveToEnd())); // Connect signal from video slider // -------------------------------------------------------------------------- connect(streamNavigator, SIGNAL(sliderValueChanged(int)), SLOT(onVideoSliderChanged(int))); // Connect signals from cut-out frame widget // -------------------------------------------------------------------------- connect(cutOutFrame, SIGNAL(equalFrameFound(int)), currentFrame, SLOT(onGotoFrame(int))); connect(cutOutFrame, SIGNAL(newCutOutFramePos(int)), cutList, SLOT(onEditCutOut(int))); // Connect signals from current frame widget // -------------------------------------------------------------------------- connect(currentFrame, SIGNAL(newFramePosition(int)), SLOT(onNewFramePos(int))); // Connect signals from cut list widget // -------------------------------------------------------------------------- connect(cutList, SIGNAL(entrySelected(int)), cutOutFrame, SLOT(onGotoCutOut(int))); connect(cutList, SIGNAL(entryEdit(const TTCutListDataItem&)), navigation, SLOT(onEditCut(const TTCutListDataItem&))); connect(cutList, SIGNAL(gotoCutIn(int)), currentFrame, SLOT(onGotoFrame(int))); connect(cutList, SIGNAL(gotoCutOut(int)), currentFrame, SLOT(onGotoFrame(int))); connect(cutList, SIGNAL(refreshDisplay()), streamNavigator, SLOT(onRefreshDisplay())); connect(cutList, SIGNAL(previewCut(int)), SLOT(onPreviewCut(int))); connect(cutList, SIGNAL(audioVideoCut(int)), SLOT(onAudioVideoCut(int))); connect(cutList, SIGNAL(audioCut(int)), SLOT(onAudioCut(int))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle(QCoreApplication::applicationName()); ui.setupUi(this); // setup preferences dialog connect(&preferences, SIGNAL(accepted()), this, SLOT(getApplicationSettings())); connect(&builder, SIGNAL(highlightLine(const QString &, int, int, const QString &)), this, SLOT(highlightFileLine(const QString &, int, int))); connect(&builder, SIGNAL(finished()), this, SLOT(setBuildAvailable())); connect(&builder, SIGNAL(buildError()), &preferences, SLOT(showPreferences())); parser = language.parser(); connect(&preferences, SIGNAL(updateColors()), this, SLOT(recolorProjectView())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), this, SLOT(recolorProjectView())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), this, SLOT(recolorBuildManager())); connect(&preferences, SIGNAL(accepted()), ui.editorTabs, SIGNAL(accepted())); connect(&preferences, SIGNAL(updateColors()), ui.editorTabs, SIGNAL(updateColors())); connect(&preferences, SIGNAL(updateFonts(const QFont &)), ui.editorTabs, SIGNAL(updateFonts(const QFont &))); recolorProjectView(); recolorBuildManager(); // project editor tabs ui.finder->connectFileManager(ui.editorTabs); QSplitterHandle *hndl = ui.splitter->handle(1); hndl->setEnabled(false); connect(ui.editorTabs, SIGNAL(fileUpdated(int)), this, SLOT(setProject())); // File Menu connect(ui.action_New, SIGNAL(triggered()), ui.editorTabs, SLOT(newFile())); connect(ui.actionNew_From_File, SIGNAL(triggered()), ui.editorTabs, SLOT(newFromFile())); connect(ui.actionNew_From_Template, SIGNAL(triggered()), this, SLOT(newFromTemplate())); connect(ui.action_Open, SIGNAL(triggered()), ui.editorTabs, SLOT(open())); connect(ui.action_Save,SIGNAL(triggered()),ui.editorTabs,SLOT(save())); connect(ui.actionSave_As,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAs())); connect(ui.actionSave_All,SIGNAL(triggered()),ui.editorTabs,SLOT(saveAll())); ui.actionPrint->setEnabled(true); connect(ui.actionPrint,SIGNAL(triggered()),this,SLOT(printFile())); ui.action_Zip->setEnabled(true); connect(ui.action_Zip,SIGNAL(triggered()),this,SLOT(zipFiles())); recentFiles = findChildren<QAction *>(QRegExp("action_[0-9]+_File")); for (int i = 0; i < recentFiles.size(); i++) connect(recentFiles.at(i), SIGNAL(triggered()),this, SLOT(openRecentFile())); connect(ui.action_Close, SIGNAL(triggered()), ui.editorTabs, SLOT(closeFile())); connect(ui.actionClose_All, SIGNAL(triggered()), ui.editorTabs, SLOT(closeAll())); connect(ui.action_Quit, SIGNAL(triggered()), this, SLOT(quitProgram())); connect(ui.editorTabs, SIGNAL(saveAvailable(bool)), this, SLOT(setSaveAvailable(bool))); connect(ui.editorTabs, SIGNAL(saveAvailable(bool)), this, SLOT(setSaveAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setCloseAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setCloseAvailable(bool))); connect(ui.editorTabs, SIGNAL(closeAvailable(bool)), this, SLOT(setBuildAvailable(bool))); // Edit Menu connect(ui.action_Undo, SIGNAL(triggered()), ui.editorTabs, SLOT(undo())); connect(ui.action_Redo, SIGNAL(triggered()), ui.editorTabs, SLOT(redo())); connect(ui.action_Cut, SIGNAL(triggered()), ui.editorTabs, SLOT(cut())); connect(ui.action_Copy, SIGNAL(triggered()), ui.editorTabs, SLOT(copy())); connect(ui.action_Paste, SIGNAL(triggered()), ui.editorTabs, SLOT(paste())); connect(ui.actionSelect_All, SIGNAL(triggered()), ui.editorTabs, SLOT(selectAll())); connect(ui.action_Find, SIGNAL(triggered()), ui.finder, SLOT(showFinder())); connect(ui.actionFind_Next, SIGNAL(triggered()), ui.finder, SLOT(findNext())); connect(ui.actionFind_Previous,SIGNAL(triggered()), ui.finder, SLOT(findPrevious())); connect(ui.actionPreferences, SIGNAL(triggered()), &preferences, SLOT(showPreferences())); connect(ui.editorTabs, SIGNAL(undoAvailable(bool)), ui.action_Undo,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(redoAvailable(bool)), ui.action_Redo,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Cut,SLOT(setEnabled(bool))); connect(ui.editorTabs, SIGNAL(copyAvailable(bool)), ui.action_Copy,SLOT(setEnabled(bool))); // View Menu connect(ui.actionShow_Browser, SIGNAL(triggered()), this, SLOT(showBrowser())); connect(ui.actionBigger_Font, SIGNAL(triggered()), this, SLOT(fontBigger())); connect(ui.actionSmaller_Font, SIGNAL(triggered()), this, SLOT(fontSmaller())); ui.actionBigger_Font->setShortcuts(QList<QKeySequence>() << QKeySequence::ZoomIn << Qt::CTRL+Qt::Key_Equal); // Project Menu connect(ui.actionMemory_Map,SIGNAL(triggered()), this, SLOT(spawnMemoryMap())); connect(ui.actionBuild, SIGNAL(triggered()), this, SLOT(programBuild())); connect(ui.actionRun, SIGNAL(triggered()), this, SLOT(programRun())); connect(ui.actionWrite, SIGNAL(triggered()), this, SLOT(programWrite())); connect(ui.actionTerminal, SIGNAL(triggered()), this, SLOT(spawnTerminal())); // Help Menu connect(ui.actionPropeller_Quick_Reference, SIGNAL(triggered()), this, SLOT(propellerQuickReference())); connect(ui.actionPropeller_Datasheet, SIGNAL(triggered()), this, SLOT(propellerDatasheet())); connect(ui.actionPropeller_Manual, SIGNAL(triggered()), this, SLOT(propellerManual())); connect(ui.actionPropBASIC_Manual, SIGNAL(triggered()), this, SLOT(propBasicManual())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); // Toolbar Extras cbPort = new QComboBox(this); cbPort->setLayoutDirection(Qt::LeftToRight); cbPort->setToolTip(tr("Select Serial Port")); cbPort->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.toolBar->addWidget(cbPort); connect(ui.projectview, SIGNAL(showFileLine(QString, int)), this, SLOT(highlightFileLine(QString, int))); updateRecentFileActions(); connect(ui.editorTabs, SIGNAL(sendMessage(const QString &)), this,SLOT(showMessage(const QString &))); connect(ui.finder, SIGNAL(sendMessage(const QString &)), this,SLOT(showMessage(const QString &))); restoreGeometry(QSettings().value("windowSize").toByteArray()); getApplicationSettings(); connect(&manager, SIGNAL(portListChanged()), this, SLOT(updatePorts())); manager.enablePortMonitor(true); updatePorts(); QSettings settings; QString lastport = settings.value("lastPort", QString()).toString(); if (!lastport.isEmpty()) { int index = cbPort->findText(lastport); if (index != -1) cbPort->setCurrentIndex(index); } ui.editorTabs->newFile(); loadSession(); installEventFilter(this); statusBar(); }