Editor::Editor( QWidget * parent , const char * name ) : QWidget( parent, name, WDestructiveClose ) { m = new QMenuBar( this, "menu" ); QPopupMenu * file = new QPopupMenu(); Q_CHECK_PTR( file ); m->insertItem( "&File", file ); file->insertItem( "&New", this, SLOT(newDoc()), ALT+Key_N ); file->insertItem( "&Open...", this, SLOT(load()), ALT+Key_O ); file->insertItem( "&Save...", this, SLOT(save()), ALT+Key_S ); file->insertSeparator(); open_as = new QPopupMenu(); file->insertItem( "Open &As", open_as ); save_as = new QPopupMenu(); file->insertItem( "Sa&ve As", save_as ); file->insertItem( "Add &Encoding", this, SLOT(addEncoding()) ); #ifndef QT_NO_PRINTER file->insertSeparator(); file->insertItem( "&Print...", this, SLOT(print()), ALT+Key_P ); #endif file->insertSeparator(); file->insertItem( "&Close", this, SLOT(close()),ALT+Key_W ); file->insertItem( "&Quit", qApp, SLOT(closeAllWindows()), ALT+Key_Q ); connect( save_as, SIGNAL(activated(int)), this, SLOT(saveAsEncoding(int)) ); connect( open_as, SIGNAL(activated(int)), this, SLOT(openAsEncoding(int)) ); rebuildCodecList(); QPopupMenu * edit = new QPopupMenu(); Q_CHECK_PTR( edit ); m->insertItem( "&Edit", edit ); edit->insertItem( "To &Uppercase", this, SLOT(toUpper()), ALT+Key_U ); edit->insertItem( "To &Lowercase", this, SLOT(toLower()), ALT+Key_L ); #ifndef QT_NO_FONTDIALOG edit->insertSeparator(); edit->insertItem( "&Select Font" , this, SLOT(font()), ALT+Key_T ); #endif changed = FALSE; e = new QMultiLineEdit( this, "editor" ); connect( e, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); // We use Unifont - if you have it installed you'll see all // Unicode character glyphs. // // Unifont only comes in one pixel size, so we cannot let // it change pixel size as the display DPI changes. // QFont unifont("unifont",16,50); unifont.setPixelSize(16); e->setFont( unifont ); e->setFocus(); }
void ApplicationWindow::setMenuBar(QMenuBar* bar) { #ifdef QTOPIA QMenu *menu = QSoftMenuBar::menuFor(this); #else QMenu *menu = m_owner->menuBar()->addMenu("&File"); #endif menu->addAction(tr("Rotate"), this, SLOT(rotate())); menu->addAction(tr("Fullscreen"), this, SLOT(showFullScreen())); menu->addAction(tr("Quit"), qApp, SLOT(closeAllWindows())); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setWindowIcon(QPixmap(":icons/icons/picture.png")); MainWindow w; w.show(); QObject::connect(&w, SIGNAL(exitApplication()), &a, SLOT(closeAllWindows())); return a.exec(); }
void EditorBase::InitActions() { mNewAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); mNewAct->setShortcut(tr("Ctrl+N")); mNewAct->setStatusTip(tr("Create a new file")); connect(mNewAct, SIGNAL(triggered()), this, SLOT(OnNew())); mOpenAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this); mOpenAct->setShortcut(tr("Ctrl+O")); mOpenAct->setStatusTip(tr("Open an existing file")); connect(mOpenAct, SIGNAL(triggered()), this, SLOT(OnOpen())); mSaveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this); mSaveAct->setShortcut(tr("Ctrl+S")); mSaveAct->setStatusTip(tr("Save the document to disk")); connect(mSaveAct, SIGNAL(triggered()), this, SLOT(OnSave())); mSaveAsAct = new QAction(tr("Save &As..."), this); mSaveAsAct->setStatusTip(tr("Save the document under a new name")); connect(mSaveAsAct, SIGNAL(triggered()), this, SLOT(OnSaveAs())); mExitAct = new QAction(tr("E&xit"), this); mExitAct->setShortcut(tr("Ctrl+Q")); mExitAct->setStatusTip(tr("Exit the application")); connect(mExitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); mCutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this); mCutAct->setShortcut(tr("Ctrl+X")); mCutAct->setStatusTip(tr("Cut the current selection's contents to the clipboard")); connect(mCutAct, SIGNAL(triggered()), this, SLOT(OnCut())); mCopyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this); mCopyAct->setShortcut(tr("Ctrl+C")); mCopyAct->setStatusTip(tr("Copy the current selection's contents to the clipboard")); connect(mCopyAct, SIGNAL(triggered()), this, SLOT(OnCopy())); mPasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this); mPasteAct->setShortcut(tr("Ctrl+V")); mPasteAct->setStatusTip(tr("Paste the clipboard's contents into the current selection")); connect(mPasteAct, SIGNAL(triggered()), this, SLOT(OnPaste())); mSeparatorAct = new QAction(this); mSeparatorAct->setSeparator(true); mAboutAct = new QAction(tr("&About"), this); mAboutAct->setStatusTip(tr("Show the application's About box")); connect(mAboutAct, SIGNAL(triggered()), this, SLOT(OnAbout())); mAboutQtAct = new QAction(tr("About &Qt"), this); mAboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(mAboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void KPlistEditor::setupActions() { KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection()); createStandardStatusBarAction(); setStandardToolBarMenuEnabled(true); //KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); //KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); }
static IPTR mGetPrefs(struct IClass *cl, Object *obj, struct MUIP_App_GetPrefs *msg) { struct data *data = INST_DATA(cl,obj); set(obj,MUIA_Application_Sleep,TRUE); closeAllWindows(obj); DoMethod(data->win,MUIM_Win_GetPrefs,msg->mode); set(obj,MUIA_Application_Sleep,FALSE); return 0; }
//! [Dialog constructor part1] Dialog::Dialog() { desktopGeometry = QApplication::desktop()->availableGeometry(0); setWindowTitle(tr("SIP Dialog Example")); QScrollArea *scrollArea = new QScrollArea(this); QGroupBox *groupBox = new QGroupBox(scrollArea); groupBox->setTitle(tr("SIP Dialog Example")); QGridLayout *gridLayout = new QGridLayout(groupBox); groupBox->setLayout(gridLayout); //! [Dialog constructor part1] //! [Dialog constructor part2] QLineEdit* lineEdit = new QLineEdit(groupBox); lineEdit->setText(tr("Open and close the SIP")); lineEdit->setMinimumWidth(220); QLabel* label = new QLabel(groupBox); label->setText(tr("This dialog resizes if the SIP is opened")); label->setMinimumWidth(220); QPushButton* button = new QPushButton(groupBox); button->setText(tr("Close Dialog")); button->setMinimumWidth(220); //! [Dialog constructor part2] //! [Dialog constructor part3] if (desktopGeometry.height() < 400) gridLayout->setVerticalSpacing(80); else gridLayout->setVerticalSpacing(150); gridLayout->addWidget(label); gridLayout->addWidget(lineEdit); gridLayout->addWidget(button); //! [Dialog constructor part3] //! [Dialog constructor part4] scrollArea->setWidget(groupBox); QHBoxLayout* layout = new QHBoxLayout(); layout->addWidget(scrollArea); setLayout(layout); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //! [Dialog constructor part4] //! [Dialog constructor part5] connect(button, SIGNAL(clicked()), qApp, SLOT(closeAllWindows())); connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(desktopResized(int))); }
void GUIApplicationWindow::handleEvent_SimulationEnded(GUIEvent* e) { GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e); onCmdStop(0, 0, 0); if (GUIGlobals::gQuitOnEnd) { closeAllWindows(); getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM); } else { // build the text const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) + ".\nReason: " + MSNet::getStateMessage(ec->getReason()); FXMessageBox::warning(this, MBOX_OK, "Simulation ended", "%s", text.c_str()); } }
ChatWidgetManager::~ChatWidgetManager() { kdebugf(); MessageRenderInfo::unregisterParserTags(); disconnect(Core::instance(), SIGNAL(messageReceived(const Message &)), this, SLOT(messageReceived(const Message &))); closeAllWindows(); kdebugf2(); }
//создания действий void MainForm::createActions() { newPlanAct = new QAction(tr("Новый"), 0, this); newPlanAct->setIconSet(QPixmap::fromMimeSource("document_16.png")); openPlanAct = new QAction(tr("Открыть"), 0, this); openPlanAct->setIconSet(QPixmap::fromMimeSource("folder_16.png")); removePlanAct = new QAction(tr("Удалить"), 0, this); removePlanAct->setIconSet(QPixmap::fromMimeSource("delete_16.png")); //closePlanAct = new QAction(tr("Закрыть"), 0, this); //closePlanAct->setIconSet(QPixmap::fromMimeSource("")); quitAct = new QAction(tr("Выход"), 0, this); quitAct->setIconSet(QPixmap::fromMimeSource("shutdown_16.png")); addTopicAct = new QAction(tr("Добавить"), 0, this); addTopicAct->setIconSet(QPixmap::fromMimeSource("plus_16.png")); addTopicAct->setEnabled(false); editTopicAct = new QAction(tr("Редактировать"), 0, this); editTopicAct->setIconSet(QPixmap::fromMimeSource("pencil_16.png")); editTopicAct->setEnabled(false); removeTopicAct = new QAction(tr("Удалить"), 0, this); removeTopicAct->setIconSet(QPixmap::fromMimeSource("delete_16.png")); removeTopicAct->setEnabled(false); filterAct = new QAction(tr("Фильтр"), 0, this); filterAct->setIconSet(QPixmap::fromMimeSource("funnel_16.png")); filterAct->setEnabled(false); refExecutiveAct = new QAction(tr("Исполнители"), 0, this); refExecutiveAct->setIconSet(QPixmap::fromMimeSource("user_16.png")); refSkbAct = new QAction(tr("СКБ"), 0, this); refSkbAct->setIconSet(QPixmap::fromMimeSource("gear_16.png")); outAct = new QAction(tr("Вывод в MS Word"), 0, this); outAct->setIconSet(QPixmap::fromMimeSource("office_16.png")); outAct->setEnabled(false); connectAct = new QAction(tr("Подключение к БД"), 0, this); connectAct->setIconSet(QPixmap::fromMimeSource("plug_16.png")); connect(newPlanAct, SIGNAL(activated()), this, SLOT(newPlanActivated())); connect(openPlanAct, SIGNAL(activated()), this, SLOT(openPlanActivated())); connect(removePlanAct, SIGNAL(activated()), this, SLOT(removePlanActivated())); //connect(closePlanAct, SIGNAL(activated()), this, SLOT(closePlanActivated())); connect(quitAct, SIGNAL(activated()), qApp, SLOT(closeAllWindows())); connect(addTopicAct, SIGNAL(activated()), this, SLOT(addTopicActivated())); connect(editTopicAct, SIGNAL(activated()), this, SLOT(editTopicActivated())); connect(removeTopicAct, SIGNAL(activated()), this, SLOT(removeTopicActivated())); connect(filterAct, SIGNAL(activated()), this, SLOT(filterActivated())); connect(refExecutiveAct, SIGNAL(activated()), this, SLOT(openReferenceExecutiveActivated())); connect(refSkbAct, SIGNAL(activated()), this, SLOT(openReferenceSkbActivated())); connect(outAct, SIGNAL(activated()), this, SLOT(outInWordActivated())); connect(connectAct, SIGNAL(activated()), this, SLOT(settingsActivated())); connect(topicTable, SIGNAL(clicked(int, int, int, const QPoint&)), this, SLOT(enableActActivated())); }
void GUIApplicationWindow::load(const std::string& file, bool isNet, bool isReload) { getApp()->beginWaitCursor(); myAmLoading = true; closeAllWindows(); if (isReload) { myLoadThread->start(); setStatusBarText("Reloading."); } else { gSchemeStorage.saveViewport(0, 0, -1); // recenter view myLoadThread->load(file, isNet); setStatusBarText("Loading '" + file + "'."); } update(); }
void MainWindow::createMenus() { // configMenu = menuBar()->addMenu(tr("&Config")); //exitMenu = menuBar()->addMenu(tr("Sair")); QAction *configAction = new QAction( tr("&Config"), this ); QAction *exitAction = new QAction( tr("&Sair"), this ); connect( configAction, SIGNAL(triggered()), SLOT(openDialog()) ); connect( exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) ); ui->menuBar->addAction( configAction ); ui->menuBar->addAction( exitAction ); }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), mUI(new Ui::MainWindow) { // Initialize application mSettings = new QSettings("Beeldverwerking", "Tram Collision Detection"); mVideoCapture = 0; #if WRITE_VIDEO mVideoWriter = 0; #endif // Setup interface mUI->setupUi(this); mGLWidget = new GLWidget(); mUI->lytVideo->addWidget(mGLWidget); mUI->btnStart->setEnabled(false); mUI->btnStop->setEnabled(false); // Exit action mActionExit = new QAction(tr("E&xit"), this); mActionExit->setShortcut(tr("Ctrl+Q")); mActionExit->setStatusTip(tr("Exit the application")); connect(mActionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); // Recent file actions for (int i = 0; i < MaxRecentFiles; ++i) { mActionsRecentFiles[i] = new QAction(this); mActionsRecentFiles[i]->setVisible(false); connect(mActionsRecentFiles[i], SIGNAL(triggered()), this, SLOT(on_actRecentFile_triggered())); } // Build recent files QMenu* fileMenu = mUI->menuFile; mActionSeparator = fileMenu->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) fileMenu->addAction(mActionsRecentFiles[i]); fileMenu->addSeparator(); fileMenu->addAction(mActionExit); updateRecentFileActions(); // Print a message #ifdef _OPENMP mUI->statusBar->showMessage("Application initialized (multithreaded execution, using up to " + QString::number(omp_get_max_threads()) + " core(s)"); #else mUI->statusBar->showMessage("Application initialized (singelthreaded execution)"); #endif mFrameCounter = 0; drawStats(); setTitle(); }
void SayayinShell::setupActions() { KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection()); KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); KToggleAction* toggleMenu = KStandardAction::showMenubar(this, SLOT(toggleMenu()), actionCollection()); toggleMenu->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_M)); createStandardStatusBarAction(); setStandardToolBarMenuEnabled(true); //KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); //KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); }
void KMilion::setupActions() { //akcja uruchomienia gry KAction* runAction = new KAction(this); runAction->setText(i18n("&Run Quiz")); runAction->setIcon(KIcon("system-run")); runAction->setShortcut(Qt::CTRL + Qt::Key_R); actionCollection()->addAction("run", runAction); connect(runAction, SIGNAL(triggered(bool)), this, SLOT(runGame())); // KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection()); KStandardAction::open(editorWidget,SLOT(loadTestFile()),actionCollection()); KStandardAction::save(editorWidget,SLOT(saveTestFileOld()),actionCollection()); KStandardAction::saveAs(editorWidget,SLOT(saveTestFileNew()),actionCollection()); KStandardAction::openNew(editorWidget, SLOT(createTestFileNew()), actionCollection()); }
Dialog::Dialog(QWidget *parent) : QDialog(parent) { setWindowTitle( "Frameless Window Helper - 3.0.0"); mFh = new NcFramelessHelper; mCbFrameless = new QCheckBox( "Use Frameless Window" ); mCbWidgetMovable = new QCheckBox( "Enable Move" ); mCbWidgetResizable = new QCheckBox( "Enable Resize" ); mCbUseRubberBandOnMove = new QCheckBox( "Use RubberBand on Move" ); mCbUseRubberBandOnResize = new QCheckBox( "Use RubberBand on Resize" ); mBtnClose = new QPushButton( "Close" ); mBtnMainWin = new QPushButton( "MainWindow" ); QHBoxLayout* hl = new QHBoxLayout; hl->addWidget(mBtnMainWin); hl->addStretch(); hl->addWidget(mBtnClose); QVBoxLayout* vl = new QVBoxLayout; vl->addWidget( mCbFrameless ); vl->addWidget( mCbWidgetMovable ); vl->addWidget( mCbWidgetResizable ); vl->addWidget( mCbUseRubberBandOnMove ); vl->addWidget( mCbUseRubberBandOnResize ); vl->addStretch(); vl->addLayout( hl ); this->setLayout( vl ); createMainWindow(); connect( mBtnMainWin, SIGNAL(clicked()), mWidget, SLOT(show()) ); connect( mBtnClose, SIGNAL(clicked()), qApp, SLOT(closeAllWindows()) ); connect( mCbFrameless, SIGNAL(toggled(bool)), this, SLOT(onCbFramelessToggled(bool)) ); connect( mCbWidgetMovable, SIGNAL(toggled(bool)), this, SLOT(onCbWidgetMovableToggled(bool)) ); connect( mCbWidgetResizable, SIGNAL(toggled(bool)), this, SLOT(onCbWidgetResizableToggled(bool)) ); connect( mCbUseRubberBandOnMove, SIGNAL(toggled(bool)), this, SLOT(onCbUseRubberBandOnMoveToggled(bool)) ); connect( mCbUseRubberBandOnResize, SIGNAL(toggled(bool)), this, SLOT(onCbUseRubberBandOnResizeToggled(bool)) ); mCbFrameless->setChecked(true);//triggers the slot }
void MainWindow::createActions() { newAct = new QAction(tr("&New"), this); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); openAct = new QAction(tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAct = new QAction(tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); saveAsAct = new QAction(tr("Save &As..."), this); saveAsAct->setShortcuts(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void PMainWindow::closeEvent( QCloseEvent* ev ) { /* * return from view * or properly quit */ if (!m_setDocCalled) { if ( m_stack->visibleWidget() == m_info || m_stack->visibleWidget() == m_disp ) { ev->ignore(); raiseIconView(); return; } } if (m_disp && m_disp->fullScreen()) { /* otherwise opie-eye crashes in bigscreen mode! */ m_disp->reparent(0,QPoint(0,0)); m_stack->addWidget(m_disp,ImageDisplay); } ev->accept(); QTimer::singleShot(0, qApp, SLOT(closeAllWindows())); }
Application::Application(int &argc, char **argv) : QApplication(argc, argv), backend(), qmlEngine(this), uiServices(this), mainUrl() { #if defined(WEBVIEW_PACKAGE) QtWebEngine::initialize(); #endif setQmlContextProperty("_app", this); connect(this, SIGNAL(loadMainQmlSignal(QUrl)), &qmlEngine, SLOT(load(QUrl))); connect(&qmlEngine, SIGNAL(objectCreated(QObject*,QUrl)), this, SLOT(objectCreated(QObject*,QUrl))); connect(&qmlEngine, SIGNAL(quit()), this, SLOT(closeAllWindows())); // uiServices qmlRegisterType<UiServices>("UiServices", 1, 0, "UiServices"); setQmlContextProperty("uiServices", &uiServices); backend.setObjectName("Backend Application"); connect(this, SIGNAL(aboutToQuit()), &backend, SLOT(quit())); backend.start(); }
bool QWorkspace::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: cascade(); break; case 1: tile(); break; case 2: closeActiveWindow(); break; case 3: closeAllWindows(); break; case 4: activateNextWindow(); break; case 5: activatePrevWindow(); break; case 6: normalizeActiveWindow(); break; case 7: minimizeActiveWindow(); break; case 8: showOperationMenu(); break; case 9: popupOperationMenu((const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+1))); break; case 10: operationMenuActivated((int)static_QUType_int.get(_o+1)); break; case 11: operationMenuAboutToShow(); break; case 12: toolMenuAboutToShow(); break; case 13: activatePreviousWindow(); break; case 14: dockWindowsShow(); break; case 15: scrollBarChanged(); break; default: return QWidget::qt_invoke( _id, _o ); } return TRUE; }
void MainWindow::connectland() { connect(Btn_Close, SIGNAL(clicked()), qApp, SLOT(closeAllWindows())); connect(Btn_First_Ignore, SIGNAL(clicked()),this, SLOT(START_IgnorePath())); connect(Btn_First_Ok, SIGNAL(clicked()),this, SLOT(START_SetUpdaterPath())); connect(Btn_First_Search, SIGNAL(clicked()),this, SLOT(START_SearchPathUpdater())); connect(Btn_Item_addfolder, SIGNAL(clicked()),treeWidget, SLOT(AddFolder())); connect(Btn_Item_addfile, SIGNAL(clicked()),treeWidget, SLOT(AddFile())); connect(Btn_Item_remove, SIGNAL(clicked()),treeWidget, SLOT(DeleteSelectedFile())); connect(Btn_Apply_Edit, SIGNAL(clicked()), this, SLOT(Liste_Edit_Apply())); connect(checkBox, SIGNAL(clicked(bool)),treeWidget, SLOT(setFilelevel(bool))); connect(CBoxAfficherMsgBox, SIGNAL(stateChanged(int)), this, SLOT(EnableMsgBox(int))); connect(treeWidget,SIGNAL(TaskToShowInStatusbar(QString)), this, SLOT(Set_Status_Msg(QString))); connect(treeWidget,SIGNAL(TaskToShowGbEdit(bool)), this, SLOT(Liste_Show_Edit(bool))); connect(treeWidget,SIGNAL(TaskToEnableGUI(bool)), this, SLOT(EnableControls(bool))); connect(Btn_Apply, SIGNAL(clicked()), this, SLOT(LaunchGen())); connect(&OXM_Generator,SIGNAL(NotifyErrorMsg(QString)),this,SLOT(ShowMsgError(QString))); connect(&OXM_Generator,SIGNAL(NotifyMsg(QString)),this,SLOT(ShowMsg(QString))); connect(&OXM_Generator,SIGNAL(NotifyProgress(int, int)),this,SLOT(Showprogress(int, int))); connect(treeWidget,SIGNAL(NotifyProgress(int, int)),this,SLOT(Showprogress(int, int))); connect(&OXM_Generator,SIGNAL(finished()),this,SLOT(BuildFinished())); }
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(); }
int main(int argc, char *argv[]) { XSqlQuery main; Q_INIT_RESOURCE(guiclient); QString username; QString databaseURL; QString passwd; bool haveUsername = FALSE; bool haveDatabaseURL = FALSE; bool loggedIn = FALSE; bool haveEnhancedAuth= false; bool _enhancedAuth = false; bool havePasswd = false; bool forceWelcomeStub= false; qInstallMsgHandler(xTupleMessageOutput); QApplication app(argc, argv); app.setOrganizationDomain("xTuple.com"); app.setOrganizationName("xTuple"); app.setApplicationName("xTuple"); app.setApplicationVersion(_Version); #if QT_VERSION >= 0x040400 // This is the correct place for this call but on versions less // than 4.4 it causes a crash for an unknown reason so it is // called later on earlier versions. QCoreApplication::addLibraryPath(QString(".")); #endif #ifndef Q_WS_MACX QApplication::setWindowIcon(QIcon(":/images/icon32x32.png")); #endif app.processEvents(); if (argc > 1) { for (int intCounter = 1; intCounter < argc; intCounter++) { QString argument(argv[intCounter]); if (argument.contains("-databaseURL=", Qt::CaseInsensitive)) { haveDatabaseURL = TRUE; databaseURL = argument.right(argument.length() - 13); } else if (argument.contains("-username="******"-passwd=", Qt::CaseInsensitive)) { havePasswd = TRUE; passwd = argument.right(argument.length() - 8); } else if (argument.contains("-noAuth", Qt::CaseInsensitive)) { haveUsername = TRUE; havePasswd = TRUE; } else if (argument.contains("-enhancedAuth", Qt::CaseInsensitive)) { haveEnhancedAuth = true; _enhancedAuth = true; if(argument.contains("=no", Qt::CaseInsensitive) || argument.contains("=false", Qt::CaseInsensitive)) _enhancedAuth = false; } else if (argument.contains("-forceWelcomeStub", Qt::CaseInsensitive)) forceWelcomeStub = true; } } // Try and load a default translation file and install it // otherwise if we are non-english inform the user that translation are available bool checkLanguage = false; QLocale sysl = QLocale::system(); QTranslator defaultTranslator(&app); if (defaultTranslator.load(translationFile(sysl.name().toLower(), "default"))) app.installTranslator(&defaultTranslator); else if(!xtsettingsValue("LanguageCheckIgnore", false).toBool() && sysl.language() != QLocale::C && sysl.language() != QLocale::English) checkLanguage = translationFile(sysl.name().toLower(), "xTuple").isNull(); if (forceWelcomeStub || checkLanguage) { QTranslator * translator = new QTranslator(&app); if (translator->load(translationFile(sysl.name().toLower(), "welcome/wmsg"))) app.installTranslator(translator); welcomeStub wsdlg; wsdlg.checkBox->setChecked(xtsettingsValue("LanguageCheckIgnore", false).toBool()); wsdlg.exec(); xtsettingsSetValue("LanguageCheckIgnore", wsdlg.checkBox->isChecked()); } _splash = new QSplashScreen(); _splash->setPixmap(QPixmap(":/images/splashEmpty.png")); _evaluation = FALSE; if (!loggedIn) { ParameterList params; params.append("copyright", _Copyright); params.append("version", _Version); params.append("build", _Build.arg(__DATE__).arg(__TIME__)); params.append("setSearchPath", true); if (haveUsername) params.append("username", username); if (havePasswd) params.append("password", passwd); if (haveDatabaseURL) params.append("databaseURL", databaseURL); if (haveEnhancedAuth) params.append("enhancedAuth", _enhancedAuth); if (_evaluation) params.append("evaluation"); if ( (haveDatabaseURL) && (haveUsername) && (havePasswd) ) params.append("login"); login2 newdlg(0, "", TRUE); newdlg.set(params, _splash); if(newdlg.result() != QDialog::Accepted) { if (newdlg.exec() == QDialog::Rejected) return -1; else { databaseURL = newdlg._databaseURL; username = newdlg.username(); __password = newdlg.password(); } } } // TODO: can/should we compose the splash screen on the fly from parts? QList<editionDesc> edition; edition << editionDesc( "Enterprise", ":/images/splashEnterprise.png", true, "SELECT fetchMetricText('Application') = 'Standard' AND COUNT(*) = 4" " FROM pkghead" " WHERE pkghead_name IN ('xtmfg', 'xtprjaccnt', 'asset', 'assetdepn');" ) << editionDesc( "Manufacturing", ":/images/splashMfgEdition.png", true, "SELECT fetchMetricText('Application') = 'Standard' AND COUNT(*) = 1" " FROM pkghead" " WHERE pkghead_name IN ('xtmfg');" ) << editionDesc( "Distribution", ":/images/splashDistEdition.png", true, "SELECT fetchMetricText('Application') = 'Standard';" ) << editionDesc( "PostBooks", ":/images/splashPostBooks.png", true, "SELECT fetchMetricText('Application') = 'PostBooks';" ) ; XSqlQuery metric; int editionIdx; // we'll use this after the loop for (editionIdx = 0; editionIdx < edition.size(); editionIdx++) { metric.exec(edition[editionIdx].queryString); if (metric.first() && metric.value(0).toBool()) break; } if (editionIdx >= edition.size()) editionIdx = edition.size(); // default to PostBooks _splash->setPixmap(QPixmap(edition[editionIdx].splashResource)); _Name = _Name.arg(edition[editionIdx].editionName); if (edition[editionIdx].shouldCheckLicense) { _splash->showMessage(QObject::tr("Checking License Key"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); // PostgreSQL changed the column "procpid" to just "pid" in 9.2.0+ Incident #21852 XSqlQuery checkVersion(QString("select compareversion('9.2.0');")); if(checkVersion.first()) { if(checkVersion.value("compareversion").toInt() > 0) { metric.exec("SELECT count(*) AS registered, (SELECT count(*) FROM pg_stat_activity WHERE datname=current_database()) AS total" " FROM pg_stat_activity, pg_locks" " WHERE((database=datid)" " AND (classid=datid)" " AND (objsubid=2)" " AND (procpid = pg_backend_pid()));"); } else { metric.exec("SELECT count(*) AS registered, (SELECT count(*) FROM pg_stat_activity WHERE datname=current_database()) AS total" " FROM pg_stat_activity, pg_locks" " WHERE((database=datid)" " AND (classid=datid)" " AND (objsubid=2)" " AND (pg_stat_activity.pid = pg_backend_pid()));"); } } int cnt = 50000; int tot = 50000; if(metric.first()) { cnt = metric.value("registered").toInt(); tot = metric.value("total").toInt(); } metric.exec("SELECT packageIsEnabled('drupaluserinfo') AS result;"); bool xtweb = false; if(metric.first()) xtweb = metric.value("result").toBool(); metric.exec("SELECT fetchMetricBool('ForceLicenseLimit') as metric_value;"); bool forceLimit = false; bool forced = false; if(metric.first()) forceLimit = metric.value("metric_value").toBool(); metric.exec("SELECT metric_value" " FROM metric" " WHERE(metric_name = 'RegistrationKey');"); bool checkPass = true; bool checkLock = false; bool expired = false; QString checkPassReason; QString rkey = ""; if(metric.first()) rkey = metric.value("metric_value").toString(); XTupleProductKey pkey(rkey); QString application; metric.exec("SELECT fetchMetricText('Application') as app;"); if(metric.first()) { application = metric.value("app").toString(); } if(pkey.valid() && (pkey.version() == 1 || pkey.version() == 2 || pkey.version() == 3)) { if(pkey.expiration() < QDate::currentDate()) { checkPass = false; checkPassReason = QObject::tr("<p>Your license has expired."); if(!pkey.perpetual()) { int daysTo = pkey.expiration().daysTo(QDate::currentDate()); if(daysTo > 30) { checkLock = true; expired = true; checkPassReason = QObject::tr("<p>Your xTuple license expired over 30 days ago, and this software will no longer function. Please contact xTuple immediately to reinstate your software."); } else checkPassReason = QObject::tr("<p>Attention: Your xTuple license has expired, and in %1 days this software will cease to function. Please make arrangements for immediate payment").arg(30 - daysTo); } else expired = true; } else if(application == "PostBooks" && pkey.users() == 1) { if(pkey.users() < cnt) { checkPass = false; checkPassReason = QObject::tr("<p>Multiple concurrent users of xTuple PostBooks require a license key. Please contact [email protected] to request a free license key for your local installation, or [email protected] to purchase additional users in the xTuple Cloud Service. <p>Thank you."); checkLock = forced = forceLimit; } } else if(pkey.users() != 0 && (pkey.users() < cnt || (!xtweb && (pkey.users() * 2 < tot)))) { checkPass = false; checkPassReason = QObject::tr("<p>You have exceeded the number of allowed concurrent users for your license."); checkLock = forced = forceLimit; } else { int daysTo = QDate::currentDate().daysTo(pkey.expiration()); if(!pkey.perpetual() && daysTo <= 15) { checkPass = false; checkPassReason = QObject::tr("<p>Please note: your xTuple license will expire in %1 days. You should already have received your renewal invoice; please contact xTuple at your earliest convenience.").arg(daysTo); } } } else { checkPass = false; checkPassReason = QObject::tr("<p>The Registration key installed for this system does not appear to be valid."); } if(!checkPass) { _splash->hide(); if (expired) { registrationKeyDialog newdlg(0, "", TRUE); if(newdlg.exec() == -1) { QMessageBox::critical(0, QObject::tr("Registration Key"), checkPassReason); return 0; } } else if(checkLock) { QMessageBox::critical(0, QObject::tr("Registration Key"), checkPassReason); if(!forced) return 0; } else { if(QMessageBox::critical(0, QObject::tr("Registration Key"), QObject::tr("%1\n<p>Would you like to continue anyway?").arg(checkPassReason), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) return 0; } if(forced) checkPassReason.append(" FORCED!"); metric.exec("SELECT current_database() AS db," " fetchMetricText('DatabaseName') AS dbname," " fetchMetricText('remitto_name') AS name;"); QString db = ""; QString dbname = ""; QString name = ""; if(metric.first()) { db = metric.value("db").toString(); dbname = metric.value("dbname").toString(); name = metric.value("name").toString(); } QHttp *http = new QHttp(); QUrl url; url.setPath("/api/regviolation.php"); url.addQueryItem("key", QUrl::toPercentEncoding(rkey)); url.addQueryItem("error", QUrl::toPercentEncoding(checkPassReason)); url.addQueryItem("name", QUrl::toPercentEncoding(name)); url.addQueryItem("dbname", QUrl::toPercentEncoding(dbname)); url.addQueryItem("db", QUrl::toPercentEncoding(db)); url.addQueryItem("cnt", QString::number(cnt)); url.addQueryItem("tot", QString::number(tot)); url.addQueryItem("ver", _Version); http->setHost("www.xtuple.org"); http->get(url.toString()); if(forced) return 0; _splash->show(); } } bool disallowMismatch = false; bool shouldCheckForUpdates = false; metric.exec("SELECT metric_value" " FROM metric" " WHERE (metric_name = 'ServerVersion')"); if (!metric.first() || (metric.value("metric_value").toString() != _dbVersion)) { int result = 0; metric.exec("SELECT metric_value FROM metric WHERE (metric_name = 'DisallowMismatchClientVersion')"); if (metric.first() && (metric.value("metric_value").toString() == "t")) { disallowMismatch = true; } metric.exec("SELECT metric_value FROM metric WHERE (metric_name = 'CheckForUpdates')"); if (metric.first()) { shouldCheckForUpdates = (metric.value("metric_value").toString() == "t" ? true : false); } if (shouldCheckForUpdates) { _splash->hide(); checkForUpdates newdlg(0,"", TRUE); result = newdlg.exec(); if (result == QDialog::Rejected) { return 0; } } else if (!shouldCheckForUpdates && disallowMismatch) { _splash->hide(); result = QMessageBox::warning( 0, QObject::tr("Version Mismatch"), QObject::tr("<p>The version of the database you are connecting to is " "not the version this client was designed to work against. " "This client was designed to work against the database " "version %1. The system has been configured to disallow " "access in this case.<p>Please contact your systems " "administrator.").arg(_Version), QMessageBox::Ok | QMessageBox::Escape | QMessageBox::Default ); return 0; } else { _splash->hide(); result = QMessageBox::warning( 0, QObject::tr("Version Mismatch"), QObject::tr("<p>The version of the database you are connecting to is " "not the version this client was designed to work against. " "This client was designed to work against the database " "version %1. If you continue some or all functionality may " "not work properly or at all. You may also cause other " "problems on the database.<p>Do you want to continue " "anyway?").arg(_Version), QMessageBox::Yes, QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ); if (result != QMessageBox::Yes) { return 0; } else { _splash->show(); } } } _splash->showMessage(QObject::tr("Loading Database Metrics"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); _metrics = new Metrics(); _splash->showMessage(QObject::tr("Loading User Preferences"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); _preferences = new Preferences(username); _splash->showMessage(QObject::tr("Loading User Privileges"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); _privileges = new Privileges(); // Load the translator and set the locale from the User's preferences _splash->showMessage(QObject::tr("Loading Translation Dictionary"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); XSqlQuery langq("SELECT * " "FROM usr, locale LEFT OUTER JOIN" " lang ON (locale_lang_id=lang_id) LEFT OUTER JOIN" " country ON (locale_country_id=country_id) " "WHERE ( (usr_username=getEffectiveXtUser())" " AND (usr_locale_id=locale_id) );" ); if (langq.first()) { QStringList files; if (!langq.value("locale_lang_file").toString().isEmpty()) files << langq.value("locale_lang_file").toString(); QString langext; if (!langq.value("lang_abbr2").toString().isEmpty() && !langq.value("country_abbr").toString().isEmpty()) { langext = langq.value("lang_abbr2").toString() + "_" + langq.value("country_abbr").toString().toLower(); } else if (!langq.value("lang_abbr2").toString().isEmpty()) { langext = langq.value("lang_abbr2").toString(); } if(!langext.isEmpty()) { files << "qt"; files << "xTuple"; files << "openrpt"; files << "reports"; XSqlQuery pkglist("SELECT pkghead_name" " FROM pkghead" " WHERE packageIsEnabled(pkghead_name);"); while(pkglist.next()) files << pkglist.value("pkghead_name").toString(); } if (files.size() > 0) { QStringList notfound; QTranslator *translator = new QTranslator(&app); for (QStringList::Iterator fit = files.begin(); fit != files.end(); ++fit) { if (DEBUG) qDebug("looking for %s", (*fit).toAscii().data()); if (translator->load(translationFile(langext, *fit))) { app.installTranslator(translator); qDebug("installed %s", (*fit).toAscii().data()); translator = new QTranslator(&app); } else { notfound << *fit; } } if (! notfound.isEmpty() && !_preferences->boolean("IngoreMissingTranslationFiles")) QMessageBox::warning( 0, QObject::tr("Cannot Load Dictionary"), QObject::tr("<p>The Translation Dictionaries %1 " "cannot be loaded. Reverting " "to the default dictionary." ) .arg(notfound.join(QObject::tr(", ")))); } /* set the locale to langabbr_countryabbr, langabbr, {lang# country#}, or lang#, depending on what information is available */ QString langAbbr = langq.value("lang_abbr2").toString(); QString cntryAbbr = langq.value("country_abbr").toString().toUpper(); if(cntryAbbr == "UK") cntryAbbr = "GB"; if (! langAbbr.isEmpty() && ! cntryAbbr.isEmpty()) QLocale::setDefault(QLocale(langAbbr + "_" + cntryAbbr)); else if (! langAbbr.isEmpty()) QLocale::setDefault(QLocale(langq.value("lang_abbr2").toString())); else if (langq.value("lang_qt_number").toInt() && langq.value("country_qt_number").toInt()) QLocale::setDefault( QLocale(QLocale::Language(langq.value("lang_qt_number").toInt()), QLocale::Country(langq.value("country_qt_number").toInt()))); else QLocale::setDefault(QLocale::system()); qDebug("Locale set to language %s and country %s", QLocale().languageToString(QLocale().language()).toAscii().data(), QLocale().countryToString(QLocale().country()).toAscii().data()); } else if (langq.lastError().type() != QSqlError::NoError) { systemError(0, langq.lastError().databaseText(), __FILE__, __LINE__); } qApp->processEvents(); QString key; // TODO: Add code to check a few locations - Hopefully done QString keypath; QString keyname; QString keytogether; #ifdef Q_WS_WIN keypath = _metrics->value("CCWinEncKey"); #elif defined Q_WS_MACX keypath = _metrics->value("CCMacEncKey"); #elif defined Q_WS_X11 keypath = _metrics->value("CCLinEncKey"); #endif if (keypath.isEmpty()) keypath = app.applicationDirPath(); if (! keypath.endsWith(QDir::separator())) keypath += QDir::separator(); keyname = _metrics->value("CCEncKeyName"); if (keyname.isEmpty()) { keyname = "xTuple.key"; keytogether = keypath + keyname; QFile kn(keytogether); if(!kn.exists()) keyname = "OpenMFG.key"; } keytogether = keypath + keyname; // qDebug("keytogether: %s", keytogether.toAscii().data()); QFile keyFile(keytogether); if(keyFile.exists()) { if(keyFile.open(QIODevice::ReadOnly)) { key = keyFile.readLine(1024); // strip off any newline characters key = key.trimmed(); } } omfgThis = 0; omfgThis = new GUIClient(databaseURL, username); omfgThis->_key = key; if (key.length() > 0) { _splash->showMessage(QObject::tr("Loading Database Encryption Metrics"), SplashTextAlignment, SplashTextColor); qApp->processEvents(); _metricsenc = new Metricsenc(key); } initializePlugin(_preferences, _metrics, _privileges, omfgThis->username(), omfgThis->workspace()); // START code for updating the locale settings if they haven't been already XSqlQuery lc; lc.exec("SELECT count(*) FROM metric WHERE metric_name='AutoUpdateLocaleHasRun';"); lc.first(); if(lc.value(0).toInt() == 0) { lc.exec("INSERT INTO metric (metric_name, metric_value) values('AutoUpdateLocaleHasRun', 't');"); lc.exec("SELECT locale_id from locale;"); while(lc.next()) { ParameterList params; params.append("mode","edit"); params.append("locale_id", lc.value(0)); sysLocale lcdlg; lcdlg.set(params); lcdlg.sSave(); } } // END code for updating locale settings QObject::connect(&app, SIGNAL(aboutToQuit()), &app, SLOT(closeAllWindows())); if (omfgThis->_singleWindow.isEmpty()) { omfgThis->setAttribute(Qt::WA_DeleteOnClose); omfgThis->show(); } // keep this synchronized with GUIClient and user.ui.h else if (omfgThis->_singleWindow == "woTimeClock") { ScriptToolbox sb(0); QWidget* newdlg = sb.openWindow("woTimeClock"); if(newdlg) { XMainWindow *mw = qobject_cast<XMainWindow*>(newdlg); if(mw) { ParameterList params; params.append("captive"); mw->set(params); } newdlg->setAttribute(Qt::WA_DeleteOnClose); QObject::connect(omfgThis, SIGNAL(destroyed(QObject*)), &app, SLOT(quit())); newdlg->show(); } else {
long GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) { closeAllWindows(); return 1; }
void GUIApplicationWindow::handleEvent_SimulationLoaded(GUIEvent* e) { myAmLoading = false; GUIEvent_SimulationLoaded* ec = static_cast<GUIEvent_SimulationLoaded*>(e); if (ec->myNet != 0) { #ifndef NO_TRACI std::map<int, traci::TraCIServer::CmdExecutor> execs; execs[CMD_GET_GUI_VARIABLE] = &TraCIServerAPI_GUI::processGet; execs[CMD_SET_GUI_VARIABLE] = &TraCIServerAPI_GUI::processSet; try { traci::TraCIServer::openSocket(execs); } catch (ProcessError& e) { myMessageWindow->appendText(EVENT_ERROR_OCCURED, e.what()); WRITE_ERROR(e.what()); delete ec->myNet; ec->myNet = 0; } #endif } // check whether the loading was successfull if (ec->myNet == 0) { // report failure setStatusBarText("Loading of '" + ec->myFile + "' failed!"); if (GUIGlobals::gQuitOnEnd) { closeAllWindows(); getApp()->exit(1); } } else { // report success setStatusBarText("'" + ec->myFile + "' loaded."); // initialise simulation thread myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd); myWasStarted = false; // initialise views myViewNumber = 0; const GUISUMOViewParent::ViewType defaultType = ec->myOsgView ? GUISUMOViewParent::VIEW_3D_OSG : GUISUMOViewParent::VIEW_2D_OPENGL; if (ec->mySettingsFiles.size() > 0) { // open a view for each file and apply settings for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin(); it != ec->mySettingsFiles.end(); ++it) { GUISettingsHandler settings(*it); GUISUMOViewParent::ViewType vt = defaultType; if (settings.getViewType() == "osg" || settings.getViewType() == "3d") { vt = GUISUMOViewParent::VIEW_3D_OSG; } if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") { vt = GUISUMOViewParent::VIEW_2D_OPENGL; } GUISUMOAbstractView* view = openNewView(vt); if (view == 0) { break; } std::string settingsName = settings.addSettings(view); view->addDecals(settings.getDecals()); settings.setViewport(view); settings.setSnapshots(view); if (settings.getDelay() > 0) { mySimDelayTarget->setValue(settings.getDelay()); } if (settings.getBreakpoints().size() > 0) { GUIGlobals::gBreakpoints = settings.getBreakpoints(); } } } else { openNewView(defaultType); } if (isGaming()) { setTitle("SUMO Traffic Light Game"); } else { // set simulation name on the caption std::string caption = "SUMO " + std::string(VERSION_STRING); setTitle(MFXUtils::getTitleText(caption.c_str(), ec->myFile.c_str())); } // set simulation step begin information std::string t = time2string(ec->myNet->getCurrentTimeStep()); if (myAmGaming || fmod(TS, 1.) == 0.) { myLCDLabel->setText(t.substr(0, t.length() - 3).c_str()); } else { myLCDLabel->setText(t.c_str()); } } getApp()->endWaitCursor(); // start if wished if (GUIGlobals::gRunAfterLoad && ec->myNet != 0 && myRunThread->simulationIsStartable()) { onCmdStart(0, 0, 0); } update(); }
void MainWindow::finalize() { resetWindowTitle(); setWindowIcon( embed::getIconPixmap( "icon" ) ); // project-popup-menu QMenu * project_menu = new QMenu( this ); menuBar()->addMenu( project_menu )->setText( tr( "&File" ) ); project_menu->addAction( embed::getIconPixmap( "project_new" ), tr( "&New" ), this, SLOT( createNewProject() ), QKeySequence::New ); m_templatesMenu = new QMenu( tr("New from template"), this ); connect( m_templatesMenu, SIGNAL( aboutToShow() ), SLOT( fillTemplatesMenu() ) ); connect( m_templatesMenu, SIGNAL( triggered( QAction * ) ), SLOT( createNewProjectFromTemplate( QAction * ) ) ); project_menu->addMenu(m_templatesMenu); project_menu->addAction( embed::getIconPixmap( "project_open" ), tr( "&Open..." ), this, SLOT( openProject() ), QKeySequence::Open ); m_recentlyOpenedProjectsMenu = project_menu->addMenu( embed::getIconPixmap( "project_open_recent" ), tr( "&Recently Opened Projects" ) ); connect( m_recentlyOpenedProjectsMenu, SIGNAL( aboutToShow() ), this, SLOT( updateRecentlyOpenedProjectsMenu() ) ); connect( m_recentlyOpenedProjectsMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( openRecentlyOpenedProject( QAction * ) ) ); project_menu->addAction( embed::getIconPixmap( "project_save" ), tr( "&Save" ), this, SLOT( saveProject() ), QKeySequence::Save ); project_menu->addAction( embed::getIconPixmap( "project_saveas" ), tr( "Save &As..." ), this, SLOT( saveProjectAs() ), Qt::CTRL + Qt::SHIFT + Qt::Key_S ); project_menu->addAction( embed::getIconPixmap( "project_save" ), tr( "Save as New &Version" ), this, SLOT( saveProjectAsNewVersion() ), Qt::CTRL + Qt::ALT + Qt::Key_S ); project_menu->addAction( tr( "Save as default template" ), this, SLOT( saveProjectAsDefaultTemplate() ) ); project_menu->addSeparator(); project_menu->addAction( embed::getIconPixmap( "project_import" ), tr( "Import..." ), Engine::getSong(), SLOT( importProject() ) ); project_menu->addAction( embed::getIconPixmap( "project_export" ), tr( "E&xport..." ), Engine::getSong(), SLOT( exportProject() ), Qt::CTRL + Qt::Key_E ); project_menu->addAction( embed::getIconPixmap( "project_export" ), tr( "E&xport Tracks..." ), Engine::getSong(), SLOT( exportProjectTracks() ), Qt::CTRL + Qt::SHIFT + Qt::Key_E ); // temporarily disabled broken MIDI export /*project_menu->addAction( embed::getIconPixmap( "midi_file" ), tr( "Export &MIDI..." ), Engine::getSong(), SLOT( exportProjectMidi() ), Qt::CTRL + Qt::Key_M );*/ project_menu->addSeparator(); project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ), qApp, SLOT( closeAllWindows() ), Qt::CTRL + Qt::Key_Q ); QMenu * edit_menu = new QMenu( this ); menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) ); m_undoAction = edit_menu->addAction( embed::getIconPixmap( "edit_undo" ), tr( "Undo" ), this, SLOT( undo() ), QKeySequence::Undo ); m_redoAction = edit_menu->addAction( embed::getIconPixmap( "edit_redo" ), tr( "Redo" ), this, SLOT( redo() ), QKeySequence::Redo ); // Ensure that both (Ctrl+Y) and (Ctrl+Shift+Z) activate redo shortcut regardless of OS defaults if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::Key_Y)) { new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_Y ), this, SLOT(redo()) ); } if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z )) { new QShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_Z ), this, SLOT(redo()) ); } edit_menu->addSeparator(); edit_menu->addAction( embed::getIconPixmap( "setup_general" ), tr( "Settings" ), this, SLOT( showSettingsDialog() ) ); connect( edit_menu, SIGNAL(aboutToShow()), this, SLOT(updateUndoRedoButtons()) ); m_viewMenu = new QMenu( this ); menuBar()->addMenu( m_viewMenu )->setText( tr( "&View" ) ); connect( m_viewMenu, SIGNAL( aboutToShow() ), this, SLOT( updateViewMenu() ) ); connect( m_viewMenu, SIGNAL(triggered(QAction*)), this, SLOT(updateConfig(QAction*))); m_toolsMenu = new QMenu( this ); for( const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Tool) ) { m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName ); m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/NULL ) ->createView(this) ); } if( !m_toolsMenu->isEmpty() ) { menuBar()->addMenu( m_toolsMenu )->setText( tr( "&Tools" ) ); connect( m_toolsMenu, SIGNAL( triggered( QAction * ) ), this, SLOT( showTool( QAction * ) ) ); }
void MainWindow::create_actions() { // file menu new_model_action = new QAction(tr("New voxel model"), this); connect(new_model_action, SIGNAL(triggered()), this, SLOT(new_model())); open_model_action = new QAction(tr("Open voxel model"), this); connect(open_model_action, SIGNAL(triggered()), this, SLOT(open_model())); clone_model_action = new QAction(tr("Clone voxel model"), this); connect(clone_model_action, SIGNAL(triggered()), this, SLOT(clone_model())); save_action = new QAction(tr("&Save"), this); save_action->setShortcuts(QKeySequence::Save); connect(save_action, SIGNAL(triggered()), this, SLOT(save())); save_as_action = new QAction(tr("Save &As..."), this); save_as_action->setShortcuts(QKeySequence::SaveAs); connect(save_as_action, SIGNAL(triggered()), this, SLOT(save_as())); exit_action = new QAction(tr("E&xit"), this); exit_action->setShortcuts(QKeySequence::Quit); exit_action->setStatusTip(tr("Exit the application")); connect(exit_action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); /* cut_action = new QAction(tr("Cu&t"), this); cut_action->setShortcuts(QKeySequence::Cut); cut_action->setStatusTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cut_action, SIGNAL(triggered()), this, SLOT(cut())); copy_action = new QAction(tr("&Copy"), this); copy_action->setShortcuts(QKeySequence::Copy); copy_action->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copy_action, SIGNAL(triggered()), this, SLOT(copy())); paste_action = new QAction(tr("&Paste"), this); paste_action->setShortcuts(QKeySequence::Paste); paste_action->setStatusTip(tr("Paste the clipboard's contents into the current " "selection")); connect(paste_action, SIGNAL(triggered()), this, SLOT(paste()));*/ // model menu double_size_action = new QAction(tr("Double size"), this); // new_action->setShortcuts(QKeySequence::New); connect(double_size_action, SIGNAL(triggered()), this, SLOT(double_size())); half_size_action = new QAction(tr("Half size"), this); // open_action->setShortcuts(QKeySequence::Open); connect(half_size_action, SIGNAL(triggered()), this, SLOT(half_size())); optimize_action = new QAction(tr("Optimize dimensions"), this); // save_action->setShortcuts(QKeySequence::Save); connect(optimize_action, SIGNAL(triggered()), this, SLOT(optimize())); rotate_action = new QAction(tr("Rotate 90 degrees"), this); // save_action->setShortcuts(QKeySequence::Save); connect(rotate_action, SIGNAL(triggered()), this, SLOT(rotate())); }
void TaskJuggler::setupActions() { // "File" menu KStdAction::openNew(this, SLOT(fileNew()), actionCollection()); new KAction(i18n("New &Include File" ), "file_temporary", KShortcut(), this, SLOT(fileNewInclude()), actionCollection(), "new_include"); KStdAction::open(this, SLOT(fileOpen()), actionCollection()); KStdAction::close(this, SLOT(fileClose()), actionCollection()); KStdAction::print(this, SLOT(filePrint()), actionCollection()); KStdAction::quit(kapp, SLOT(closeAllWindows()), actionCollection()); // Setup "Open Recent" menu and load old recent files. m_recentAction = KStdAction::openRecent(this, SLOT(load(const KURL&)), actionCollection()); // "Goto" menu new KAction(i18n("Tas&ks"), "tj_task_group", KShortcut(KKey("ALT+k")), m_view, SLOT(setFocusToTaskList()), actionCollection(), "tasks"); new KAction(i18n("&Resources"), "tj_resource_group", KShortcut(KKey("ALT+r")), m_view, SLOT(setFocusToResourceList()), actionCollection(), "resources"); new KAction(i18n("&Accounts"), "tj_account_group", KShortcut(KKey("ALT+a")), m_view, SLOT(setFocusToAccountList()), actionCollection(), "accounts"); new KAction(i18n("Re&ports"), "tj_report_list", KShortcut(KKey("ALT+p")), m_view, SLOT(setFocusToReportList()), actionCollection(), "reports"); new KAction(i18n("F&iles"), "tj_file_list", KShortcut(KKey("ALT+i")), m_view, SLOT(setFocusToFileList()), actionCollection(), "files"); new KAction(i18n("E&ditor"), "tj_editor", KShortcut("ALT+d"), m_view, SLOT(setFocusToEditor()), actionCollection(), "editor"); new KAction(i18n("Rep&ort"), "tj_report", KShortcut("ALT+o"), m_view, SLOT(setFocusToReport()), actionCollection(), "report"); // "Tools" menu new KAction(i18n("&Schedule"), "tj_schedule", KShortcut(KKey("F9")), m_view, SLOT(schedule()), actionCollection(), "schedule"); new KAction(i18n("Stop scheduling"), "stop", 0, m_view, SLOT(stop()), actionCollection(), "stop"); new KAction(i18n("&Generate all Reports"), 0, 0, m_view, SLOT(generate()), actionCollection(), "generate"); new KAction(i18n("Goto &previous Problem"), "tj_previous_problem", KShortcut(KKey("F10")), m_view, SLOT(previousProblem()), actionCollection(), "previous_problem"); new KAction(i18n("Goto &next Problem"), "tj_next_problem", KShortcut(KKey("F11")), m_view, SLOT(nextProblem()), actionCollection(), "next_problem"); new KAction(i18n("Zoom &In"), "viewmag+", KShortcut(KKey("F7")), m_view, SLOT(zoomIn()), actionCollection(), "zoom_in"); new KAction(i18n("Zoom &Out"), "viewmag-", KShortcut(KKey("F8")), m_view, SLOT(zoomOut()), actionCollection(), "zoom_out"); // "Help" menu new KAction(i18n("Tip of the day"), "idea", 0, this, SLOT(showTip()), actionCollection(), "tip"); new KAction(i18n("Explain Keyword"), "tj_keyword_help", KShortcut(KKey("F2")), m_view, SLOT(keywordHelp()), actionCollection(), "keyword_help"); new KAction(i18n("Tutorial"), "tj_tutorial", 0, m_view, SLOT(tutorial()), actionCollection(), "tutorial"); setupGUI(ToolBar | Keys | StatusBar | Save | Create); }
// constructor MyWindow::MyWindow(int w, int h) : red_active(false), red_set(*(new Polygon_set)), blue_set(*(new Polygon_set)), res_set(*(new Polygon_set)) { widget = new CGAL::Qt_widget(this); //Constructs a widget which is a child of this window /* Sets the central widget for this main window to w. * The central widget is surrounded by the left, top, right and bottom dock areas. * The menu bar is above the top dock area */ setCentralWidget(widget); file_name= QString::null; //create a timer for checking if somthing changed QTimer *timer = new QTimer( this ); // constructs a timer whose parent is this window connect( timer, SIGNAL(timeout()), this, SLOT(timer_done()) ); // connects the timer to the window timer->start( 200, FALSE ); // Starts the timer with a msec milliseconds timeout // file menu QPopupMenu * file = new QPopupMenu( this ); menuBar()->insertItem( "&File", file ); file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N); file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W); file->insertSeparator(); file->insertItem("&Open Linear Polygon file", this, SLOT(open_linear_polygon_file()),CTRL+Key_O); file->insertItem("&Open DXF file", this, SLOT(open_dxf_file()),CTRL+Key_D); file->insertSeparator(); //file->insertItem("&Save",this ,SLOT(save_file()),CTRL+Key_S); //file->insertItem("&Save as",this ,SLOT(save_file_as())); file->insertSeparator(); file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P); file->insertSeparator(); file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); // help menu QPopupMenu * help = new QPopupMenu( this ); menuBar()->insertItem( "&Help", help ); help->insertItem("How To", this, SLOT(howto()), Key_F1); help->insertSeparator(); help->insertItem("&About", this, SLOT(about()), CTRL+Key_A ); help->insertItem("About &Qt", this, SLOT(aboutQt()) ); //the standard toolbar stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST"); radiotoolbar = new QToolBar(this, "polygon type"); blue_pgn = new QRadioButton ("Blue", radiotoolbar); blue_pgn->toggle(); red_pgn = new QRadioButton("Red", radiotoolbar); radio_group = new QVButtonGroup(this,"Radios"); radio_group->insert(blue_pgn); radio_group->insert(red_pgn); radio_group->setRadioButtonExclusive(true); connect(blue_pgn, SIGNAL(toggled (bool)), this, SLOT(radio_selected())); connect(red_pgn, SIGNAL(toggled (bool)), this, SLOT(radio_selected())); //layers //widget->attach(&testlayer); //the new tools toolbar newtoolbar = new Tools_toolbar(widget, this); // voronoi toolbar bops_toolbar = new QToolBar(this, "Boolean operations"); QIconSet set0(QPixmap( (const char**)intersection_xpm ), QPixmap( (const char**)intersection_xpm )); intersection_but = new QToolButton(bops_toolbar, "Boolean operations"); intersection_but->setAutoRaise(TRUE); intersection_but->setIconSet(set0); intersection_but->setTextLabel("Intersection "); connect(intersection_but,SIGNAL(pressed()), this, SLOT(perform_intersection())); QIconSet set1(QPixmap( (const char**)union_xpm ), QPixmap( (const char**)union_xpm )); bops_toolbar->addSeparator(); union_but = new QToolButton(bops_toolbar, "Boolean operations"); union_but->setAutoRaise(TRUE); union_but->setIconSet(set1); union_but->setTextLabel("Union "); connect(union_but,SIGNAL(pressed()), this, SLOT(perform_union())); QIconSet set2(QPixmap( (const char**)diff_PQ_xpm ), QPixmap( (const char**)diff_PQ_xpm )); bops_toolbar->addSeparator(); diff_but2 = new QToolButton(bops_toolbar, "Boolean operations"); diff_but2->setAutoRaise(TRUE); diff_but2->setIconSet(set2); diff_but2->setTextLabel("Difference between Blue and Red"); connect(diff_but2, SIGNAL(pressed()), this, SLOT(perform_diff2())); QIconSet set3(QPixmap( (const char**)diff_QP_xpm ), QPixmap( (const char**)diff_QP_xpm )); bops_toolbar->addSeparator(); diff_but = new QToolButton(bops_toolbar, "Boolean operations"); diff_but->setAutoRaise(TRUE); diff_but->setIconSet(set3); diff_but->setTextLabel("Difference between Red and Blue"); connect(diff_but, SIGNAL(pressed()), this, SLOT(perform_diff())); QIconSet set4(QPixmap( (const char**)symm_diff_xpm ), QPixmap( (const char**)symm_diff_xpm )); bops_toolbar->addSeparator(); symm_diff_but = new QToolButton(bops_toolbar, "Boolean operations"); symm_diff_but->setAutoRaise(TRUE); symm_diff_but->setIconSet(set4); symm_diff_but->setTextLabel("Symmetric Difference "); connect(symm_diff_but, SIGNAL(pressed()), this, SLOT(perform_symm_diff())); QIconSet set12(QPixmap( (const char**)mink_sum_xpm ), QPixmap( (const char**)mink_sum_xpm )); bops_toolbar->addSeparator(); mink_sum_but = new QToolButton(bops_toolbar, "Boolean operations"); mink_sum_but->setAutoRaise(TRUE); mink_sum_but->setIconSet(set12); mink_sum_but->setTextLabel("Minkowski Sum "); connect(mink_sum_but, SIGNAL(pressed()), this, SLOT(perform_mink_sum())); QIconSet set5(QPixmap( (const char**)comp_P_xpm ), QPixmap( (const char**)comp_P_xpm )); bops_toolbar->addSeparator(); blue_complement_but = new QToolButton(bops_toolbar, "Boolean operations"); blue_complement_but->setAutoRaise(TRUE); blue_complement_but->setIconSet(set5); blue_complement_but->setTextLabel("Blue Complement "); connect(blue_complement_but, SIGNAL(pressed()), this, SLOT(perform_blue_complement())); QIconSet set6(QPixmap( (const char**)comp_Q_xpm ), QPixmap( (const char**)comp_Q_xpm )); bops_toolbar->addSeparator(); red_complement_but = new QToolButton(bops_toolbar, "Boolean operations"); red_complement_but->setAutoRaise(TRUE); red_complement_but->setIconSet(set6); red_complement_but->setTextLabel("Red Complement "); connect(red_complement_but, SIGNAL(pressed()), this, SLOT(perform_red_complement())); QIconSet set7(QPixmap( (const char**)make_P_xpm ), QPixmap( (const char**)make_P_xpm )); bops_toolbar->addSeparator(); make_res_blue_but = new QToolButton(bops_toolbar, "Boolean operations"); make_res_blue_but->setAutoRaise(TRUE); make_res_blue_but->setIconSet(set7); make_res_blue_but->setTextLabel("Make Result Blue"); connect(make_res_blue_but,SIGNAL(pressed()), this, SLOT(make_res_blue())); QIconSet set8(QPixmap( (const char**)make_Q_xpm ), QPixmap( (const char**)make_Q_xpm )); bops_toolbar->addSeparator(); make_res_red_but = new QToolButton(bops_toolbar, "Boolean operations"); make_res_red_but->setAutoRaise(TRUE); make_res_red_but->setIconSet(set8); make_res_red_but->setTextLabel("Make Result Red"); connect(make_res_red_but,SIGNAL(pressed()), this, SLOT(make_res_red())); QIconSet set9(QPixmap( (const char**)refresh_xpm ), QPixmap( (const char**)refresh_xpm )); bops_toolbar->addSeparator(); refresh_but = new QToolButton(bops_toolbar, "Boolean operations"); refresh_but->setAutoRaise(TRUE); refresh_but->setIconSet(set9); refresh_but->setTextLabel("Refresh "); connect(refresh_but,SIGNAL(pressed()), this, SLOT(refresh())); QIconSet set10(QPixmap( (const char**)del_P_xpm ), QPixmap( (const char**)del_P_xpm )); bops_toolbar->addSeparator(); delete_blue_but = new QToolButton(bops_toolbar, "Boolean operations"); delete_blue_but->setAutoRaise(TRUE); delete_blue_but->setIconSet(set10); delete_blue_but->setTextLabel("Delete Blue Polygons"); connect(delete_blue_but,SIGNAL(pressed()), this, SLOT(delete_blue_polygons())); QIconSet set11(QPixmap( (const char**)del_Q_xpm ), QPixmap( (const char**)del_Q_xpm )); bops_toolbar->addSeparator(); delete_red_but = new QToolButton(bops_toolbar, "Boolean operations"); delete_red_but->setAutoRaise(TRUE); delete_red_but->setIconSet(set11); delete_red_but->setTextLabel("Delete Red Polygons"); connect(delete_red_but,SIGNAL(pressed()), this, SLOT(delete_red_polygons())); *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor (CGAL::BLACK); resize(w,h); widget->set_window(-1, 1, -1, 1); widget->setMouseTracking(TRUE); //connect the widget to the main function that receives the objects connect(widget, SIGNAL(new_cgal_object(CGAL::Object)), this, SLOT(get_new_object(CGAL::Object))); //application flag stuff old_state = 0; current_state = 1; red_active = false; red_set.clear(); blue_set.clear(); res_set.clear(); }
void Portal::construct_actions() { m_open_action = new QAction( Svg_icon( ":/icons/open.svg", this->iconSize() ), tr("&Open"), this); m_open_action->setShortcut(tr("Ctrl+F")); m_open_action->setStatusTip(tr("Open an existing file")); connect(m_open_action, SIGNAL(triggered()), this, SLOT(open())); m_close_action = new QAction( Svg_icon( ":/icons/close.svg", this->iconSize() ), tr("&Close"), this); m_close_action->setShortcut(tr("Ctrl+F4")); m_close_action->setStatusTip(tr("Close window")); connect(m_close_action, SIGNAL(triggered()), this, SLOT(close())); m_help_action = new QAction( Svg_icon( ":/icons/help_book.svg", this->iconSize() ), tr("&Help"), this); m_help_action->setShortcut(tr("F1")); m_help_action->setStatusTip(tr("Help me out there!")); connect(m_help_action, SIGNAL(triggered()), this, SLOT(help())); m_exit_action = new QAction( Svg_icon( ":/icons/exit.svg", this->iconSize() ), tr("E&xit"), this); m_exit_action->setStatusTip(tr("Exit application")); connect(m_exit_action, SIGNAL(triggered()), (QApplication*)QApplication::instance(), SLOT(closeAllWindows())); m_tile_action = new QAction( Svg_icon( ":/icons/tile_horiz.svg", this->iconSize() ), tr("&Tile"), this); m_tile_action->setStatusTip(tr("Tile windows")); connect(m_tile_action, SIGNAL(triggered()), m_workspace, SLOT(tile())); m_cascade_action = new QAction( Svg_icon( ":/icons/cascade.svg", this->iconSize() ), tr("&Cascade"), this); m_cascade_action->setStatusTip(tr("Cascade windows")); connect(m_cascade_action, SIGNAL(triggered()), m_workspace, SLOT(cascade())); m_flat_action = new QAction( Svg_icon( ":/icons/flat.svg", this->iconSize() ), tr("&Flat"), this ); m_flat_action->setCheckable( true ); m_flat_action->setChecked( false ); m_flat_action->setStatusTip(tr("Flat shading")); connect( m_flat_action, SIGNAL(toggled(bool)), this, SLOT(handle_glpad_command()) ); m_phong_action = new QAction( Svg_icon( ":/icons/phong.svg", this->iconSize() ), tr("&Phong"), this ); m_phong_action->setCheckable( true ); m_phong_action->setChecked( true ); m_phong_action->setStatusTip(tr("Phong shading")); connect( m_phong_action, SIGNAL(toggled(bool)), this, SLOT(handle_glpad_command()) ); m_wireframe_action = new QAction( Svg_icon( ":/icons/wireframe.svg", this->iconSize() ), tr("&Wireframe"), this ); m_wireframe_action->setCheckable( true ); m_wireframe_action->setChecked( false ); m_wireframe_action->setStatusTip(tr("Show wireframe")); connect( m_wireframe_action, SIGNAL(toggled(bool)), this, SLOT(handle_glpad_command()) ); m_center_action = new QAction( Svg_icon( ":/icons/center.svg", this->iconSize() ), tr("&Center"), this ); m_center_action->setObjectName(tr("center")); m_center_action->setStatusTip(tr("Center scene")); connect( m_center_action, SIGNAL(triggered()), this, SLOT(handle_glpad_command()) ); m_shading_actions = new QActionGroup(this); m_shading_actions->addAction( m_wireframe_action ); m_shading_actions->addAction( m_flat_action ); m_shading_actions->addAction( m_phong_action ); m_culling_action = new QAction( Svg_icon( ":/icons/culling.svg", this->iconSize() ), tr("&Back Face Culling"), this ); m_culling_action->setCheckable( true ); m_culling_action->setChecked( true ); m_culling_action->setStatusTip(tr("Toggle back-face culling")); connect( m_culling_action, SIGNAL(toggled(bool)), this, SLOT(handle_glpad_command()) ); m_texture_action = new QAction( Svg_icon( ":/icons/texture.svg", this->iconSize() ), tr("&Texture Rendering"), this ); m_texture_action->setCheckable( true ); m_texture_action->setChecked( true ); m_texture_action->setStatusTip(tr("Toggle texture rendering")); connect( m_texture_action, SIGNAL(toggled(bool)), this, SLOT(handle_glpad_command()) ); }