void OlvisExecGuiPlugin::initialize(const QString& pluginDir) { OlvisSingleton::setInstance(*mInterface); PluginContainer& plugins = PluginContainer::getInstance(); plugins.loadPlugins(pluginDir + "/olvisGuiPlugins"); // give only const& to gui elements const OlvisInterface& model = *mInterface; toolbar = new MainToolBar(model); videoWidget = new VideoWidget(); if(mHilec){ connect(mHilec, SIGNAL(videoCaptureStartRequested(int,int)), videoWidget, SLOT(startCapture(int,int))); connect(mHilec, SIGNAL(videoCaptureEndRequested(QString,int)), videoWidget, SLOT(endCapture(QString,int))); connect(mHilec, SIGNAL(saveScreenshotRequested(QString,int)), videoWidget, SLOT(saveScreenshot(QString,int))); } connect(toolbar, SIGNAL(setNumDisplays(int)), videoWidget, SLOT(updateMaxDisplays(int)), Qt::QueuedConnection); connect(toolbar, SIGNAL(restoreRequested()), SLOT(restore())); connect(toolbar, SIGNAL(saveRequested()), SLOT(save())); toolbar->setEnabled(false); videoWidget->setEnabled(false); }
EditorMainWindow::EditorMainWindow(QWidget *parent) : QMainWindow(parent) { camera_ = 0; ui.setupUi(this); QApplication::connect(ui.action_Open, SIGNAL(triggered()), this, SLOT(openRequested())); QApplication::connect(ui.action_Save, SIGNAL(triggered()), this, SLOT(saveRequested())); QApplication::connect(ui.actionDerive_map, SIGNAL(triggered()), this, SLOT(deriveMap())); QApplication::connect(ui.action_Quit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); QApplication::connect(ui.actionZoom_In, SIGNAL(triggered()), this, SLOT(zoominRequested())); QApplication::connect(ui.actionZoom_Out, SIGNAL(triggered()), this, SLOT(zoomoutRequested())); QApplication::connect(ui.horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(horzScroll(int))); QApplication::connect(ui.verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vertScroll(int))); QApplication::connect(ui.actionRotate_Left, SIGNAL(triggered()), this, SLOT(rotateLeft())); QApplication::connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(rotateRight())); QApplication::connect(ui.actionTilt_Up, SIGNAL(triggered()), this, SLOT(tiltUp())); QApplication::connect(ui.actionTilt_Down, SIGNAL(triggered()), this, SLOT(tiltDown())); QApplication::connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(undo())); QApplication::connect(ui.actionRedo, SIGNAL(triggered()), this, SLOT(redo())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this), SIGNAL(activated()), this, SLOT(saveRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_O),this), SIGNAL(activated()), this, SLOT(openRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Z),this), SIGNAL(activated()), this, SLOT(zoominRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_X),this), SIGNAL(activated()), this, SLOT(zoomoutRequested())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left),this), SIGNAL(activated()), this, SLOT(rotateLeft())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right),this), SIGNAL(activated()), this, SLOT(rotateRight())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up),this), SIGNAL(activated()), this, SLOT(tiltUp())); QApplication::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down),this), SIGNAL(activated()), this, SLOT(tiltDown())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Left),this), SIGNAL(activated()), this, SLOT(panLeft())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Right),this), SIGNAL(activated()), this, SLOT(panRight())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Up),this), SIGNAL(activated()), this, SLOT(panUp())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_Down),this), SIGNAL(activated()), this, SLOT(panDown())); ui.action_Save->setEnabled(false); ui.editorGLWidget->setEnabled(false); QToolButton* party_button = new QToolButton(); party_button->setText("Parties"); party_button->setCheckable(true); party_button->setChecked(false); handlers_.push_back(new TerrainHandler(*this, "party", false, tool_buttons_.size())); QApplication::connect(party_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_P),this), SIGNAL(activated()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(party_button); tool_buttons_.push_back(party_button); QToolButton* height_button = new QToolButton(); height_button->setText("Height"); height_button->setCheckable(true); height_button->setChecked(true); handlers_.push_back(new TerrainHandler(*this, "", false, tool_buttons_.size())); QApplication::connect(height_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); QApplication::connect(new QShortcut(QKeySequence(Qt::Key_H),this), SIGNAL(activated()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(height_button); tool_buttons_.push_back(height_button); QToolButton* picker_button = new QToolButton(); picker_button->setText("Picker"); picker_button->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, "", true, tool_buttons_.size())); QApplication::connect(picker_button, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(picker_button); tool_buttons_.push_back(picker_button); std::vector<std::string> terrain_ids; hex::base_terrain::get_terrain_ids(terrain_ids); for(int n = 0; n != terrain_ids.size(); ++n) { QToolButton* b = new QToolButton(); b->setText(hex::base_terrain::get(terrain_ids[n])->name().c_str()); b->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, terrain_ids[n], false, tool_buttons_.size())); QApplication::connect(b, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(b); tool_buttons_.push_back(b); } terrain_ids.clear(); hex::terrain_feature::get_feature_ids(terrain_ids); for(int n = 0; n != terrain_ids.size(); ++n) { QToolButton* b = new QToolButton(); b->setText(hex::terrain_feature::get(terrain_ids[n])->name().c_str()); b->setCheckable(true); handlers_.push_back(new TerrainHandler(*this, terrain_ids[n], true, tool_buttons_.size())); QApplication::connect(b, SIGNAL(pressed()), handlers_.back(), SLOT(terrainSelected())); ui.tilesToolBar->addWidget(b); tool_buttons_.push_back(b); } }
void BooksSaveTimer::onAboutToQuit() { if (saveRequested()) { saveNow(); } }