void DlgSettingsMainWindow::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsMainWindow::handleOk"; CmdSettingsMainWindow *cmd = new CmdSettingsMainWindow (mainWindow (), cmdMediator ().document(), *m_modelMainWindowBefore, *m_modelMainWindowAfter); cmdMediator ().push (cmd); hide (); }
void DlgSettingsPointMatch::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsPointMatch::handleOk"; CmdSettingsPointMatch *cmd = new CmdSettingsPointMatch (mainWindow (), cmdMediator ().document(), *m_modelPointMatchBefore, *m_modelPointMatchAfter); cmdMediator ().push (cmd); hide (); }
void surfacemesh_mode_arapdeform::create() { if(!widget) { ModePluginDockWidget * dockwidget = new ModePluginDockWidget("As-rigid-as-possible deformation", mainWindow()); widget = new arap_widget(this); dockwidget->setWidget(widget); mainWindow()->addDockWidget(Qt::RightDockWidgetArea,dockwidget); } update(); }
void Global::openPreferencesDialog() { // Create preferences dialog if(!preferencesDialog_) { preferencesDialog_ = new SettingsDialog(mainWindow()); connect(preferencesDialog_, SIGNAL(preferencesChanged()), this, SLOT(updateWidgetValuesFromPreferences())); } // Update and show references dialog preferencesDialog_->go(); }
void DlgSettingsDigitizeCurve::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsDigitizeCurve::handleOk"; CmdSettingsDigitizeCurve *cmd = new CmdSettingsDigitizeCurve (mainWindow (), cmdMediator ().document(), *m_modelDigitizeCurveBefore, *m_modelDigitizeCurveAfter); cmdMediator ().push (cmd); hide (); }
/*! Any actions that can be delayed until the window is visible */ void BrowserApplication::postLaunch() { QString directory = QDesktopServices::storageLocation(QDesktopServices::DataLocation); if (directory.isEmpty()) directory = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); QWebSettings::setIconDatabasePath(directory); setWindowIcon(QIcon(QLatin1String(":arora-128.png"))); loadSettings(); // newMainWindow() needs to be called in main() for this to happen if (m_mainWindows.count() > 0) { QStringList args = QCoreApplication::arguments(); if (args.count() > 1) mainWindow()->loadPage(args.last()); else mainWindow()->slotHome(); } BrowserApplication::historyManager(); }
void kpTool::endDrawInternal (const QPoint &thisPoint, const QRect &normalizedRect, bool wantEndShape) { #if DEBUG_KP_TOOL && 1 kdDebug () << "kpTool::endDrawInternal() wantEndShape=" << wantEndShape << endl; #endif if (wantEndShape && !hasBegunShape ()) return; else if (!wantEndShape && !hasBegunDraw ()) return; m_beganDraw = false; if (wantEndShape) { #if DEBUG_KP_TOOL && 0 kdDebug () << "\tcalling endShape()" << endl; #endif endShape (thisPoint, normalizedRect); } else { #if DEBUG_KP_TOOL && 0 kdDebug () << "\tcalling endDraw()" << endl; #endif endDraw (thisPoint, normalizedRect); } m_viewUnderStartPoint = 0; emit endedDraw (m_currentPoint); if (viewUnderCursor ()) hover (m_currentPoint); else { m_currentPoint = KP_INVALID_POINT; m_currentViewPoint = KP_INVALID_POINT; hover (m_currentPoint); } if (returnToPreviousToolAfterEndDraw ()) { kpToolToolBar *tb = mainWindow ()->toolToolBar (); // (don't end up with no tool selected) if (tb->previousTool ()) { // endInternal() will be called by kpMainWindow (thanks to this line) // so we won't have the view anymore tb->selectPreviousTool (); } } }
void Action::setExecutor(ActionExecutor::Object executor) { const ActionsManager::ActionDefinition definition(getDefinition()); const QMetaMethod updateStateMethod(metaObject()->method(metaObject()->indexOfMethod("updateState()"))); const QMetaMethod handleArbitraryActionsStateChangedMethod(metaObject()->method(metaObject()->indexOfMethod("handleArbitraryActionsStateChanged(QVector<int>)"))); const QMetaMethod handleCategorizedActionsStateChangeddMethod(metaObject()->method(metaObject()->indexOfMethod("handleCategorizedActionsStateChanged(QVector<int>)"))); if (m_executor.isValid()) { m_executor.disconnectSignals(this, &updateStateMethod, &handleArbitraryActionsStateChangedMethod, &handleCategorizedActionsStateChangeddMethod); } if (executor.isValid()) { switch (definition.scope) { case ActionsManager::ActionDefinition::MainWindowScope: if (!executor.getObject()->inherits("Otter::Application") && !executor.getObject()->inherits("Otter::MainWindow")) { MainWindow *mainWindow(MainWindow::findMainWindow(executor.getObject())); if (mainWindow) { executor = ActionExecutor::Object(mainWindow, mainWindow); } else { executor = ActionExecutor::Object(); } } break; case ActionsManager::ActionDefinition::ApplicationScope: if (!executor.getObject()->inherits("Otter::Application")) { executor = ActionExecutor::Object(Application::getInstance(), Application::getInstance()); } break; default: break; } } m_executor = executor; updateState(); if (executor.isValid()) { m_executor.connectSignals(this, &updateStateMethod, &handleArbitraryActionsStateChangedMethod, &handleCategorizedActionsStateChangeddMethod); } }
void DlgSettingsExportFormat::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::handleOk"; CmdSettingsExportFormat *cmd = new CmdSettingsExportFormat (mainWindow (), cmdMediator ().document(), *m_modelExportBefore, *m_modelExportAfter); cmdMediator ().push (cmd); hide (); }
void DlgSettingsColorFilter::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsColorFilter::handleOk"; CmdSettingsColorFilter *cmd = new CmdSettingsColorFilter (mainWindow (), cmdMediator ().document(), *m_modelColorFilterBefore, *m_modelColorFilterAfter); cmdMediator ().push (cmd); hide (); }
bool KateCTagsView::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast<QKeyEvent*>(event); if ((obj == m_toolView) && (ke->key() == Qt::Key_Escape)) { mainWindow()->hideToolView(m_toolView); event->accept(); return true; } } return QObject::eventFilter(obj, event); }
//! [0] int main(int argv, char *args[]) { TabletApplication app(argv, args); TabletCanvas *canvas = new TabletCanvas; app.setCanvas(canvas); MainWindow mainWindow(canvas); mainWindow.resize(500, 500); mainWindow.show(); return app.exec(); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); ATCPaths paths; ATCFlightFactory *flightFactory = new ATCFlightFactory(paths); MainWindow mainWindow(flightFactory); mainWindow.show(); return a.exec(); }
void DlgSettingsExportFormat::updatePreview() { // Save the scroll position for continuity before and after the preview update int scrollPosition = m_editPreview->verticalScrollBar()->value(); QString exportedText; QTextStream str (&exportedText); if (mainWindow().transformation().transformIsDefined()) { // Transformaiton is defined so we can create a preview if (m_tabWidget->currentIndex() == TAB_WIDGET_INDEX_FUNCTIONS) { ExportFileFunctions exportStrategy; exportStrategy.exportToFile (*m_modelExportAfter, cmdMediator().document(), mainWindow().modelMainWindow(), mainWindow().transformation(), str); } else { ExportFileRelations exportStrategy; exportStrategy.exportToFile (*m_modelExportAfter, cmdMediator().document(), mainWindow().modelMainWindow(), mainWindow().transformation(), str); } } else { str << "Preview is unavailable until axis points are defined."; } m_editPreview->setText (exportedText); // Restore scroll position m_editPreview->verticalScrollBar()->setValue (scrollPosition); }
void QtUi::minimizeRestore(bool show) { SystemTray *tray = mainWindow()->systemTray(); if (show) { if (tray && !_useSystemTray) tray->setVisible(false); } else { if (tray && _useSystemTray) tray->setVisible(true); } GraphicalUi::minimizeRestore(show); }
FileSelectorPart::FileSelectorPart(QObject *parent, const char *name, const QStringList &) : KDevPlugin(&data, parent, name ? name : "FileSelectorPart") { setInstance(FileSelectorFactory::instance()); m_filetree = new KDevFileSelector( this, mainWindow(), partController(), 0, "fileselectorwidget" ); connect( m_filetree->dirOperator(), SIGNAL(fileSelected(const KFileItem*)), this, SLOT(fileSelected(const KFileItem*))); connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) ); connect( core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget(KDialogBase*)) ); m_filetree->setCaption( i18n("File Selector") ); m_filetree->setIcon( SmallIcon( info()->icon() ) ); mainWindow()->embedSelectView( m_filetree, i18n("File Selector"), i18n("File selector") ); QWhatsThis::add(m_filetree, i18n("<b>File selector</b><p>This file selector lists directory contents and provides some file management functions.")); m_filetree->readConfig( instance()->config(), "fileselector" ); m_newFileAction = new KAction(i18n("New File..."), CTRL+ALT+SHIFT+Key_N, this, SLOT(newFile()), this); }
int main(int argc, char *argv[]) { int exec; QApplication app(argc, argv); //redirect debug messages to the MessageWindow dialog qInstallMsgHandler(MessageWindow::AppendMsgWrapper); MainWindow mainWindow(APP_TITLE); mainWindow.show(); exec = app.exec(); return exec; }
int runGui(Arguments & args) { if (! args.getFilters().isEmpty()) { fatal(QObject::tr( "Point destination or remove filters arguments.")); } MainWindow mainWindow(args.getSource()); mainWindow.show(); return qApp->exec(); }
QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { Q_UNUSED(type); if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) m_openInNewTab = true; if (m_openInNewTab) { m_openInNewTab = false; return mainWindow()->tabWidget()->newTab()->page(); } BrowserApplication::instance()->newMainWindow(); BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); return mainWindow->currentTab()->page(); }
//************************************************************************** // ATopicServer :: conversationEnded(..) //************************************************************************** void ATopicServer :: conversationEnded(unsigned long conversationId, IDDEEndEvent& endEvt) { if (endEvt.sourceOfEnd() == IDDEEndEvent::server) mainWindow()->log( //Log this message with IString(resLib.loadString( MI_END_CONV ))+//member function name IString(conversationId)+ // conversation ID IString(resLib.loadString( MI_BY_SERVER ))); // by the Server else if (endEvt.sourceOfEnd() == IDDEEndEvent::client) mainWindow()->log( //Log this message IString(resLib.loadString( MI_END_CONV ))+//member function name IString(conversationId)+ // conversation ID IString(resLib.loadString( MI_BY_CLIENT ))); // by the Client else mainWindow()->log( //Log this message IString(resLib.loadString( MI_END_CONV2 ))+//member function name IString(conversationId)+ // conversation ID IString(resLib.loadString( MI_BY_ERROR ))); // due to an error } /* end ATopicServer :: conversationEnded(..) */
ibool polyDemo(MGLDC *dc) /**************************************************************************** * * Function: polyDemo * Parameters: dc - Device context * * Description: Display a random pattern of polygons on the screen with * random fill styles. * ****************************************************************************/ { int i,maxx,maxy,val; fxpoint_t poly[MAXPTS]; /* Space to hold polygon data */ mainWindow(dc,"MGL_fillPolygon Demonstration"); statusLine("Press any key to continue, ESC to Abort"); maxx = MGL_maxx(); maxy = MGL_maxy(); while (!checkEvent()) { /* Define a random polygon */ for (i = 0; i < MAXPTS; i++) { poly[i].x = MGL_randoml(MGL_TOFIX(maxx)); poly[i].y = MGL_randoml(MGL_TOFIX(maxy)); } MGL_setColor(randomColor()); MGL_setBackColor(randomColor()); if ((val = MGL_random(3)) == 0) { MGL_setPenStyle(MGL_BITMAP_TRANSPARENT); MGL_setPenBitmapPattern(0,&bitpat[MGL_random(NUMPATS)+1]); MGL_usePenBitmapPattern(0); } else if (val == 1) { MGL_setPenStyle(MGL_BITMAP_OPAQUE); MGL_setPenBitmapPattern(0,&bitpat[MGL_random(NUMPATS)+1]); MGL_usePenBitmapPattern(0); } else { MGL_setPenStyle(MGL_BITMAP_SOLID); } MGL_fillPolygonFX(MAXPTS,poly,sizeof(fxpoint_t),0,0); } defaultAttributes(dc); return pause(); }
void Updater::downloadXmlFinished(QIODevice* data, bool error) { closeLoadingPopup(); if (error) { QMessageBox::critical(mainWindow(), tr("Update Error"), QString("Error Code: %1").arg(m_binaryDownloader->lastResponse().statusCode()) + "\n" + m_binaryDownloader->errorString()); return; } data->open(QIODevice::ReadOnly); parseXml(data->readAll()); data->close(); if (isAvailable()) { #if defined(Q_OS_WIN32) int result = QMessageBox::information(mainWindow(), tr("Check for Updates"), tr("A new version, <b>") + m_versionStr + tr(" </b>is available to download.<br/>Would you like to download it?"), QMessageBox::Ok, QMessageBox::Cancel); #elif defined(Q_OS_LINUX) int result = QMessageBox::information(mainWindow(), tr("Check for Updates"), tr("A new version, <b>") + m_versionStr + tr(" </b>is available to download.<br/>Please go to http://code.google.com/p/monkeylogviewer to get it."), QMessageBox::Ok, QMessageBox::Cancel); #endif switch (result) { case QMessageBox::Ok: #if defined(Q_OS_WIN32) startDownloadBinary(); #elif defined(Q_OS_LINUX) QDesktopServices::openUrl(QUrl(m_webPage)); #endif break; case QMessageBox::Cancel: break; } } else { QMessageBox::information(mainWindow(), tr("Check for Updates"), tr("This version is latest.")); } }
void CmdCut::cmdRedo () { LOG4CPP_INFO_S ((*mainCat)) << "CmdCut::cmdRedo"; MimePoints *mimePoints; if (m_transformIsDefined) { mimePoints = new MimePoints (m_csv, m_html); } else { mimePoints = new MimePoints (m_csv); } QClipboard *clipboard = QApplication::clipboard(); clipboard->setMimeData (mimePoints, QClipboard::Clipboard); saveOrCheckPreCommandDocumentStateHash (document ()); saveDocumentState (document ()); document().removePointsInCurvesGraphs (m_curvesGraphsRemoved); document().updatePointOrdinals (mainWindow().transformation()); mainWindow().updateAfterCommand(); saveOrCheckPostCommandDocumentStateHash (document ()); }
bool BrowserApplication::event(QEvent* event) { switch (event->type()) { case QEvent::ApplicationActivate: { clean(); if (!m_mainWindows.isEmpty()) { BrowserMainWindow *mw = mainWindow(); if (mw && !mw->isMinimized()) { mainWindow()->show(); } return true; } } case QEvent::FileOpen: if (!m_mainWindows.isEmpty()) { mainWindow()->loadPage(static_cast<QFileOpenEvent *>(event)->file()); return true; } default: break; } return QApplication::event(event); }
void DlgSettingsSegments::updatePreview() { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsSegments::updatePreview" << " loading=" << (m_loading ? "true" : "false"); const QString ARBITRARY_IDENTIFIER (""); const QColor COLOR (Qt::blue); const int RADIUS = 5; if (!m_loading) { SegmentFactory segmentFactory (*m_scenePreview, mainWindow().isGnuplot()); clearPoints(); segmentFactory.clearSegments (m_segments); // Create new segments segmentFactory.makeSegments (createPreviewImage(), *m_modelSegmentsAfter, m_segments); // Make the segment visible QList<Segment*>::iterator itrS; for (itrS = m_segments.begin(); itrS != m_segments.end(); itrS++) { Segment *segment = *itrS; segment->slotHover (true); } // Create some points PointStyle pointStyle (POINT_SHAPE_CROSS, RADIUS, BRUSH_WIDTH, COLOR_PALETTE_BLUE); QPolygonF polygon = pointStyle.polygon(); QList<QPoint> points = segmentFactory.fillPoints (*m_modelSegmentsAfter, m_segments); QList<QPoint>::iterator itrP; for (itrP = points.begin(); itrP != points.end(); itrP++) { QPoint pos = *itrP; GraphicsPoint *graphicsPoint = new GraphicsPoint (*m_scenePreview, ARBITRARY_IDENTIFIER, pos, COLOR, polygon, BRUSH_WIDTH); m_points.push_back (graphicsPoint); } } }
void VideoPlayerTab::load(const QString& file) { ui_video->load(Phonon::MediaSource(file)); ui_seek->setMediaObject(ui_video->mediaObject()); ui_volume->setAudioOutput(ui_video->audioOutput()); connect(ui_video->mediaObject(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChange(Phonon::State, Phonon::State))); ui_video->mediaObject()->play(); if(ui_video->mediaObject()->errorType() != Phonon::NoError) { MessageDialog::showError(mainWindow(), "simple_error", QStringList() << QString("Unable to load ") + file << ui_video->mediaObject()->errorString()); } }
void gui_mode::enterState(STATE state, QAction* action /*=NULL*/){ switch(state){ case DEFAULT: // qDebug() << "[DEFAULT]"; Q_ASSERT(lastActiveModeAction==NULL); Q_ASSERT(!mainWindow()->hasModePlugin()); foreach(QAction* action, modeActionGroup->actions()) action->setEnabled(true); defaultModeAction->setChecked(true); defaultModeAction->setEnabled(false); break; case MODE: // qDebug() << "[MODE]"; Q_ASSERT(mainWindow()->hasModePlugin()); foreach(QAction* action, modeActionGroup->actions()) action->setEnabled(false); defaultModeAction->setEnabled(true); defaultModeAction->setChecked(false); action->setEnabled(true); action->setChecked(true); break; case SUSPENDED: // qDebug() << "[SUSPENDED]"; Q_ASSERT(mainWindow()->hasModePlugin()); Q_ASSERT(lastActiveModeAction!=NULL); foreach(QAction* action, modeActionGroup->actions()) action->setEnabled(false); defaultModeAction->setChecked(true); defaultModeAction->setEnabled(true); lastActiveModeAction->setChecked(true); lastActiveModeAction->setEnabled(false); break; } /// Finally update state this->state = state; }
int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("EPFL-LSRO-Mobots"); QCoreApplication::setOrganizationDomain("mobots.epfl.ch"); QCoreApplication::setApplicationName("ControlMapsViewer"); QGst::init(nullptr, nullptr); QApplication app(argc, argv); // specify the setup type SetupType::Enum setupType = SetupType::MAIN_CAMERA; // parse input arguments to initialize the settings if (CommandLineParameters::get().init(argc, argv, true, false, false)) { CoordinatesConversionPtr coordinatesConversion; // check that the calibration settings are valid if (CalibrationSettings::get().init(CommandLineParameters::get().configurationFilePath(), setupType)) { // create the camera calibration coordinatesConversion = CoordinatesConversionPtr(new CoordinatesConversion(CalibrationSettings::get().calibrationFilePath(setupType), CalibrationSettings::get().frameSize(setupType))); } GrabberHandlerPtr grabberHandler; if (CommandLineParameters::get().cameraDescriptor(setupType).isValid()){ bool needTargetFrameSize = false; if (GrabberSettings::get().init(CommandLineParameters::get().configurationFilePath(), setupType, needTargetFrameSize)) { grabberHandler = GrabberHandlerPtr(new GrabberHandler(setupType)); if (ViewerSettings::get().init(CommandLineParameters::get().configurationFilePath(), setupType)){ // initialize the robot controller settings if ((RobotControlSettings::get().init(CommandLineParameters::get().configurationFilePath()))) { MainWindow mainWindow(setupType, grabberHandler->inputQueue(), coordinatesConversion); mainWindow.show(); return app.exec(); } else { qDebug() << "Could not initialize the robot controllers"; return false; } } } else { qDebug() << "Grabber settings are not defined"; } } else { qDebug() << "Camera descriptor is ill-defined"; } } else { qDebug() << "Couldn't find necessary input arguments, finished"; } }
void BrowserApplication::newLocalSocketConnection() { QLocalSocket *socket = m_localServer->nextPendingConnection(); if (!socket) return; socket->waitForReadyRead(1000); QTextStream stream(socket); QString url; stream >> url; if (!url.isEmpty()) { QSettings settings; settings.beginGroup(QLatin1String("general")); int openLinksIn = settings.value(QLatin1String("openLinksIn"), 0).toInt(); settings.endGroup(); if (openLinksIn == 1) newMainWindow(); else mainWindow()->tabWidget()->newTab(); openUrl(url); } delete socket; mainWindow()->raise(); mainWindow()->activateWindow(); }
void DlgSettingsGridRemoval::handleOk () { LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsGridRemoval::handleOk"; // Set the stable flag m_modelGridRemovalAfter->setStable (); CmdSettingsGridRemoval *cmd = new CmdSettingsGridRemoval (mainWindow (), cmdMediator ().document(), *m_modelGridRemovalBefore, *m_modelGridRemovalAfter); cmdMediator ().push (cmd); hide (); }