void menuWindow::sPrepareWindowMenu() { _windowMenu->clear(); if (! _parent->showTopLevel()) { _windowMenu->addAction(_data->_cascade); _windowMenu->addAction(_data->_tile); _windowMenu->addSeparator(); } _windowMenu->addAction(_data->_closeActive); _windowMenu->addAction(_data->_closeAll); QWidgetList windows = _parent->windowList(); bool b; if(_preferences->value("InterfaceWindowOption") != "TopLevel") { b = windows.isEmpty(); } else { b = !windows.isEmpty(); } _data->_cascade->setEnabled(b); _data->_tile->setEnabled(b); _data->_closeActive->setEnabled(b); _data->_closeAll->setEnabled(b); _windowMenu->addSeparator(); if (_parent->showTopLevel()) _data->_lastActive = QApplication::activeWindow(); else if (_parent->workspace() && _parent->workspace()->activeSubWindow()) _data->_lastActive = _parent->workspace()->activeSubWindow()->widget(); else _data->_lastActive = 0; if (_data->_lastActive) { if(!_data->_geometryMenu) _data->_geometryMenu = new QMenu(); _data->_geometryMenu->clear(); _data->_geometryMenu->setTitle(_data->_lastActive->windowTitle()); QString objName = _data->_lastActive->objectName(); _data->_rememberPos->setChecked(xtsettingsValue(objName + "/geometry/rememberPos", true).toBool()); _data->_geometryMenu->addAction(_data->_rememberPos); _data->_rememberSize->setChecked(xtsettingsValue(objName + "/geometry/rememberSize", true).toBool()); _data->_geometryMenu->addAction(_data->_rememberSize); _windowMenu->addMenu(_data->_geometryMenu); _windowMenu->addSeparator(); } QAction *m = 0; foreach (QWidget *wind, windows) { m = _windowMenu->addAction(wind->windowTitle(), this, SLOT(sActivateWindow())); if(m) { m->setData(qVariantFromValue(wind)); m->setCheckable(true); m->setChecked((_data->_lastActive == wind)); } }
void SourceTreeView::setupMenus() { m_playlistMenu.clear(); m_roPlaylistMenu.clear(); m_latchMenu.clear(); m_privacyMenu.clear(); bool readonly = true; SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt(); if ( type == SourcesModel::StaticPlaylist || type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station ) { PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex ); playlist_ptr playlist = item->playlist(); if ( !playlist.isNull() ) { readonly = !playlist->author()->isLocal(); } } QAction* latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); m_latchMenu.addAction( latchOnAction ); m_privacyMenu.addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) ); if ( type == SourcesModel::Collection ) { SourceItem* item = itemFromIndex< SourceItem >( m_contextMenuIndex ); source_ptr source = item->source(); if ( !source.isNull() ) { if ( m_latchManager->isLatched( source ) ) { QAction *latchOffAction = ActionCollection::instance()->getAction( "latchOff" ); m_latchMenu.addAction( latchOffAction ); connect( latchOffAction, SIGNAL( triggered() ), SLOT( latchOff() ) ); m_latchMenu.addSeparator(); QAction *latchRealtimeAction = ActionCollection::instance()->getAction( "realtimeFollowingAlong" ); latchRealtimeAction->setChecked( source->playlistInterface()->latchMode() == Tomahawk::PlaylistInterface::RealTime ); m_latchMenu.addAction( latchRealtimeAction ); connect( latchRealtimeAction, SIGNAL( toggled( bool ) ), SLOT( latchModeToggled( bool ) ) ); } } } QAction *loadPlaylistAction = ActionCollection::instance()->getAction( "loadPlaylist" ); m_playlistMenu.addAction( loadPlaylistAction ); QAction *renamePlaylistAction = ActionCollection::instance()->getAction( "renamePlaylist" ); m_playlistMenu.addAction( renamePlaylistAction ); m_playlistMenu.addSeparator(); QAction *copyPlaylistAction = m_playlistMenu.addAction( tr( "&Copy Link" ) ); QAction *deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) ); QString addToText = QString( "Add to my %1" ); if ( type == SourcesModel::StaticPlaylist ) addToText = addToText.arg( "Playlists" ); if ( type == SourcesModel::AutomaticPlaylist ) addToText = addToText.arg( "Automatic Playlists" ); else if ( type == SourcesModel::Station ) addToText = addToText.arg( "Stations" ); QAction *addToLocalAction = m_roPlaylistMenu.addAction( tr( addToText.toUtf8(), "Adds the given playlist, dynamic playlist, or station to the users's own list" ) ); m_roPlaylistMenu.addAction( copyPlaylistAction ); deletePlaylistAction->setEnabled( !readonly ); renamePlaylistAction->setEnabled( !readonly ); addToLocalAction->setEnabled( readonly ); if ( type == SourcesModel::StaticPlaylist ) copyPlaylistAction->setText( tr( "&Export Playlist" ) ); connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) ); connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) ); connect( deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) ); connect( copyPlaylistAction, SIGNAL( triggered() ), SLOT( copyPlaylistLink() ) ); connect( addToLocalAction, SIGNAL( triggered() ), SLOT( addToLocal() ) ); connect( latchOnAction, SIGNAL( triggered() ), SLOT( latchOnOrCatchUp() ), Qt::QueuedConnection ); }
MainWindow::MainWindow(QStringList filesnames, int viewasked, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); C = new Core(); #if defined(_WIN32) && defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP) //Setup UI for winRT setMenuBar(new QMenuBar(0)); #else setWindowTitle("MediaInfo"); #endif settings = new QSettings("MediaArea.net", "MediaInfo"); defaultSettings(); applySettings(); if( (viewasked>=0) && (viewasked<NB_VIEW) ) view=ViewMode(viewasked); else view = (ViewMode)settings->value("defaultView",VIEW_EASY).toInt(); #if defined(_WIN32) && defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP) //Setup UI for winRT addToolBar(Qt::LeftToolBarArea, ui->toolBar); ui->toolBar->setFloatable(false); ui->toolBar->setMovable(false); ui->menuBar->hide(); #endif //tests ui->actionQuit->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); ui->actionClose_All->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton)); ui->actionOpen->setIcon(QIcon(":/icon/openfile.svg")); ui->actionOpen_Folder->setIcon(QIcon(":/icon/opendir.svg")); ui->actionAbout->setIcon(QIcon(":/icon/about.svg")); ui->actionExport->setIcon(QIcon(":/icon/export.svg")); menuView = new QMenu(); QActionGroup* menuItemGroup = new QActionGroup(this); for(int v=VIEW_EASY;v<NB_VIEW;v++) { QAction* action = new QAction(nameView((ViewMode)v), menuItemGroup); action->setCheckable(true); if(view==v) action->setChecked(true); action->setProperty("view",v); ui->menuView->addAction(action); menuView->addAction(action); } connect(menuItemGroup,SIGNAL(triggered(QAction*)),this,SLOT(actionView_toggled(QAction*))); buttonView = new QToolButton(); buttonView->setText("view"); buttonView->setIcon(QIcon(":/icon/view.svg")); connect(buttonView, SIGNAL(clicked()), this, SLOT(buttonViewClicked())); ui->toolBar->addWidget(buttonView); ui->toolBar->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->toolBar,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(toolBarOptions(QPoint))); connect(ui->toolBar,SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),buttonView,SLOT(setToolButtonStyle(Qt::ToolButtonStyle))); timer=NULL; progressDialog=NULL; refreshDisplay(); if(filesnames.count()>0) { openFiles(filesnames); } /* qDebug() << "0.7 " << "0.7.5 " << isNewer("0.7","0.7.5"); qDebug() << "0.7.4 " << "0.7.5 " << isNewer("0.7.4","0.7.5"); qDebug() << "0.7.5 " << "0.7.4 " << isNewer("0.7.5","0.7.4"); qDebug() << "0.7.4 " << "0.7 " << isNewer("0.7.4","0.7"); qDebug() << "0.7.5 " << "0.7.5 " << isNewer("0.7.5","0.7.5"); */ #ifdef NEW_VERSION if(settings->value("checkForNewVersion",true).toBool()) { checkForNewVersion(); } #endif }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void tAutopilotSelectedDeviceMenu::AddDevice( const tN2kName& name, bool selected, bool enabled ) { QString nameStr = tGlobal<tNDP2k>::Instance()->DeviceManager().DataSourceStr( name ); //DbgPrintf( QString("AddDevice nameStr=%1 value=%2").arg( nameStr ).arg( quint64( name.llValue() ) ) ); if( nameStr == "???" ) // incase the simnet selection is a device we have never seen... { // Get Simnet Nmea2k DevTag instead unsigned char devTag[16] = ""; // DEV_TAG_CHARS if( SystemData::bGetDevTag( (unsigned char*)name.ToByteArray().data(), 0, devTag ) ) { nameStr = QString((char *)devTag); } } bool insertDevice = false; // Sort names into order of decreasing name QList<tAction*> actionList = SubActions(); int i; for( i = 0; i < actionList.size(); ++i ) { quint64 nameInList = quint64( actionList[i]->data().toLongLong() ); //DbgPrintf( QString("AddDevice: index=%1 nameInList=%2").arg( i ).arg( nameInList ) ); if ( nameInList > 0 ) //If it's not one of the fixed items at the top or a separator { if( quint64( name.llValue() ) == nameInList ) { //Already in list - just update //DbgPrintf( "Device already in list" ); QAction* pAction = actionList[i]; pAction->setText( nameStr ); if ( pAction->isCheckable() ) { pAction->setChecked( selected ); } return; } else if( quint64( name.llValue() ) > nameInList ) { DbgPrintf( "Name greater than nameInList" ); insertDevice = true; break; } } } tAction* pAction = new tAction( nameStr, this ); pAction->setCheckable( true ); pAction->setChecked( selected ); pAction->setData( QVariant( name.llValue() ) ); pAction->setEnabled( enabled ); if( insertDevice ) { DbgPrintf( QString("Inserting action at index %1").arg( i ) ); InsertAction( actionList[i], pAction ); } else // Append { DbgPrintf( QString("Adding action %1").arg( nameStr ) ); AddAction( pAction ); } m_SelectDeviceActGroup.append( pAction ); Connect( pAction, SIGNAL( triggered( bool ) ), this, SLOT( SelectDevice( bool ) ) ); }
QMenu* ObjectWidget::createPopupMenu() { QMenu* menu = new QMenu(tr("&Object")); QAction* action; action = menu->addAction(QIcon(":/icons/page_copy.png"), tr("&Copy")); action->setShortcut(QKeySequence(QKeySequence::Copy)); action->setStatusTip(tr("Copy the current selection's contents or view to the clipboard")); connect(action, SIGNAL(triggered()), this, SLOT(copy())); menu->addSeparator(); QMenu* subMenu = menu->addMenu(tr("&Drag and Drop")); action = subMenu->menuAction(); action->setIcon(QIcon(":/icons/DragPlane.png")); action->setStatusTip(tr("Select the drag and drop dynamics mode and plane along which operations are performed")); QActionGroup* actionGroup = new QActionGroup(subMenu); QSignalMapper* signalMapper = new QSignalMapper(subMenu); connect(signalMapper, SIGNAL(mapped(int)), SLOT(setDragPlane(int))); action = subMenu->addAction(tr("X/Y Plane")); actionGroup->addAction(action); signalMapper->setMapping(action, XY_PLANE); action->setShortcut(QKeySequence(Qt::Key_Z)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("X/Z Plane")); actionGroup->addAction(action); signalMapper->setMapping(action, XZ_PLANE); action->setShortcut(QKeySequence(Qt::Key_Y)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Y/Z Plane")); actionGroup->addAction(action); signalMapper->setMapping(action, YZ_PLANE); action->setShortcut(QKeySequence(Qt::Key_X)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getDragPlane()))->setChecked(true); subMenu->addSeparator(); actionGroup = new QActionGroup(subMenu); signalMapper = new QSignalMapper(subMenu); connect(signalMapper, SIGNAL(mapped(int)), SLOT(setDragMode(int))); action = subMenu->addAction(tr("&Keep Dynamics")); actionGroup->addAction(action); signalMapper->setMapping(action, KEEP_DYNAMICS); action->setShortcut(QKeySequence(Qt::Key_8)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&Reset Dynamics")); actionGroup->addAction(action); signalMapper->setMapping(action, RESET_DYNAMICS); action->setShortcut(QKeySequence(Qt::Key_9)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&Apply Dynamics")); actionGroup->addAction(action); signalMapper->setMapping(action, APPLY_DYNAMICS); action->setShortcut(QKeySequence(Qt::Key_0)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getDragMode()))->setChecked(true); menu->addSeparator(); subMenu = menu->addMenu(tr("&Camera")); action = subMenu->menuAction(); action->setIcon(QIcon(":/icons/camera.png")); action->setStatusTip(tr("Select different camera modes for displaying the scene")); actionGroup = new QActionGroup(subMenu); signalMapper = new QSignalMapper(subMenu); connect(signalMapper, SIGNAL(mapped(int)), SLOT(setCameraMode(int))); action = subMenu->addAction(tr("&Target Mode")); action->setCheckable(true); actionGroup->addAction(action); signalMapper->setMapping(action, VisualizationParameterSet::TARGETCAM); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&Free Mode")); action->setCheckable(true); actionGroup->addAction(action); signalMapper->setMapping(action, VisualizationParameterSet::FREECAM); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&Presentation Mode")); action->setCheckable(true); actionGroup->addAction(action); signalMapper->setMapping(action, VisualizationParameterSet::PRESENTATION); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getCameraMode()))->setChecked(true); subMenu->addSeparator(); action = subMenu->addAction(tr("&Reset")); action->setShortcut(QKeySequence(Qt::Key_R)); connect(action, SIGNAL(triggered()), this, SLOT(resetCamera())); action = subMenu->addAction(tr("&Toggle")); action->setShortcut(QKeySequence(Qt::Key_T)); connect(action, SIGNAL(triggered()), this, SLOT(toggleCameraMode())); action = subMenu->addAction(tr("&Fit")); action->setShortcut(QKeySequence(Qt::Key_F)); connect(action, SIGNAL(triggered()), this, SLOT(fitCamera())); subMenu->addSeparator(); action = subMenu->addAction(tr("&Snap To Root")); action->setCheckable(true); action->setChecked(objectRenderer.hasSnapToRoot()); connect(action, SIGNAL(triggered()), this, SLOT(snapToRoot())); subMenu = menu->addMenu(tr("&Vertical Opening Angle")); action = subMenu->menuAction(); action->setIcon(QIcon(":/icons/opening_angle.png")); actionGroup = new QActionGroup(subMenu); signalMapper = new QSignalMapper(subMenu); connect(signalMapper, SIGNAL(mapped(int)), SLOT(setFovY(int))); action = subMenu->addAction(tr("&20°")); actionGroup->addAction(action); signalMapper->setMapping(action, 20); action->setShortcut(QKeySequence(Qt::Key_1)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&40°")); actionGroup->addAction(action); signalMapper->setMapping(action, 40); action->setShortcut(QKeySequence(Qt::Key_2)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&60°")); actionGroup->addAction(action); signalMapper->setMapping(action, 60); action->setShortcut(QKeySequence(Qt::Key_3)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("&80°")); actionGroup->addAction(action); signalMapper->setMapping(action, 80); action->setShortcut(QKeySequence(Qt::Key_4)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("100°")); actionGroup->addAction(action); signalMapper->setMapping(action, 100); action->setShortcut(QKeySequence(Qt::Key_5)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("120°")); actionGroup->addAction(action); signalMapper->setMapping(action, 120); action->setShortcut(QKeySequence(Qt::Key_6)); action->setCheckable(true); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getFovY()))->setChecked(true); subMenu = menu->addMenu(tr("&Surface Rendering")); actionGroup = new QActionGroup(subMenu); signalMapper = new QSignalMapper(subMenu); connect(signalMapper, SIGNAL(mapped(int)), SLOT(setSurfaceStyle(int))); action = subMenu->menuAction(); action->setIcon(QIcon(":/icons/layers.png")); action->setStatusTip(tr("Select different rendering techniques for displaying the scene")); action = subMenu->addAction(tr("Appearance &Wire Frame")); actionGroup->addAction(action); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::WIREFRAME); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Appearance &Flat Shading")); actionGroup->addAction(action); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::FLAT_SHADING); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Appearance &Smooth Shading")); actionGroup->addAction(action); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::SMOOTH_SHADING); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Appearance &Texture Shading")); actionGroup->addAction(action); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T)); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::TEXTURE_SHADING); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Appearance &Camera Simulation")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::CAMERA_SIMULATION); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); subMenu->addSeparator(); action = subMenu->addAction(tr("Physics &Wire Frame")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::PHYSICS_WIREFRAME); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Physics &Flat Shading")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::PHYSICS_FLAT); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Physics &Smooth Shading")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::PHYSICS_SMOOTH); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); subMenu->addSeparator(); action = subMenu->addAction(tr("Mixed Mode &1 (Shaded Physics)")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::MIXED_PHYSICS); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); action = subMenu->addAction(tr("Mixed Mode &2 (Shaded Appearance)")); actionGroup->addAction(action); action->setCheckable(true); signalMapper->setMapping(action, VisualizationParameterSet::MIXED_APPEARANCE); connect(action, SIGNAL(triggered()), signalMapper, SLOT(map())); qobject_cast<QAction*>(signalMapper->mapping(objectRenderer.getSurfaceStyle()))->setChecked(true); menu->addSeparator(); if(!showSensorsAct) { showSensorsAct = new QAction(QIcon(":/icons/transmit_go.png"), tr("Show &Sensors"), this); showSensorsAct->setStatusTip(tr("Show the values of the sensors in the scene view")); showSensorsAct->setCheckable(true); showSensorsAct->setChecked(objectRenderer.hasShowDetailSensors()); connect(showSensorsAct, SIGNAL(triggered()), this, SLOT(showDetailSensors())); } menu->addAction(showSensorsAct); if(!showDrawingsAct) { showDrawingsAct = new QAction(QIcon(":/icons/chart_line.png"), tr("Show Controller &Drawings"), this); showDrawingsAct->setStatusTip(tr("Show the controller 3D drawings in the scene view")); showDrawingsAct->setCheckable(true); showDrawingsAct->setChecked(objectRenderer.hasShowControllerDrawings()); connect(showDrawingsAct, SIGNAL(triggered()), this, SLOT(showControllerDrawings())); } menu->addAction(showDrawingsAct); return menu; }
/** Initializes the action objects of the GUI */ void BibleTime::initActions() { m_actionCollection = new BtActionCollection(this); insertKeyboardActions(m_actionCollection); // Create the window to signal mapper and connect it up: m_windowMapper = new QSignalMapper(this); BT_CONNECT(m_windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(slotSetActiveSubWindow(QWidget *))); // File menu actions: m_openWorkAction = new BtOpenWorkAction("GUI/mainWindow/openWorkAction/grouping", this); BT_CONNECT(m_openWorkAction, SIGNAL(triggered(CSwordModuleInfo *)), this, SLOT(createReadDisplayWindow(CSwordModuleInfo *))); m_quitAction = &m_actionCollection->action("quit"); m_quitAction->setMenuRole(QAction::QuitRole); BT_CONNECT(m_quitAction, SIGNAL(triggered()), this, SLOT(quit())); // View menu actions: m_windowFullscreenAction = &m_actionCollection->action("toggleFullscreen"); m_windowFullscreenAction->setCheckable(true); BT_CONNECT(m_windowFullscreenAction, SIGNAL(triggered()), this, SLOT(toggleFullscreen())); // Special case these actions, overwrite those already in collection m_showBookshelfAction = m_bookshelfDock->toggleViewAction(); m_showBookshelfAction->setIcon(CResMgr::mainMenu::view::showBookshelf::icon()); m_showBookshelfAction->setToolTip(tr("Toggle visibility of the bookshelf window")); m_actionCollection->removeAction("showBookshelf"); m_actionCollection->addAction("showBookshelf", m_showBookshelfAction); m_showBookmarksAction = m_bookmarksDock->toggleViewAction(); m_showBookmarksAction->setIcon(CResMgr::mainMenu::view::showBookmarks::icon()); m_showBookmarksAction->setToolTip(tr("Toggle visibility of the bookmarks window")); m_actionCollection->removeAction("showBookmarks"); m_actionCollection->addAction("showBookmarks", m_showBookmarksAction); m_showMagAction = m_magDock->toggleViewAction(); m_showMagAction->setIcon(CResMgr::mainMenu::view::showMag::icon()); m_showMagAction->setToolTip(tr("Toggle visibility of the mag window")); m_actionCollection->removeAction("showMag"); m_actionCollection->addAction("showMag", m_showMagAction); m_showTextAreaHeadersAction = &m_actionCollection->action("showParallelTextHeaders"); m_showTextAreaHeadersAction->setCheckable(true); m_showTextAreaHeadersAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowHeaders", true)); BT_CONNECT(m_showTextAreaHeadersAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleTextWindowHeader())); m_showMainWindowToolbarAction = &m_actionCollection->action("showToolbar"); m_showMainWindowToolbarAction->setCheckable(true); m_showMainWindowToolbarAction->setChecked(btConfig().sessionValue<bool>("GUI/showMainToolbar", true)); BT_CONNECT(m_showMainWindowToolbarAction, SIGNAL(triggered()), this, SLOT(slotToggleMainToolbar())); m_showTextWindowNavigationAction = &m_actionCollection->action("showNavigation"); m_showTextWindowNavigationAction->setCheckable(true); m_showTextWindowNavigationAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowNavigator", true)); BT_CONNECT(m_showTextWindowNavigationAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleNavigatorToolbar())); m_showTextWindowModuleChooserAction = &m_actionCollection->action("showWorks"); m_showTextWindowModuleChooserAction->setCheckable(true); m_showTextWindowModuleChooserAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowModuleSelectorButtons", true)); BT_CONNECT(m_showTextWindowModuleChooserAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleWorksToolbar())); m_showTextWindowToolButtonsAction = &m_actionCollection->action("showTools"); m_showTextWindowToolButtonsAction->setCheckable(true); m_showTextWindowToolButtonsAction->setChecked(btConfig().sessionValue<bool>("GUI/showTextWindowToolButtons", true)); BT_CONNECT(m_showTextWindowToolButtonsAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleToolsToolbar())); m_showFormatToolbarAction = &m_actionCollection->action("showFormat"); m_showFormatToolbarAction->setCheckable(true); m_showFormatToolbarAction->setChecked(btConfig().sessionValue<bool>("GUI/showFormatToolbarButtons", true)); BT_CONNECT(m_showFormatToolbarAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFormatToolbar())); m_toolbarsInEachWindow = &m_actionCollection->action("showToolbarsInTextWindows"); m_toolbarsInEachWindow->setCheckable(true); m_toolbarsInEachWindow->setChecked(btConfig().sessionValue<bool>("GUI/showToolbarsInEachWindow", true)); BT_CONNECT(m_toolbarsInEachWindow, SIGNAL(toggled(bool)), this, SLOT(slotToggleToolBarsInEachWindow())); // Search menu actions: m_searchOpenWorksAction = &m_actionCollection->action("searchOpenWorks"); BT_CONNECT(m_searchOpenWorksAction, SIGNAL(triggered()), this, SLOT(slotSearchModules())); m_searchStandardBibleAction = &m_actionCollection->action("searchStdBible"); BT_CONNECT(m_searchStandardBibleAction, SIGNAL(triggered()), this, SLOT(slotSearchDefaultBible())); // Window menu actions: m_windowCloseAction = &m_actionCollection->action("closeWindow"); BT_CONNECT(m_windowCloseAction, SIGNAL(triggered()), m_mdi, SLOT(closeActiveSubWindow())); m_windowCloseAllAction = &m_actionCollection->action("closeAllWindows"); BT_CONNECT(m_windowCloseAllAction, SIGNAL(triggered()), m_mdi, SLOT(closeAllSubWindows())); m_windowCascadeAction = &m_actionCollection->action("cascade"); BT_CONNECT(m_windowCascadeAction, SIGNAL(triggered()), this, SLOT(slotCascade())); m_windowTileAction = &m_actionCollection->action("tile"); BT_CONNECT(m_windowTileAction, SIGNAL(triggered()), this, SLOT(slotTile())); m_windowTileVerticalAction = &m_actionCollection->action("tileVertically"); BT_CONNECT(m_windowTileVerticalAction, SIGNAL(triggered()), this, SLOT(slotTileVertical())); m_windowTileHorizontalAction = &m_actionCollection->action("tileHorizontally"); BT_CONNECT(m_windowTileHorizontalAction, SIGNAL(triggered()), this, SLOT(slotTileHorizontal())); alignmentMode alignment = btConfig().sessionValue<alignmentMode>("GUI/alignmentMode", autoTileVertical); m_windowManualModeAction = &m_actionCollection->action("manualArrangement"); m_windowManualModeAction->setCheckable(true); m_windowAutoTabbedAction = &m_actionCollection->action("autoTabbed"); m_windowAutoTabbedAction->setCheckable(true); //: Vertical tiling means that windows are vertical, placed side by side m_windowAutoTileVerticalAction = &m_actionCollection->action("autoVertical"); m_windowAutoTileVerticalAction->setCheckable(true); //: Horizontal tiling means that windows are horizontal, placed on top of each other m_windowAutoTileHorizontalAction = &m_actionCollection->action("autoHorizontal"); m_windowAutoTileHorizontalAction->setCheckable(true); m_windowAutoTileAction = &m_actionCollection->action("autoTile"); m_windowAutoTileAction->setCheckable(true); m_windowAutoCascadeAction = &m_actionCollection->action("autoCascade"); m_windowAutoCascadeAction->setCheckable(true); /* * All actions related to arrangement modes have to be initialized before calling a slot on them, * thus we call them afterwards now. */ QAction * alignmentAction; switch (alignment) { case autoTabbed: alignmentAction = m_windowAutoTabbedAction; break; case autoTileVertical: alignmentAction = m_windowAutoTileVerticalAction; break; case autoTileHorizontal: alignmentAction = m_windowAutoTileHorizontalAction; break; case autoTile: alignmentAction = m_windowAutoTileAction; break; case autoCascade: alignmentAction = m_windowAutoCascadeAction; break; case manual: default: alignmentAction = m_windowManualModeAction; break; } alignmentAction->setChecked(true); slotUpdateWindowArrangementActions(alignmentAction); m_windowSaveToNewProfileAction = &m_actionCollection->action("saveNewSession"); BT_CONNECT(m_windowSaveToNewProfileAction, SIGNAL(triggered()), this, SLOT(saveToNewProfile())); m_setPreferencesAction = &m_actionCollection->action("setPreferences"); m_setPreferencesAction->setMenuRole( QAction::PreferencesRole ); BT_CONNECT(m_setPreferencesAction, SIGNAL(triggered()), this, SLOT(slotSettingsOptions())); m_bookshelfWizardAction = &m_actionCollection->action("bookshelfWizard"); m_bookshelfWizardAction->setMenuRole( QAction::ApplicationSpecificRole ); BT_CONNECT(m_bookshelfWizardAction, SIGNAL(triggered()), this, SLOT(slotBookshelfWizard())); m_openHandbookAction = &m_actionCollection->action("openHandbook"); BT_CONNECT(m_openHandbookAction, SIGNAL(triggered()), this, SLOT(openOnlineHelp_Handbook())); m_bibleStudyHowtoAction = &m_actionCollection->action("bibleStudyHowto"); BT_CONNECT(m_bibleStudyHowtoAction, SIGNAL(triggered()), this, SLOT(openOnlineHelp_Howto())); m_aboutBibleTimeAction = &m_actionCollection->action("aboutBibleTime"); m_aboutBibleTimeAction->setMenuRole( QAction::AboutRole ); BT_CONNECT(m_aboutBibleTimeAction, SIGNAL(triggered()), this, SLOT(slotOpenAboutDialog()) ); m_tipOfTheDayAction = &m_actionCollection->action("tipOfTheDay"); BT_CONNECT(m_tipOfTheDayAction, SIGNAL(triggered()), this, SLOT(slotOpenTipDialog()) ); #ifndef NDEBUG m_debugWidgetAction = new QAction(this); m_debugWidgetAction->setCheckable(true); BT_CONNECT(m_debugWidgetAction, &QAction::triggered, this, &BibleTime::slotShowDebugWindow); #endif retranslateUiActions(m_actionCollection); }
//////////////////////////////////////////////////////////////////////////////// /// CChanceTreeView::setupToolBar /// /// @description This function initializes the toolbar that is used for the /// tree view. /// @pre None /// @post The tree view toolbar is initialized. /// /// @limitations None /// //////////////////////////////////////////////////////////////////////////////// void CChanceTreeView::setupToolBar() { QAction *tempAction; QLabel *tempLabel; QToolButton *tempButton; // Create toolbar. m_toolBar = new QToolBar( "Puzzle View", this ); tempAction = m_toolBar->addAction( QIcon(":/toggleminmaxheuristics.png"), "Toggle min/max heuristic values" ); tempAction->setCheckable( true ); tempAction->setChecked( true ); connect( tempAction, SIGNAL(toggled(bool)), m_graphView, SLOT(toggleMinMaxHeuristics(bool)) ); tempAction = m_toolBar->addAction( QIcon(":/togglechanceheuristics.png"), "Toggle chance heuristic values" ); tempAction->setCheckable( true ); tempAction->setChecked( true ); connect( tempAction, SIGNAL(toggled(bool)), m_graphView, SLOT(toggleChanceHeuristics(bool)) ); // "Reorient View" button tempAction = m_toolBar->addAction( QIcon(":/orient.png"), "Reorient view" ); connect( tempAction, SIGNAL(activated()), this, SLOT(switchOrientation()) ); // "Show Graph" toggle button tempAction = m_toolBar->addAction( QIcon(":/graph.png"), "Show Graph" ); tempAction->setCheckable( true ); tempAction->setChecked( true ); connect( tempAction, SIGNAL(toggled(bool)), m_graphView, SLOT(setShown(bool)) ); // "Show Trace" toggle button tempAction = m_toolBar->addAction(QIcon(":/trace.png"), "Show Trace" ); tempAction->setCheckable( true ); tempAction->setChecked( true ); connect( tempAction, SIGNAL(toggled(bool)), m_traceView, SLOT(setShown(bool)) ); m_toolBar->addSeparator(); // "Quick Edit Mode" toggle button m_quickEditAction = m_toolBar->addAction(QIcon(":/quickedit.png"), "Toggle Quick Edit Mode" ); m_quickEditAction->setCheckable( true ); m_quickEditAction->setChecked( false ); connect( m_quickEditAction, SIGNAL(toggled(bool)), m_graphView, SLOT(setQuickEdit(bool)) ); // "Generate Tree" button tempAction = m_toolBar->addAction(QIcon(":/graph.png"), "Generate Tree" ); connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(generateTree()) ); // "Auto Name" button tempAction = m_toolBar->addAction(QIcon(":/autoname.png"), "Auto Name" ); connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoName()) ); // "Auto Number" button tempAction = m_toolBar->addAction(QIcon(":/autonumber.png"), "Auto Number" ); connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoNumber()) ); // "Auto Layout" button tempAction = m_toolBar->addAction(QIcon(":/autolayout.png"), "Auto Layout"); connect( tempAction, SIGNAL(activated()), m_graphView, SLOT(autoLayout()) ); m_toolBar->addSeparator(); m_toolBar->addSeparator(); // "AI Config Menu" button m_toolBar->addWidget(m_traceView->getAIConfigButton()); // AI Label tempLabel = m_traceView->getAILabel(); m_toolBar->addWidget( tempLabel ); // Depth spinbox tempLabel = new QLabel( m_toolBar ); tempLabel->setTextFormat(Qt::AutoText); tempLabel->setText( " Depth" ); m_toolBar->addWidget( tempLabel ); m_toolBar->addWidget( m_traceView->getDepthSelector() ); // QS Depth spinbox tempLabel = new QLabel( m_toolBar ); tempLabel->setText( " QS Depth" ); m_toolBar->addWidget( tempLabel ); m_toolBar->addWidget( m_traceView->getQSDepthSelector() ); // Lower Bound spinbox tempLabel = new QLabel( m_toolBar ); tempLabel->setText( " Lower Bound" ); m_toolBar->addWidget( tempLabel ); m_toolBar->addWidget( m_traceView->getLowerBoundSelector() ); // Upper Bound spinbox tempLabel = new QLabel( m_toolBar ); tempLabel->setText( " Upper Bound" ); m_toolBar->addWidget( tempLabel ); m_toolBar->addWidget( m_traceView->getUpperBoundSelector() ); // "Save Trace" button tempAction = m_toolBar->addAction(QIcon(":/latex.png"), "Save Trace"); connect( tempAction, SIGNAL(activated()), m_traceView, SLOT(saveTrace()) ); }
Reviews::Reviews( QWidget * parent, Okular::Document * document ) : QWidget( parent ), m_document( document ) { // create widgets and layout them vertically QVBoxLayout * vLayout = new QVBoxLayout( this ); vLayout->setMargin( 0 ); vLayout->setSpacing( 6 ); m_view = new TreeView( m_document, this ); m_view->setAlternatingRowColors( true ); m_view->setSelectionMode( QAbstractItemView::ExtendedSelection ); m_view->header()->hide(); QToolBar *toolBar = new QToolBar( this ); toolBar->setObjectName( QLatin1String( "reviewOptsBar" ) ); QSizePolicy sp = toolBar->sizePolicy(); sp.setVerticalPolicy( QSizePolicy::Minimum ); toolBar->setSizePolicy( sp ); m_model = new AnnotationModel( m_document, m_view ); m_filterProxy = new PageFilterProxyModel( m_view ); m_groupProxy = new PageGroupProxyModel( m_view ); m_authorProxy = new AuthorGroupProxyModel( m_view ); m_filterProxy->setSourceModel( m_model ); m_groupProxy->setSourceModel( m_filterProxy ); m_authorProxy->setSourceModel( m_groupProxy ); m_view->setModel( m_authorProxy ); m_searchLine = new KTreeViewSearchLine( this, m_view ); m_searchLine->setCaseSensitivity( Okular::Settings::self()->reviewsSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive ); m_searchLine->setRegularExpression( Okular::Settings::self()->reviewsSearchRegularExpression() ); connect( m_searchLine, SIGNAL(searchOptionsChanged()), this, SLOT(saveSearchOptions()) ); vLayout->addWidget( m_searchLine ); vLayout->addWidget( m_view ); vLayout->addWidget( toolBar ); toolBar->setIconSize( QSize( 16, 16 ) ); toolBar->setMovable( false ); // - add Page button QAction * groupByPageAction = toolBar->addAction( KIcon( "text-x-generic" ), i18n( "Group by Page Hello World!" ) ); groupByPageAction->setCheckable( true ); connect( groupByPageAction, SIGNAL(toggled(bool)), this, SLOT(slotPageEnabled(bool)) ); groupByPageAction->setChecked( Okular::Settings::groupByPage() ); // - add Author button QAction * groupByAuthorAction = toolBar->addAction( KIcon( "user-identity" ), i18n( "Group by Author Hello World!" ) ); groupByAuthorAction->setCheckable( true ); connect( groupByAuthorAction, SIGNAL(toggled(bool)), this, SLOT(slotAuthorEnabled(bool)) ); groupByAuthorAction->setChecked( Okular::Settings::groupByAuthor() ); // - add separator toolBar->addSeparator(); // - add Current Page Only button QAction * curPageOnlyAction = toolBar->addAction( KIcon( "arrow-down" ), i18n( "Show reviews for current page only" ) ); curPageOnlyAction->setCheckable( true ); connect( curPageOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotCurrentPageOnly(bool)) ); curPageOnlyAction->setChecked( Okular::Settings::currentPageOnly() ); connect( m_view, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)) ); m_view->setContextMenuPolicy( Qt::CustomContextMenu ); connect( m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)) ); }
GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotation, bool useOffset, QWidget* parent): QWidget(parent), m_monitor(info->monitor), m_timePos(new TimecodeDisplay(info->monitor->timecode())), m_clipPos(clipPos), m_inPoint(0), m_outPoint(1), m_previous(NULL), m_geometry(NULL), m_frameSize(info->frameSize), m_fixedGeom(false), m_singleKeyframe(false), m_useOffset(useOffset) { m_ui.setupUi(this); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect); connect(m_monitor, &Monitor::effectPointsChanged, this, &GeometryWidget::slotUpdateCenters, Qt::UniqueConnection); /* Setup of timeline and keyframe controls */ ((QGridLayout *)(m_ui.widgetTimeWrapper->layout()))->addWidget(m_timePos, 1, 5); QVBoxLayout *layout = new QVBoxLayout(m_ui.frameTimeline); m_timeline = new KeyframeHelper(m_ui.frameTimeline); layout->addWidget(m_timeline); layout->setContentsMargins(0, 0, 0, 0); int size = style()->pixelMetric(QStyle::PM_SmallIconSize); QSize iconSize(size, size); m_ui.buttonPrevious->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-backward"))); m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe")); m_ui.buttonPrevious->setIconSize(iconSize); m_ui.buttonNext->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-forward"))); m_ui.buttonNext->setToolTip(i18n("Go to next keyframe")); m_ui.buttonNext->setIconSize(iconSize); m_ui.buttonAddDelete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add"))); m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe")); m_ui.buttonAddDelete->setIconSize(iconSize); connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int))); connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int))); connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int))); connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged())); connect(m_ui.buttonPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe())); connect(m_ui.buttonNext, SIGNAL(clicked()), this, SLOT(slotNextKeyframe())); connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe())); m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinX, 0, 0); m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinY, 0, 1); m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2); m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3); m_ui.horizontalLayout->setColumnStretch(4, 10); QMenu *menu = new QMenu(this); QAction *originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this); connect(originalSize, SIGNAL(triggered()), this, SLOT(slotAdjustToSource())); QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust and center in frame"), this); connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize())); QAction *fitToWidth = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-width")), i18n("Fit to width"), this); connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth())); QAction *fitToHeight = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-height")), i18n("Fit to height"), this); connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight())); QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this); connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes())); menu->addAction(importKeyframes); QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this); connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes())); menu->addAction(resetKeyframes); QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this); connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes())); menu->addAction(resetNextKeyframes); QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this); connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes())); menu->addAction(resetPreviousKeyframes); menu->addSeparator(); QAction *syncTimeline = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-link")), i18n("Synchronize with timeline cursor"), this); syncTimeline->setCheckable(true); syncTimeline->setChecked(KdenliveSettings::transitionfollowcursor()); connect(syncTimeline, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool))); menu->addAction(syncTimeline); QAction *alignleft = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-left")), i18n("Align left"), this); connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft())); QAction *alignhcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-hor")), i18n("Center horizontally"), this); connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH())); QAction *alignright = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-right")), i18n("Align right"), this); connect(alignright, SIGNAL(triggered()), this, SLOT(slotMoveRight())); QAction *aligntop = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-top")), i18n("Align top"), this); connect(aligntop, SIGNAL(triggered()), this, SLOT(slotMoveTop())); QAction *alignvcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-vert")), i18n("Center vertically"), this); connect(alignvcenter, SIGNAL(triggered()), this, SLOT(slotCenterV())); QAction *alignbottom = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-bottom")), i18n("Align bottom"), this); connect(alignbottom, SIGNAL(triggered()), this, SLOT(slotMoveBottom())); m_ui.buttonOptions->setMenu(menu); m_ui.buttonOptions->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure"))); m_ui.buttonOptions->setToolTip(i18n("Options")); m_ui.buttonOptions->setIconSize(iconSize); QHBoxLayout *alignLayout = new QHBoxLayout; alignLayout->setSpacing(0); QToolButton *alignButton = new QToolButton; alignButton->setDefaultAction(alignleft); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignhcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignright); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(aligntop); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignvcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignbottom); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(originalSize); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(adjustSize); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToWidth); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToHeight); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignLayout->addStretch(10); m_ui.horizontalLayout->addLayout(alignLayout, 1, 0, 1, 4); //m_ui.horizontalLayout->addStretch(10); m_spinSize = new DragValue(i18n("Size"), 100, 2, 1, 99000, -1, i18n("%"), false, this); m_ui.horizontalLayout2->addWidget(m_spinSize); m_opacity = new DragValue(i18n("Opacity"), 100, 0, 0, 100, -1, i18n("%"), true, this); m_ui.horizontalLayout2->addWidget(m_opacity); if (showRotation) { m_rotateX = new DragValue(i18n("Rotate X"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateX->setObjectName(QStringLiteral("rotate_x")); m_ui.horizontalLayout3->addWidget(m_rotateX); m_rotateY = new DragValue(i18n("Rotate Y"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateY->setObjectName(QStringLiteral("rotate_y")); m_ui.horizontalLayout3->addWidget(m_rotateY); m_rotateZ = new DragValue(i18n("Rotate Z"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateZ->setObjectName(QStringLiteral("rotate_z")); m_ui.horizontalLayout3->addWidget(m_rotateZ); connect(m_rotateX, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateY, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateZ, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); } /* Setup of geometry controls */ connect(m_spinX, SIGNAL(valueChanged(double)), this, SLOT(slotSetX(double))); connect(m_spinY, SIGNAL(valueChanged(double)), this, SLOT(slotSetY(double))); connect(m_spinWidth, SIGNAL(valueChanged(double)), this, SLOT(slotSetWidth(double))); connect(m_spinHeight, SIGNAL(valueChanged(double)), this, SLOT(slotSetHeight(double))); connect(m_spinSize, SIGNAL(valueChanged(double)), this, SLOT(slotResize(double))); connect(m_opacity, SIGNAL(valueChanged(double)), this, SLOT(slotSetOpacity(double))); /*connect(m_ui.buttonMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft())); connect(m_ui.buttonCenterH, SIGNAL(clicked()), this, SLOT(slotCenterH())); connect(m_ui.buttonMoveRight, SIGNAL(clicked()), this, SLOT(slotMoveRight())); connect(m_ui.buttonMoveTop, SIGNAL(clicked()), this, SLOT(slotMoveTop())); connect(m_ui.buttonCenterV, SIGNAL(clicked()), this, SLOT(slotCenterV())); connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));*/ /* Setup of configuration controls */ connect(m_monitor, SIGNAL(addKeyframe()), this, SLOT(slotAddKeyframe())); connect(m_monitor, SIGNAL(seekToKeyframe(int)), this, SLOT(slotSeekToKeyframe(int))); connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties())); }
void PlotDataFitFunctionWidget::tableContextMenu(const QPoint& pos) { PlotDataFitFunction* plotDataFitFunction = dynamic_cast<PlotDataFitFunction*>(processor_); const std::vector<Property*> properties = plotDataFitFunction->getProperties(); std::vector<bool> boolValues; for (size_t i = 0; i < properties.size(); ++i) { if (dynamic_cast<BoolProperty*>(properties[i])) { boolValues.push_back(static_cast<BoolProperty*>(properties[i])->get()); } } QModelIndex index = table_->indexAt(pos); contextMenuTable_->clear(); fittingFunctionMenu_->clear(); multiRegessionMenu_->clear(); splineFunctionMenu_->clear(); PlotData* data = const_cast<PlotData*>(plotDataFitFunction->getPlotData()); QAction* newAct; QList<QVariant>* qlist = new QList<QVariant>(); std::stringstream s; bool numberColumn = (data->getColumnType(index.column()) == PlotBase::NUMBER); plot_t minX = 1; //plot_t maxX = 1; plot_t minY = 1; plot_t maxY = 1; if (numberColumn) { AggregationFunctionMin* aggmin = new AggregationFunctionMin(); AggregationFunctionMax* aggmax = new AggregationFunctionMax(); minY = data->aggregate(index.column(),aggmin); maxY = data->aggregate(index.column(),aggmax); minX = data->aggregate(0,aggmin); //maxX = data->aggregate(0,aggmax); delete aggmin; delete aggmax; } s.str(""); s.clear(); s << "Ignore False Values"; newAct = new QAction(QString::fromStdString(s.str()),this); newAct->setCheckable(true); newAct->setChecked(boolValues[0]); contextMenuTable_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(ignoreFalseValues())); qlist->clear(); s.str(""); s.clear(); s << "Linear Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::LINEAR); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Square Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::SQUARE); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Cubic Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::CUBIC); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); for (int i = 4; i < 11; ++i) { s.str(""); s.clear(); s << i << "-Dimension Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::POLYNOMIAL); qlist->push_back(index.column()); qlist->push_back(i); newAct->setData(QVariant(*qlist)); multiRegessionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); } fittingFunctionMenu_->addMenu(multiRegessionMenu_); s.str(""); s.clear(); s << "Constant-Spline Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::CONSTANTSPLINE); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); splineFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Simple-Spline Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::SIMPLESPLINE); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); splineFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Square-Spline Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::SQUARESPLINE); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); splineFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Cubic-Spline Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::CUBICSPLINE); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); splineFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); splineFunctionMenu_->addSeparator(); s.str(""); s.clear(); s << "Power Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::POWER); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minX > 0 && minY > 0) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); fittingFunctionMenu_->addSeparator(); s.str(""); s.clear(); s << "SQRT Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::SQRT); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minX >= 0) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); fittingFunctionMenu_->addSeparator(); s.str(""); s.clear(); s << "Logarithmic Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::LOGARITHMIC); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minX > 0) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Exponential Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::EXPONENTIAL); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minY > 0) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Sin Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::SIN); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minY > -1 && maxY < 1) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Cos Regression"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::COS); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); if ((minY > -1 && maxY < 1) || boolValues[0]) fittingFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); s.str(""); s.clear(); s << "Lagrange-Interpolation"; newAct = new QAction(QString::fromStdString(s.str()),this); qlist->push_back(FunctionLibrary::INTERPOLATION); qlist->push_back(index.column()); newAct->setData(QVariant(*qlist)); splineFunctionMenu_->addAction(newAct); QObject::connect(newAct,SIGNAL(triggered()),this,SLOT(addFunction())); qlist->clear(); if (!numberColumn) { fittingFunctionMenu_->setEnabled(false); splineFunctionMenu_->setEnabled(false); multiRegessionMenu_->setEnabled(false); } else { fittingFunctionMenu_->setEnabled(true); splineFunctionMenu_->setEnabled(true); multiRegessionMenu_->setEnabled(true); } contextMenuTable_->addMenu(fittingFunctionMenu_); contextMenuTable_->addMenu(splineFunctionMenu_); contextMenuTable_->popup(table_->mapToGlobal(pos)); delete qlist; }
MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, NULL) { setWindowTitle("Debug: Memory View"); if (parent != NULL) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); } // // The main frame and its input and log widgets // QFrame* mainWindowFrame = new QFrame(this); // The top frame & groupbox that contains the input widgets QFrame* topSubFrame = new QFrame(mainWindowFrame); // The input edit m_inputEdit = new QLineEdit(topSubFrame); connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); // The memory space combo box m_memoryComboBox = new QComboBox(topSubFrame); m_memoryComboBox->setObjectName("memoryregion"); m_memoryComboBox->setMinimumWidth(300); connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); // The main memory window m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this); // Layout QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame); subLayout->addWidget(m_inputEdit); subLayout->addWidget(m_memoryComboBox); subLayout->setSpacing(3); subLayout->setContentsMargins(2,2,2,2); QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); vLayout->setSpacing(3); vLayout->setContentsMargins(2,2,2,2); vLayout->addWidget(topSubFrame); vLayout->addWidget(m_memTable); setCentralWidget(mainWindowFrame); // // Menu bars // // Create a byte-chunk group QActionGroup* chunkGroup = new QActionGroup(this); chunkGroup->setObjectName("chunkgroup"); QAction* chunkActOne = new QAction("1-byte chunks", this); chunkActOne->setObjectName("chunkActOne"); QAction* chunkActTwo = new QAction("2-byte chunks", this); chunkActTwo->setObjectName("chunkActTwo"); QAction* chunkActFour = new QAction("4-byte chunks", this); chunkActFour->setObjectName("chunkActFour"); chunkActOne->setCheckable(true); chunkActTwo->setCheckable(true); chunkActFour->setCheckable(true); chunkActOne->setActionGroup(chunkGroup); chunkActTwo->setActionGroup(chunkGroup); chunkActFour->setActionGroup(chunkGroup); chunkActOne->setShortcut(QKeySequence("Ctrl+1")); chunkActTwo->setShortcut(QKeySequence("Ctrl+2")); chunkActFour->setShortcut(QKeySequence("Ctrl+4")); chunkActOne->setChecked(true); connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*))); // Create a address display group QActionGroup* addressGroup = new QActionGroup(this); addressGroup->setObjectName("addressgroup"); QAction* addressActLogical = new QAction("Logical Addresses", this); QAction* addressActPhysical = new QAction("Physical Addresses", this); addressActLogical->setCheckable(true); addressActPhysical->setCheckable(true); addressActLogical->setActionGroup(addressGroup); addressActPhysical->setActionGroup(addressGroup); addressActLogical->setShortcut(QKeySequence("Ctrl+G")); addressActPhysical->setShortcut(QKeySequence("Ctrl+Y")); addressActLogical->setChecked(true); connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*))); // Create a reverse view radio QAction* reverseAct = new QAction("Reverse View", this); reverseAct->setObjectName("reverse"); reverseAct->setCheckable(true); reverseAct->setShortcut(QKeySequence("Ctrl+R")); connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool))); // Create increase and decrease bytes-per-line actions QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this); QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this); increaseBplAct->setShortcut(QKeySequence("Ctrl+P")); decreaseBplAct->setShortcut(QKeySequence("Ctrl+O")); connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool))); connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addActions(chunkGroup->actions()); optionsMenu->addSeparator(); optionsMenu->addActions(addressGroup->actions()); optionsMenu->addSeparator(); optionsMenu->addAction(reverseAct); optionsMenu->addSeparator(); optionsMenu->addAction(increaseBplAct); optionsMenu->addAction(decreaseBplAct); // // Initialize // populateComboBox(); // Set to the current CPU's memory view setToCurrentCpu(); }
HaveClip::HaveClip(QObject *parent) : QObject(parent) { Settings *s = Settings::create(this); connect(s, SIGNAL(firstStart()), this, SLOT(onFirstStart())); s->init(); manager = new ClipboardManager(this); connect(manager->history(), SIGNAL(historyChanged()), this, SLOT(updateHistory())); connect(manager->connectionManager(), SIGNAL(untrustedCertificateError(Node,QList<QSslError>)), this, SLOT(determineCertificateTrust(Node,QList<QSslError>))); connect(manager->connectionManager(), SIGNAL(sslFatalError(QList<QSslError>)), this, SLOT(sslFatalError(QList<QSslError>))); connect(manager->connectionManager(), SIGNAL(verificationRequested(Node)), this, SLOT(verificationRequest(Node))); historySignalMapper = new QSignalMapper(this); connect(historySignalMapper, SIGNAL(mapped(QObject*)), this, SLOT(historyActionClicked(QObject*))); // Tray #ifdef Q_OS_MAC trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_mac_tray.png"), this); #else trayIcon = new QSystemTrayIcon(QIcon(":/gfx/HaveClip_256.png"), this); #endif trayIcon->setToolTip(tr("HaveClip")); #ifndef Q_OS_MAC connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); #endif historyMenu = new QMenu(tr("History")); historySeparator = historyMenu->addSeparator(); menu = new QMenu; #if defined Q_OS_MAC menu->addMenu(historyMenu); menu->addSeparator(); #endif QAction *a = menu->addAction(tr("&Enable clipboard synchronization")); a->setCheckable(true); a->setChecked(manager->isSyncEnabled()); connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleSharedClipboard(bool))); clipSndAction = menu->addAction(tr("Enable clipboard se&nding")); clipSndAction->setCheckable(true); clipSndAction->setChecked(manager->isSendingEnabled()); clipSndAction->setEnabled(manager->isSyncEnabled()); connect(clipSndAction, SIGNAL(toggled(bool)), this, SLOT(toggleSend(bool))); clipRecvAction = menu->addAction(tr("Enable clipboard &receiving")); clipRecvAction->setCheckable(true); clipRecvAction->setChecked(manager->isReceivingEnabled()); clipRecvAction->setEnabled(manager->isSyncEnabled()); connect(clipRecvAction, SIGNAL(toggled(bool)), this, SLOT(toggleReceive(bool))); menu->addSeparator(); menu->addAction(tr("Synchronize clipboard"), this, SLOT(synchronizeClipboard())); menuSeparator = menu->addSeparator(); menu->addAction(tr("&Settings"), this, SLOT(showSettings())); menu->addAction(tr("&About..."), this, SLOT(showAbout())); menu->addAction(tr("&Quit"), qApp, SLOT(quit())); trayIcon->setContextMenu(menu); trayIcon->show(); qApp->setQuitOnLastWindowClosed(false); qApp->setWindowIcon(QIcon(":/gfx/HaveClip_256.png")); manager->start(); }
void ProgramWindow::setup() { if (parentWidget() == NULL) { resize(500,700); setAttribute(Qt::WA_DeleteOnClose, true); } QFrame * mainFrame = new QFrame(this); QFrame * headerFrame = createHeader(); QFrame * centerFrame = createCenter(); layout()->setMargin(0); layout()->setSpacing(0); QGridLayout *layout = new QGridLayout(mainFrame); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(headerFrame,0,0); layout->addWidget(centerFrame,1,0); setCentralWidget(mainFrame); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); QSettings settings; if (!settings.value("programwindow/state").isNull()) { restoreState(settings.value("programwindow/state").toByteArray()); } if (!settings.value("programwindow/geometry").isNull()) { restoreGeometry(settings.value("programwindow/geometry").toByteArray()); } installEventFilter(this); // Setup new menu bar for the programming window QMenuBar * menubar = NULL; if (parentWidget()) { QMainWindow * mainWindow = qobject_cast<QMainWindow *>(parentWidget()); if (mainWindow) menubar = mainWindow->menuBar(); } if (menubar == NULL) menubar = menuBar(); m_fileMenu = menubar->addMenu(tr("&File")); QAction *currentAction = new QAction(tr("New Code File"), this); currentAction->setShortcut(tr("Ctrl+N")); currentAction->setStatusTip(tr("Create a new program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(addTab())); m_fileMenu->addAction(currentAction); currentAction = new QAction(tr("&Open Code File..."), this); currentAction->setShortcut(tr("Ctrl+O")); currentAction->setStatusTip(tr("Open a program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(loadProgramFile())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); m_saveAction = new QAction(tr("&Save Code File"), this); m_saveAction->setShortcut(tr("Ctrl+S")); m_saveAction->setStatusTip(tr("Save the current program")); connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save())); m_fileMenu->addAction(m_saveAction); currentAction = new QAction(tr("Rename Code File"), this); currentAction->setStatusTip(tr("Rename the current program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(rename())); m_fileMenu->addAction(currentAction); currentAction = new QAction(tr("Duplicate tab"), this); currentAction->setStatusTip(tr("Copies the current program into a new tab")); connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); currentAction = new QAction(tr("Remove tab"), this); currentAction->setShortcut(tr("Ctrl+W")); currentAction->setStatusTip(tr("Remove the current program from the sketch")); connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); m_printAction = new QAction(tr("&Print..."), this); m_printAction->setShortcut(tr("Ctrl+P")); m_printAction->setStatusTip(tr("Print the current program")); connect(m_printAction, SIGNAL(triggered()), this, SLOT(print())); m_fileMenu->addAction(m_printAction); m_fileMenu->addSeparator(); currentAction = new QAction(tr("&Quit"), this); currentAction->setShortcut(tr("Ctrl+Q")); currentAction->setStatusTip(tr("Quit the application")); currentAction->setMenuRole(QAction::QuitRole); connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2())); m_fileMenu->addAction(currentAction); m_editMenu = menubar->addMenu(tr("&Edit")); m_undoAction = new QAction(tr("Undo"), this); m_undoAction->setShortcuts(QKeySequence::Undo); m_undoAction->setEnabled(false); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo())); m_editMenu->addAction(m_undoAction); m_redoAction = new QAction(tr("Redo"), this); m_redoAction->setShortcuts(QKeySequence::Redo); m_redoAction->setEnabled(false); connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo())); m_editMenu->addAction(m_redoAction); m_editMenu->addSeparator(); m_cutAction = new QAction(tr("&Cut"), this); m_cutAction->setShortcut(tr("Ctrl+X")); m_cutAction->setStatusTip(tr("Cut selection")); m_cutAction->setEnabled(false); connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut())); m_editMenu->addAction(m_cutAction); m_copyAction = new QAction(tr("&Copy"), this); m_copyAction->setShortcut(tr("Ctrl+C")); m_copyAction->setStatusTip(tr("Copy selection")); m_copyAction->setEnabled(false); connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy())); m_editMenu->addAction(m_copyAction); currentAction = new QAction(tr("&Paste"), this); currentAction->setShortcut(tr("Ctrl+V")); currentAction->setStatusTip(tr("Paste clipboard contents")); // TODO: Check clipboard status and disable appropriately here connect(currentAction, SIGNAL(triggered()), this, SLOT(paste())); m_editMenu->addAction(currentAction); m_editMenu->addSeparator(); currentAction = new QAction(tr("&Select All"), this); currentAction->setShortcut(tr("Ctrl+A")); currentAction->setStatusTip(tr("Select all text")); connect(currentAction, SIGNAL(triggered()), this, SLOT(selectAll())); m_editMenu->addAction(currentAction); m_programMenu = menubar->addMenu(tr("&Code")); QMenu *languageMenu = new QMenu(tr("Select language"), this); m_programMenu->addMenu(languageMenu); QString currentLanguage = settings.value("programwindow/language", "").toString(); QStringList languages = getAvailableLanguages(); QActionGroup *languageActionGroup = new QActionGroup(this); foreach (QString language, languages) { currentAction = new QAction(language, this); currentAction->setCheckable(true); m_languageActions.insert(language, currentAction); languageActionGroup->addAction(currentAction); languageMenu->addAction(currentAction); if (!currentLanguage.isEmpty()) { if (language.compare(currentLanguage) == 0) { currentAction->setChecked(true); } } }
void ItemDoor::contextMenu(QGraphicsSceneMouseEvent *mouseEvent) { m_scene->m_contextMenuIsOpened = true; //bug protector //Remove selection from non-bgo items if(!this->isSelected()) { m_scene->clearSelection(); this->setSelected(true); } this->setSelected(1); QMenu ItemMenu; QAction *openLvl = ItemMenu.addAction(tr("Open target level: %1").arg(m_data.lname).replace("&", "&&&")); openLvl->setVisible((!m_data.lname.isEmpty()) && (QFile(m_scene->m_data->meta.path + "/" + m_data.lname).exists())); openLvl->deleteLater(); /*************Layers*******************/ QMenu *LayerName = ItemMenu.addMenu(tr("Layer: ") + QString("[%1]").arg(m_data.layer).replace("&", "&&&")); QAction *setLayer; QList<QAction *> layerItems; QAction *newLayer = LayerName->addAction(tr("Add to new layer...")); LayerName->addSeparator()->deleteLater();; for(LevelLayer &layer : m_scene->m_data->layers) { //Skip system layers if((layer.name == "Destroyed Blocks") || (layer.name == "Spawned NPCs")) continue; setLayer = LayerName->addAction(layer.name.replace("&", "&&&") + ((layer.hidden) ? "" + tr("[hidden]") : "")); setLayer->setData(layer.name); setLayer->setCheckable(true); setLayer->setEnabled(true); setLayer->setChecked(layer.name == m_data.layer); layerItems.push_back(setLayer); } ItemMenu.addSeparator(); /*************Layers*end***************/ QAction *jumpTo = NULL; if(this->data(ITEM_TYPE).toString() == "Door_enter") { jumpTo = ItemMenu.addAction(tr("Jump to exit")); jumpTo->setVisible((m_data.isSetIn) && (m_data.isSetOut)); } else if(this->data(ITEM_TYPE).toString() == "Door_exit") { jumpTo = ItemMenu.addAction(tr("Jump to entrance")); jumpTo->setVisible((m_data.isSetIn) && (m_data.isSetOut)); } ItemMenu.addSeparator(); QAction *NoTransport = ItemMenu.addAction(tr("No Vehicles")); NoTransport->setCheckable(true); NoTransport->setChecked(m_data.novehicles); QAction *AllowNPC = ItemMenu.addAction(tr("Allow NPC")); AllowNPC->setCheckable(true); AllowNPC->setChecked(m_data.allownpc); QAction *Locked = ItemMenu.addAction(tr("Locked")); Locked->setCheckable(true); Locked->setChecked(m_data.locked); QAction *BombNeed = ItemMenu.addAction(tr("Need a bomb")); BombNeed->setCheckable(true); BombNeed->setChecked(m_data.need_a_bomb); QAction *SpecialStReq = ItemMenu.addAction(tr("Required special state")); SpecialStReq->setCheckable(true); SpecialStReq->setChecked(m_data.special_state_required); /*************Copy Preferences*******************/ ItemMenu.addSeparator(); QMenu *copyPreferences = ItemMenu.addMenu(tr("Copy preferences")); QAction *copyPosXY = copyPreferences->addAction(tr("Position: X, Y")); QAction *copyPosXYWH = copyPreferences->addAction(tr("Position: X, Y, Width, Height")); QAction *copyPosLTRB = copyPreferences->addAction(tr("Position: Left, Top, Right, Bottom")); /*************Copy Preferences*end***************/ ItemMenu.addSeparator(); QAction *remove = ItemMenu.addAction(tr("Remove")); ItemMenu.addSeparator(); QAction *props = ItemMenu.addAction(tr("Properties...")); /*****************Waiting for answer************************/ QAction *selected = ItemMenu.exec(mouseEvent->screenPos()); /***********************************************************/ if(!selected) return; if(selected == openLvl) m_scene->m_mw->OpenFile(m_scene->m_data->meta.path + "/" + m_data.lname); else if(selected == jumpTo) { //scene->doCopy = true ; if(this->data(ITEM_TYPE).toString() == "Door_enter") { if(m_data.isSetOut) m_scene->m_mw->activeLvlEditWin()->goTo(m_data.ox, m_data.oy, true, QPoint(0, 0), true); } else if(this->data(ITEM_TYPE).toString() == "Door_exit") { if(m_data.isSetIn) m_scene->m_mw->activeLvlEditWin()->goTo(m_data.ix, m_data.iy, true, QPoint(0, 0), true); } } else if(selected == NoTransport) { LevelData modDoors; for(QGraphicsItem *SelItem : m_scene->selectedItems()) { if((SelItem->data(ITEM_TYPE).toString() == "Door_exit") || (SelItem->data(ITEM_TYPE).toString() == "Door_enter")) { if(SelItem->data(ITEM_TYPE).toString() == "Door_exit") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = true; door.isSetIn = false; modDoors.doors.push_back(door); } else if(SelItem->data(ITEM_TYPE).toString() == "Door_enter") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = false; door.isSetIn = true; modDoors.doors.push_back(door); } ((ItemDoor *) SelItem)->m_data.novehicles = NoTransport->isChecked(); ((ItemDoor *) SelItem)->arrayApply(); } } m_scene->m_history->addChangeSettings(modDoors, HistorySettings::SETTING_NOVEHICLE, QVariant(NoTransport->isChecked())); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); } else if(selected == AllowNPC) { LevelData modDoors; for(QGraphicsItem *SelItem : m_scene->selectedItems()) { if((SelItem->data(ITEM_TYPE).toString() == "Door_exit") || (SelItem->data(ITEM_TYPE).toString() == "Door_enter")) { if(SelItem->data(ITEM_TYPE).toString() == "Door_exit") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = true; door.isSetIn = false; modDoors.doors.push_back(door); } else if(SelItem->data(ITEM_TYPE).toString() == "Door_enter") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = false; door.isSetIn = true; modDoors.doors.push_back(door); } ((ItemDoor *) SelItem)->m_data.allownpc = AllowNPC->isChecked(); ((ItemDoor *) SelItem)->arrayApply(); } } m_scene->m_history->addChangeSettings(modDoors, HistorySettings::SETTING_ALLOWNPC, QVariant(AllowNPC->isChecked())); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); } else if(selected == Locked) { LevelData modDoors; for(QGraphicsItem *SelItem : m_scene->selectedItems()) { if((SelItem->data(ITEM_TYPE).toString() == "Door_exit") || (SelItem->data(ITEM_TYPE).toString() == "Door_enter")) { if(SelItem->data(ITEM_TYPE).toString() == "Door_exit") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = true; door.isSetIn = false; modDoors.doors.push_back(door); } else if(SelItem->data(ITEM_TYPE).toString() == "Door_enter") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = false; door.isSetIn = true; modDoors.doors.push_back(door); } ((ItemDoor *) SelItem)->m_data.locked = Locked->isChecked(); ((ItemDoor *) SelItem)->arrayApply(); } } m_scene->m_history->addChangeSettings(modDoors, HistorySettings::SETTING_LOCKED, QVariant(Locked->isChecked())); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); } else if(selected == BombNeed) { LevelData modDoors; for(QGraphicsItem *SelItem : m_scene->selectedItems()) { if((SelItem->data(ITEM_TYPE).toString() == "Door_exit") || (SelItem->data(ITEM_TYPE).toString() == "Door_enter")) { if(SelItem->data(ITEM_TYPE).toString() == "Door_exit") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = true; door.isSetIn = false; modDoors.doors.push_back(door); } else if(SelItem->data(ITEM_TYPE).toString() == "Door_enter") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = false; door.isSetIn = true; modDoors.doors.push_back(door); } ((ItemDoor *) SelItem)->m_data.need_a_bomb = BombNeed->isChecked(); ((ItemDoor *) SelItem)->arrayApply(); } } m_scene->m_history->addChangeSettings(modDoors, HistorySettings::SETTING_NEED_A_BOMB, QVariant(BombNeed->isChecked())); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); } else if(selected == SpecialStReq) { LevelData modDoors; for(QGraphicsItem *SelItem : m_scene->selectedItems()) { if((SelItem->data(ITEM_TYPE).toString() == "Door_exit") || (SelItem->data(ITEM_TYPE).toString() == "Door_enter")) { if(SelItem->data(ITEM_TYPE).toString() == "Door_exit") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = true; door.isSetIn = false; modDoors.doors.push_back(door); } else if(SelItem->data(ITEM_TYPE).toString() == "Door_enter") { LevelDoor door = ((ItemDoor *) SelItem)->m_data; door.isSetOut = false; door.isSetIn = true; modDoors.doors.push_back(door); } ((ItemDoor *) SelItem)->m_data.special_state_required = SpecialStReq->isChecked(); ((ItemDoor *) SelItem)->arrayApply(); } } m_scene->m_history->addChangeSettings(modDoors, HistorySettings::SETTING_W_SPECIAL_STATE_REQUIRED, QVariant(SpecialStReq->isChecked())); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); } else if(selected == copyPosXY) { QApplication::clipboard()->setText( QString("X=%1; Y=%2;") .arg(m_pointSide == D_Entrance ? m_data.ix : m_data.ox) .arg(m_pointSide == D_Entrance ? m_data.iy : m_data.oy) ); m_scene->m_mw->showStatusMsg(tr("Preferences have been copied: %1").arg(QApplication::clipboard()->text())); } else if(selected == copyPosXYWH) { QApplication::clipboard()->setText( QString("X=%1; Y=%2; W=%3; H=%4;") .arg(m_pointSide == D_Entrance ? m_data.ix : m_data.ox) .arg(m_pointSide == D_Entrance ? m_data.iy : m_data.oy) .arg(m_itemSize.width()) .arg(m_itemSize.height()) ); m_scene->m_mw->showStatusMsg(tr("Preferences have been copied: %1").arg(QApplication::clipboard()->text())); } else if(selected == copyPosLTRB) { QApplication::clipboard()->setText( QString("Left=%1; Top=%2; Right=%3; Bottom=%4;") .arg(m_pointSide == D_Entrance ? m_data.ix : m_data.ox) .arg(m_pointSide == D_Entrance ? m_data.iy : m_data.oy) .arg((m_pointSide == D_Entrance ? m_data.ix : m_data.ox) + m_itemSize.width()) .arg((m_pointSide == D_Entrance ? m_data.iy : m_data.oy) + m_itemSize.height()) ); m_scene->m_mw->showStatusMsg(tr("Preferences have been copied: %1").arg(QApplication::clipboard()->text())); } else if(selected == remove) m_scene->removeSelectedLvlItems(); else if(selected == props) m_scene->m_mw->dock_LvlWarpProps->SwitchToDoor(m_data.meta.array_id); else if(selected == newLayer) { m_scene->setLayerToSelected(); m_scene->applyLayersVisible(); } else { //Fetch layers menu foreach(QAction *lItem, layerItems) { if(selected == lItem) { //FOUND!!! m_scene->setLayerToSelected(lItem->data().toString()); m_scene->applyLayersVisible(); m_scene->m_mw->dock_LvlWarpProps->setDoorData(-2); break; }//Find selected layer's item } } }
void SidebarWidget::optionChanged(const QString &option, const QVariant &value) { if (option == QLatin1String("Sidebar/CurrentPanel")) { selectPanel(value.toString()); } else if (option == QLatin1String("Sidebar/Panels")) { qDeleteAll(m_buttons.begin(), m_buttons.end()); m_buttons.clear(); QMenu *menu = new QMenu(m_ui->panelsButton); const QStringList chosenPanels = value.toStringList(); QStringList allPanels; allPanels << QLatin1String("bookmarks") << QLatin1String("cache") << QLatin1String("cookies") << QLatin1String("config") << QLatin1String("history") << QLatin1String("notes") << QLatin1String("transfers"); for (int i = 0; i < allPanels.count(); ++i) { QAction *action = new QAction(menu); action->setCheckable(true); action->setChecked(chosenPanels.contains(allPanels[i])); action->setData(allPanels[i]); action->setText(getPanelTitle(allPanels[i])); connect(action, SIGNAL(toggled(bool)), this, SLOT(choosePanel(bool))); menu->addAction(action); } menu->addSeparator(); for (int i = 0; i < chosenPanels.count(); ++i) { QToolButton *button = new QToolButton(this); button->setDefaultAction(new QAction(button)); button->setToolTip(getPanelTitle(chosenPanels.at(i))); button->setCheckable(true); button->setAutoRaise(true); button->defaultAction()->setData(chosenPanels.at(i)); if (chosenPanels.at(i) == QLatin1String("bookmarks")) { button->setIcon(ThemesManager::getIcon(QLatin1String("bookmarks"))); } else if (chosenPanels.at(i) == QLatin1String("cache")) { button->setIcon(ThemesManager::getIcon(QLatin1String("cache"))); } else if (chosenPanels.at(i) == QLatin1String("config")) { button->setIcon(ThemesManager::getIcon(QLatin1String("configuration"))); } else if (chosenPanels.at(i) == QLatin1String("cookies")) { button->setIcon(ThemesManager::getIcon(QLatin1String("cookies"))); } else if (chosenPanels.at(i) == QLatin1String("history")) { button->setIcon(ThemesManager::getIcon(QLatin1String("view-history"))); } else if (chosenPanels.at(i) == QLatin1String("notes")) { button->setIcon(ThemesManager::getIcon(QLatin1String("notes"))); } else if (chosenPanels.at(i) == QLatin1String("transfers")) { button->setIcon(ThemesManager::getIcon(QLatin1String("transfers"))); } else if (chosenPanels.at(i).startsWith(QLatin1String("web:"))) { button->setIcon(ThemesManager::getIcon(QLatin1String("text-html"))); QAction *action = new QAction(menu); action->setCheckable(true); action->setChecked(true); action->setData(chosenPanels.at(i)); action->setText(getPanelTitle(chosenPanels.at(i))); connect(action, SIGNAL(toggled(bool)), this, SLOT(choosePanel(bool))); menu->addAction(action); } else {
/* * TODO: * ==== * - display value of a port (nice to have) * - triangle port (nice to have) * - mouse over (over a node or port) (nice to have) * - round shaped nodes (nice to have) */ namespace Magus { //****************************************************************************/ QtNodeEditor::QtNodeEditor(QWidget* parent) : QWidget(parent) { QVBoxLayout* mainLayout = new QVBoxLayout; mView = new QGraphicsView(this); mScene = new QtNodeGraphicsScene(); mScene->installEventFilter(this); mView->setScene(mScene); mView->setRenderHint(QPainter::Antialiasing, true); mView->setInteractive(true); mView->setMouseTracking(true); mainLayout->addWidget(mView); mLastRemovedNode = 0; mRubberBand = 0; mZoom = 1.0f; mFisheyeViewEnabled = false; mFisheyeMaxZoom = 1.0f; mFisheyeSteps = 5; mHeaderTitleIcon = NODE_HEADER_COMPOUND_ICON; mAction1Icon = NODE_HEADER_ACTION1_ICON; mAction2Icon = NODE_HEADER_ACTION2_ICON; mCompoundNodeDropped = 0; mRubberbandSelection = false; mContextMenuEnabled = true; mContextMenu = new QMenu(this); mContextMenu->addAction(new QAction(NODE_ACTION_DELETE, this)); mContextMenu->addAction(new QAction(NODE_ACTION_CENTER, this)); mZoomSubMenu = mContextMenu->addMenu(NODE_ACTION_ZOOM); QAction* action; QActionGroup actionGroupZoom(mZoomSubMenu); actionGroupZoom.setExclusive(true); action = new QAction(NODE_ACTION_ZOOM_10, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_25, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_50, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_75, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_90, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_100, this); action->setCheckable(true); action->setChecked(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_150, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_200, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_250, this); action->setCheckable(true); actionGroupZoom.addAction(action); action = new QAction(NODE_ACTION_ZOOM_300, this); action->setCheckable(true); actionGroupZoom.addAction(action); mZoomSubMenu->addActions(actionGroupZoom.actions()); mFisheyeViewSubMenu = mContextMenu->addMenu(NODE_ACTION_FISHEY_VIEW); QActionGroup actionGroupFisheye(mFisheyeViewSubMenu); actionGroupFisheye.setExclusive(true); action = new QAction(NODE_ACTION_FISHEYE_DISABLED, this); action->setCheckable(true); action->setChecked(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_NORMAL, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_NORMAL_SUBTLE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_LARGE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); action = new QAction(NODE_ACTION_FISHEYE_LARGE_SUBTLE, this); action->setCheckable(true); actionGroupFisheye.addAction(action); mFisheyeViewSubMenu->addActions(actionGroupFisheye.actions()); mContextMenu->addAction(new QAction(NODE_ACTION_SELECTED_TO_COMPOUND, this)); mContextMenu->addAction(new QAction(NODE_ACTION_COLLAPSE_ALL, this)); mContextMenu->addAction(new QAction(NODE_ACTION_EXPAND_ALL, this)); mContextMenu->addAction(new QAction(NODE_ACTION_EXPAND_COMPOUNDS, this)); mContextMenu->addAction(new QAction(NODE_ACTION_CENTER, this)); setMenuZoomEnabled(true); setMenuSelectionToCompoundEnabled(true); setMenuCollapseExpandEnabled(true); setMenuExpandCompoundsEnabled(true); setMenuFisheyeViewEnabled(true); setContextMenuPolicy(Qt::CustomContextMenu); connect(mContextMenu, SIGNAL(triggered(QAction*)), this, SLOT(contextMenuItemSelected(QAction*))); setLayout(mainLayout); }
void GLRenderWidget::updateRenderEngines() { GLdouble minX=std::numeric_limits<double>::max(), minY=std::numeric_limits<double>::max(), minZ=std::numeric_limits<double>::max(); GLdouble maxX=std::numeric_limits<double>::min(), maxY=std::numeric_limits<double>::min(), maxZ=std::numeric_limits<double>::min(); GLdouble x1, x2, y1, y2, z1, z2; mEnginesMenu->clear(); for(std::vector<AbstractRenderEngine*>::iterator it = mRenderEngines.begin(); it != mRenderEngines.end(); it++) { //mEnginesMenu->addAction((*it)->name()); QAction *action = new QAction((*it)->name(), this); action->setCheckable(true); action->setChecked(true); mEnginesMenu->addAction(action); connect(action, SIGNAL(changed()), this, SLOT(toggleRenderEngines())); } for(std::vector<AbstractRenderEngine*>::iterator it = mRenderEnginesActive.begin(); it != mRenderEnginesActive.end(); it++) { Vector3d min = (*it)->bbox.min(); Vector3d max = (*it)->bbox.max(); x1 = min.x(); y1 = min.y(); z1 = min.z(); x2 = max.x(); y2 = max.y(); z2 = max.z(); if(x1 < minX) minX = x1; if(y1 < minY) minY = y1; if(z1 < minZ) minZ = z1; if(x2 > maxX) maxX = x2; if(y2 > maxY) maxY = y2; if(z2 > maxZ) maxZ = z2; } mSpace.minX = minX; mSpace.minY = minY; mSpace.minZ = minZ; mSpace.maxX = maxX; mSpace.maxY = maxY; mSpace.maxZ = maxZ; mSpace.isValid = true; mCam.stepSizeX = (mSpace.maxX - mSpace.minX) / 20; mCam.stepSizeY = (mSpace.maxY - mSpace.minY) / 20; mCam.stepSizeZ = (mSpace.maxZ - mSpace.minZ) / 20; // GLfloat light_position[] = {0.5* (mSpace.minX + mSpace.maxX), // mSpace.maxY, // 0.5* (mSpace.minZ + mSpace.maxZ) }; // glLightfv(GL_LIGHT0, GL_POSITION, light_position); }
void IdealDockWidget::contextMenuRequested(const QPoint &point) { QWidget* senderWidget = qobject_cast<QWidget*>(sender()); Q_ASSERT(senderWidget); QMenu menu; menu.addSection(windowIcon(), windowTitle()); QList< QAction* > viewActions = m_view->contextMenuActions(); if(!viewActions.isEmpty()) { menu.addActions(viewActions); menu.addSeparator(); } ///TODO: can this be cleaned up? if(QToolBar* toolBar = widget()->findChild<QToolBar*>()) { menu.addAction(toolBar->toggleViewAction()); menu.addSeparator(); } /// start position menu QMenu* positionMenu = menu.addMenu(i18n("Toolview Position")); QActionGroup *g = new QActionGroup(this); QAction *left = new QAction(i18nc("toolview position", "Left"), g); QAction *bottom = new QAction(i18nc("toolview position", "Bottom"), g); QAction *right = new QAction(i18nc("toolview position", "Right"), g); QAction *detach = new QAction(i18nc("toolview position", "Detached"), g); for (auto action : {left, bottom, right, detach}) { positionMenu->addAction(action); action->setCheckable(true); } if (isFloating()) { detach->setChecked(true); } else if (m_docking_area == Qt::BottomDockWidgetArea) bottom->setChecked(true); else if (m_docking_area == Qt::LeftDockWidgetArea) left->setChecked(true); else if (m_docking_area == Qt::RightDockWidgetArea) right->setChecked(true); /// end position menu menu.addSeparator(); QAction *setShortcut = menu.addAction(QIcon::fromTheme(QStringLiteral("configure-shortcuts")), i18n("Assign Shortcut...")); setShortcut->setToolTip(i18n("Use this shortcut to trigger visibility of the toolview.")); menu.addSeparator(); QAction* remove = menu.addAction(QIcon::fromTheme(QStringLiteral("dialog-close")), i18n("Remove Toolview")); QAction* triggered = menu.exec(senderWidget->mapToGlobal(point)); if (triggered) { if ( triggered == remove ) { slotRemove(); return; } else if ( triggered == setShortcut ) { QDialog* dialog(new QDialog(this)); dialog->setWindowTitle(i18n("Assign Shortcut For '%1' Tool View", m_view->document()->title())); KShortcutWidget *w = new KShortcutWidget(dialog); w->setShortcut(m_controller->actionForView(m_view)->shortcuts()); QVBoxLayout* dialogLayout = new QVBoxLayout(dialog); dialogLayout->addWidget(w); QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); dialogLayout->addWidget(buttonBox); connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); if (dialog->exec() == QDialog::Accepted) { m_controller->actionForView(m_view)->setShortcuts(w->shortcut()); //save shortcut config KConfigGroup config = KSharedConfig::openConfig()->group("UI"); QStringList shortcuts; shortcuts << w->shortcut().value(0).toString(); shortcuts << w->shortcut().value(1).toString(); config.writeEntry(QStringLiteral("Shortcut for %1").arg(m_view->document()->title()), shortcuts); config.sync(); } delete dialog; return; } else if ( triggered == detach ) { setFloating(true); m_area->raiseToolView(m_view); return; } if (isFloating()) { setFloating(false); } Sublime::Position pos; if (triggered == left) pos = Sublime::Left; else if (triggered == bottom) pos = Sublime::Bottom; else if (triggered == right) pos = Sublime::Right; else return; Area *area = m_area; View *view = m_view; /* This call will delete *this, so we no longer can access member variables. */ m_area->moveToolView(m_view, pos); area->raiseToolView(view); } }
void QgsLegendLayer::addToPopupMenu( QMenu& theMenu ) { QgsMapLayer *lyr = layer(); QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing(); QAction *saveLayerEditsAction = QgisApp::instance()->actionSaveActiveLayerEdits(); QAction *allEditsAction = QgisApp::instance()->actionAllEdits(); // zoom to layer extent theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.svg" ), tr( "&Zoom to Layer Extent" ), legend(), SLOT( legendLayerZoom() ) ); if ( lyr->type() == QgsMapLayer::RasterLayer ) { theMenu.addAction( tr( "&Zoom to Best Scale (100%)" ), legend(), SLOT( legendLayerZoomNative() ) ); QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( lyr ); if ( rasterLayer && rasterLayer->rasterType() != QgsRasterLayer::Palette ) { theMenu.addAction( tr( "&Stretch Using Current Extent" ), legend(), SLOT( legendLayerStretchUsingCurrentExtent() ) ); } } // show in overview QAction* showInOverviewAction = theMenu.addAction( tr( "&Show in Overview" ), this, SLOT( showInOverview() ) ); showInOverviewAction->setCheckable( true ); showInOverviewAction->blockSignals( true ); showInOverviewAction->setChecked( mLyr.isInOverview() ); showInOverviewAction->blockSignals( false ); // remove from canvas theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.svg" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) ); // duplicate layer QAction* duplicateLayersAction = theMenu.addAction( QgsApplication::getThemeIcon( "/mActionDuplicateLayer.svg" ), tr( "&Duplicate" ), QgisApp::instance(), SLOT( duplicateLayers() ) ); // set layer crs theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) ); // assign layer crs to project theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) ); theMenu.addSeparator(); if ( lyr->type() == QgsMapLayer::VectorLayer ) { QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( lyr ); // attribute table theMenu.addAction( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ), QgisApp::instance(), SLOT( attributeTable() ) ); // allow editing int cap = vlayer->dataProvider()->capabilities(); if ( cap & QgsVectorDataProvider::EditingCapabilities ) { if ( toggleEditingAction ) { theMenu.addAction( toggleEditingAction ); toggleEditingAction->setChecked( vlayer->isEditable() ); } if ( saveLayerEditsAction && vlayer->isModified() ) { theMenu.addAction( saveLayerEditsAction ); } } if ( allEditsAction->isEnabled() ) { theMenu.addAction( allEditsAction ); } // disable duplication of memory layers if ( vlayer->storageType() == "Memory storage" && legend()->selectedLayers().count() == 1 ) { duplicateLayersAction->setEnabled( false ); } // save as vector file theMenu.addAction( tr( "Save As..." ), QgisApp::instance(), SLOT( saveAsFile() ) ); // save selection as vector file QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save Selection As..." ), QgisApp::instance(), SLOT( saveSelectionAsVectorFile() ) ); if ( vlayer->selectedFeatureCount() == 0 ) { saveSelectionAsAction->setEnabled( false ); } if ( !vlayer->isEditable() && vlayer->dataProvider()->supportsSubsetString() && vlayer->vectorJoins().isEmpty() ) theMenu.addAction( tr( "&Filter..." ), QgisApp::instance(), SLOT( layerSubsetString() ) ); //show number of features in legend if requested QAction* showNFeaturesAction = new QAction( tr( "Show Feature Count" ), &theMenu ); showNFeaturesAction->setCheckable( true ); showNFeaturesAction->setChecked( mShowFeatureCount ); QObject::connect( showNFeaturesAction, SIGNAL( toggled( bool ) ), this, SLOT( setShowFeatureCount( bool ) ) ); theMenu.addAction( showNFeaturesAction ); theMenu.addSeparator(); }
void MusE::startMidiInputPlugin(int id) { bool flag = false; QWidget* w = 0; QAction* act = 0; if (id == 0) { if (!MusEGlobal::mitPluginTranspose) { // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs(). MusEGlobal::mitPluginTranspose = new MITPluginTranspose(); MusECore::mitPlugins.push_back(MusEGlobal::mitPluginTranspose); connect(MusEGlobal::mitPluginTranspose, SIGNAL(hideWindow()), SLOT(hideMitPluginTranspose())); } w = MusEGlobal::mitPluginTranspose; act = midiTrpAction; } else if (id == 1) { if (!midiInputTransform) { // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs(). midiInputTransform = new MidiInputTransformDialog(); connect(midiInputTransform, SIGNAL(hideWindow()), SLOT(hideMidiInputTransform())); } w = midiInputTransform; act = midiInputTrfAction; } else if (id == 2) { if (!midiFilterConfig) { // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs(). midiFilterConfig = new MidiFilterConfig(); connect(midiFilterConfig, SIGNAL(hideWindow()), SLOT(hideMidiFilterConfig())); } w = midiFilterConfig; act = midiInputFilterAction; } else if (id == 3) { if (!midiRemoteConfig) { // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs(). midiRemoteConfig = new MRConfig(); connect(midiRemoteConfig, SIGNAL(hideWindow()), SLOT(hideMidiRemoteConfig())); } w = midiRemoteConfig; act = midiRemoteAction; } #ifdef BUILD_EXPERIMENTAL else if (id == 4) { if (!midiRhythmGenerator) { // NOTE: For deleting parentless dialogs and widgets, please add them to MusE::deleteParentlessDialogs(). midiRhythmGenerator = new RhythmGen(); connect(midiRhythmGenerator, SIGNAL(hideWindow()), SLOT(hideMidiRhythmGenerator())); } w = midiRhythmGenerator; act = midiRhythmAction; } #endif if (w) { flag = !w->isVisible(); if (flag) w->show(); else w->hide(); } if (act) act->setChecked(flag); }
void SCgWindow::createToolBar() { mToolBar = new QToolBar(this); mToolBar->setIconSize(QSize(32, 32)); QActionGroup* group = new QActionGroup(mToolBar); // Select mode QAction *action = new QAction(findIcon("tool-select.png"), tr("Selection mode"), mToolBar); action->setCheckable(true); action->setChecked(true); action->setShortcut(QKeySequence(tr("1", "Selection mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Select] = action; connect(action, SIGNAL(triggered()), this, SLOT(onSelectMode())); //Pair creation mode action = new QAction(findIcon("tool-pair.png"), tr("Pair creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("2", "Pair creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Pair] = action; connect(action, SIGNAL(triggered()), this, SLOT(onPairMode())); //Bus creation mode action = new QAction(findIcon("tool-bus.png"), tr("Bus creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("3", "Bus creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Bus] = action; connect(action, SIGNAL(triggered()), this, SLOT(onBusMode())); //Contour creation mode action = new QAction(findIcon("tool-contour.png"), tr("Contour creation mode"), mToolBar); action->setCheckable(true); action->setShortcut(QKeySequence(tr("4", "Contour creation mode"))); group->addAction(action); mToolBar->addAction(action); mMode2Action[SCgScene::Mode_Contour] = action; connect(action, SIGNAL(triggered()), this, SLOT(onContourMode())); // mToolBar->addSeparator(); // // align group button QToolButton *alignButton = new QToolButton(mToolBar); alignButton->setIcon(findIcon("tool-align.png")); alignButton->setPopupMode(QToolButton::InstantPopup); alignButton->setToolTip(tr("Alignment")); mToolBar->addWidget(alignButton); //Grid alignment action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("5", "Grid alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment())); // tuple alignment action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("6", "Tuple alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment())); //Vertical alignment action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("7", "Vertical alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment())); //Horizontal alignment action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("8", "Horizontal alignment"))); alignButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment())); // selection group button QToolButton *selectButton = new QToolButton(mToolBar); selectButton->setIcon(findIcon("tool-select-group.png")); selectButton->setPopupMode(QToolButton::InstantPopup); selectButton->setToolTip(tr("Selection group")); mToolBar->addWidget(selectButton); // input/output selection action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar); action->setCheckable(false); selectButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput())); // sbgraph selection action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar); action->setCheckable(false); selectButton->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph())); mToolBar->addSeparator(); action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("0", "Export image"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onExportImage())); // mToolBar->addSeparator(); // //Zoom in action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("+", "Zoom in"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn())); //Scale combobox QComboBox* b = new QComboBox(mToolBar); b->setEditable(true); b->setInsertPolicy(QComboBox::NoInsert); b->addItems(SCgWindow::mScales); b->setCurrentIndex(mScales.indexOf("100")); mZoomFactorLine = b->lineEdit(); mZoomFactorLine->setInputMask("D90%"); mToolBar->addWidget(b); connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&))); connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal))); //Zoom out action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar); action->setCheckable(false); action->setShortcut(QKeySequence(tr("-", "Zoom out"))); mToolBar->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut())); mToolBar->setWindowTitle(tr("SCg Tools")); mToolBar->setObjectName("SCgMainToolBar"); //! @bug toolbar state is not saved mToolBar->setMovable(false); }
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, nullptr) { setWindowTitle("Debug: Disassembly View"); if (parent != nullptr) { QPoint parentPos = parent->pos(); setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); } // // The main frame and its input and log widgets // QFrame* mainWindowFrame = new QFrame(this); // The top frame & groupbox that contains the input widgets QFrame* topSubFrame = new QFrame(mainWindowFrame); // The input edit m_inputEdit = new QLineEdit(topSubFrame); connect(m_inputEdit, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted); // The cpu combo box m_cpuComboBox = new QComboBox(topSubFrame); m_cpuComboBox->setObjectName("cpu"); m_cpuComboBox->setMinimumWidth(300); connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); // The main disasm window m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this); connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated); // Force a recompute of the disassembly region downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc"); // Populate the combo box & set the proper cpu populateComboBox(); //const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu); //gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source)); //mem->views[0]->view->set_source(*source); // Layout QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame); subLayout->addWidget(m_inputEdit); subLayout->addWidget(m_cpuComboBox); subLayout->setSpacing(3); subLayout->setContentsMargins(2,2,2,2); QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); vLayout->setSpacing(3); vLayout->setContentsMargins(2,2,2,2); vLayout->addWidget(topSubFrame); vLayout->addWidget(m_dasmView); setCentralWidget(mainWindowFrame); // // Menu bars // // Create three commands m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this); m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this); m_runToCursorAct = new QAction("Run to Cursor", this); m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor); connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor); connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); rightBarGroup->setObjectName("rightbargroup"); QAction* rightActRaw = new QAction("Raw Opcodes", this); QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); QAction* rightActComments = new QAction("Comments", this); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); rightActRaw->setActionGroup(rightBarGroup); rightActEncrypted->setActionGroup(rightBarGroup); rightActComments->setActionGroup(rightBarGroup); rightActRaw->setShortcut(QKeySequence("Ctrl+R")); rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+N")); rightActRaw->setChecked(true); connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addAction(m_breakpointToggleAct); optionsMenu->addAction(m_breakpointEnableAct); optionsMenu->addAction(m_runToCursorAct); optionsMenu->addSeparator(); optionsMenu->addActions(rightBarGroup->actions()); }
bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) { if (m_currentMenu && m_currentMenu->isVisible() && !m_currentMenu->rect().contains(m_currentMenu->mapFromGlobal(QCursor::pos()))) { // To switch root folders as in a menubar KBookmarkActionMenu* act = dynamic_cast<KBookmarkActionMenu *>(actionAt(mapFromGlobal(QCursor::pos()))); if (event->type() == QEvent::MouseMove && act && act->menu() != m_currentMenu) { m_currentMenu->hide(); QPoint pos = mapToGlobal(widgetForAction(act)->pos()); act->menu()->popup(QPoint(pos.x(), pos.y() + widgetForAction(act)->height())); } else if (event->type() == QEvent::MouseButtonPress && act) { m_currentMenu->hide(); } return QObject::eventFilter(watched, event); } switch (event->type()) { case QEvent::Show: { if (!m_filled) { BookmarkManager::self()->fillBookmarkBar(this); m_filled = true; } } break; case QEvent::ActionRemoved: { QActionEvent *actionEvent = static_cast<QActionEvent*>(event); if (actionEvent && actionEvent->action() != m_dropAction) { QWidget *widget = widgetForAction(actionEvent->action()); if (widget) { widget->removeEventFilter(this); } } } break; case QEvent::ParentChange: { QActionEvent *actionEvent = static_cast<QActionEvent*>(event); if (actionEvent && actionEvent->action() != m_dropAction) { QWidget *widget = widgetForAction(actionEvent->action()); if (widget) { widget->removeEventFilter(this); } } } break; case QEvent::DragEnter: { QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent*>(event); if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()) || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain")) { QFrame* dropIndicatorWidget = new QFrame(this); dropIndicatorWidget->setFrameShape(QFrame::VLine); m_dropAction = insertWidget(actionAt(dragEvent->pos()), dropIndicatorWidget); dragEvent->accept(); } } break; case QEvent::DragLeave: { QDragLeaveEvent *dragEvent = static_cast<QDragLeaveEvent*>(event); if (m_checkedAction) { m_checkedAction->setCheckable(false); m_checkedAction->setChecked(false); } delete m_dropAction; m_dropAction = 0; dragEvent->accept(); } break; case QEvent::DragMove: { QDragMoveEvent *dragEvent = static_cast<QDragMoveEvent*>(event); if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()) || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain")) { QAction *overAction = actionAt(dragEvent->pos()); KBookmarkActionInterface *overActionBK = dynamic_cast<KBookmarkActionInterface*>(overAction); QWidget *widgetAction = widgetForAction(overAction); if (overAction != m_dropAction && overActionBK && widgetAction && m_dropAction) { removeAction(m_dropAction); if (m_checkedAction) { m_checkedAction->setCheckable(false); m_checkedAction->setChecked(false); } if (!overActionBK->bookmark().isGroup()) { if ((dragEvent->pos().x() - widgetAction->pos().x()) > (widgetAction->width() / 2)) { if (actions().count() > actions().indexOf(overAction) + 1) { insertAction(actions().at(actions().indexOf(overAction) + 1), m_dropAction); } else { addAction(m_dropAction); } } else { insertAction(overAction, m_dropAction); } } else { if ((dragEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75)) { if (actions().count() > actions().indexOf(overAction) + 1) { insertAction(actions().at(actions().indexOf(overAction) + 1), m_dropAction); } else { addAction(m_dropAction); } } else if ((dragEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25)) { insertAction(overAction, m_dropAction); } else { overAction->setCheckable(true); overAction->setChecked(true); m_checkedAction = overAction; } } dragEvent->accept(); } } } break; case QEvent::Drop: { QDropEvent *dropEvent = static_cast<QDropEvent*>(event); KBookmark bookmark; KBookmarkGroup root = BookmarkManager::self()->manager()->toolbar(); if (m_checkedAction) { m_checkedAction->setCheckable(false); m_checkedAction->setChecked(false); } if (dropEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())) { QByteArray addresses = dropEvent->mimeData()->data(BookmarkManager::bookmark_mime_type()); bookmark = BookmarkManager::self()->findByAddress(QString::fromLatin1(addresses.data())); if (bookmark.isNull()) return false; } else if (dropEvent->mimeData()->hasFormat("text/uri-list")) { // DROP is URL QString url = dropEvent->mimeData()->urls().at(0).toString(); WebWindow *w = qobject_cast<WebWindow *>(parent()); QString title = url.contains(w->url().url()) ? w->title() : url; bookmark = root.addBookmark(title, url); } else if (dropEvent->mimeData()->hasFormat("text/plain")) { // DROP is TEXT QString url = dropEvent->mimeData()->text(); KUrl u(url); if (u.isValid()) { WebWindow *w = qobject_cast<WebWindow *>(parent()); QString title = url.contains(w->url().url()) ? w->title() : url; bookmark = root.addBookmark(title, url); } } else { return false; } QAction *destAction = actionAt(dropEvent->pos()); if (destAction && destAction == m_dropAction) { if (actions().indexOf(m_dropAction) > 0) { destAction = actions().at(actions().indexOf(m_dropAction) - 1); } else { destAction = actions().at(1); } } if (destAction) { KBookmarkActionInterface *destBookmarkAction = dynamic_cast<KBookmarkActionInterface *>(destAction); QWidget *widgetAction = widgetForAction(destAction); if (destBookmarkAction && !destBookmarkAction->bookmark().isNull() && widgetAction && bookmark.address() != destBookmarkAction->bookmark().address()) { KBookmark destBookmark = destBookmarkAction->bookmark(); if (!destBookmark.isGroup()) { if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() / 2)) { root.moveBookmark(bookmark, destBookmark); } else { root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark)); } } else { if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75)) { root.moveBookmark(bookmark, destBookmark); } else if ((dropEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25)) { root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark)); } else { destBookmark.toGroup().addBookmark(bookmark); } } BookmarkManager::self()->emitChanged(); } } else { root.deleteBookmark(bookmark); bookmark = root.addBookmark(bookmark); if (dropEvent->pos().x() < widgetForAction(actions().first())->pos().x()) { root.moveBookmark(bookmark, KBookmark()); } BookmarkManager::self()->emitChanged(); } dropEvent->accept(); } break; default: break; } QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); // These events need to be handled only for Bookmark actions and not the bar if (watched != this && mouseEvent) { switch (event->type()) { case QEvent::MouseButtonPress: // drag handling { QPoint pos = mapFromGlobal(QCursor::pos()); KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(actionAt(pos)); if (action && mouseEvent->button() != Qt::MiddleButton) { m_dragAction = actionAt(pos); m_startDragPos = pos; // The menu is displayed only when the mouse button is released if (action->bookmark().isGroup()) return true; } } break; case QEvent::MouseMove: { int distance = (mapFromGlobal(QCursor::pos()) - m_startDragPos).manhattanLength(); if (!m_currentMenu && distance >= QApplication::startDragDistance()) { startDrag(); } } break; case QEvent::MouseButtonRelease: { QPoint destPos = mapFromGlobal(QCursor::pos()); int distance = (destPos - m_startDragPos).manhattanLength(); KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(actionAt(destPos)); if (action) { if (action->bookmark().isGroup()) { if (mouseEvent->button() == Qt::MiddleButton) { BookmarkManager::self()->owner()->loadBookmarkFolder(action->bookmark()); } else if (distance < QApplication::startDragDistance()) { KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(actionAt(m_startDragPos)); QPoint actionPos = mapToGlobal(widgetForAction(menu)->pos()); menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + widgetForAction(menu)->height())); } } else { if (!action->bookmark().isNull() && !action->bookmark().isSeparator()) { if (mouseEvent->button() == Qt::MiddleButton) { BookmarkManager::self()->owner()->loadBookmarkInNewTab(action->bookmark()); } } } } } break; default: break; } } return QObject::eventFilter(watched, event); }
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags wf) : QMainWindow(parent, wf) { //setMinimumSize(geometry().size()); //setMaximumSize(geometry().size()); contrdirs[Cell::U] = Cell::D; contrdirs[Cell::R] = Cell::L; contrdirs[Cell::D] = Cell::U; contrdirs[Cell::L] = Cell::R; #ifndef QTOPIA_PHONE QString appdir = qApp->applicationDirPath(); soundpath = appdir + "/sounds/"; if(!QFile::exists(soundpath)) soundpath = appdir + "/../share/qnetwalk/sounds/"; winsound = new QSound(soundpath + "win.wav"); turnsound = new QSound(soundpath + "turn.wav"); clicksound = new QSound(soundpath + "click.wav"); startsound = new QSound(soundpath + "start.wav"); connectsound = new QSound(soundpath + "connect.wav"); #else QString appdir = qApp->applicationDirPath(); soundpath = ":sound/qnetwalk/"; winsound = new QSound(soundpath + "win"); turnsound = new QSound(soundpath + "turn"); clicksound = new QSound(soundpath + "click"); startsound = new QSound(soundpath + "start"); connectsound = new QSound(soundpath + "connect"); #endif QSettings settings("QNetEor", "QNetEor"); settings.beginGroup("QNetEor"); username = settings.value("Username", getenv("USER")).toString(); bool issound = settings.value("Sound", true).toBool(); highscores = settings.value("Highscores").toStringList(); if(highscores.count() != NumHighscores * 8) { highscores.clear(); for(int i = 1; i < 5; i++) { for(int scores = 20 * i; scores < 30 * i; scores += i) { highscores.append("..."); highscores.append(QString::number(scores)); } } } skill = settings.value("Skill", Novice).toInt(); if(skill != Novice && skill != Normal && skill != Expert) skill = Master; settings.endGroup(); for(int i = 1; i < qApp->argc(); i++) { QString argument = qApp->argv()[i]; if(argument == "-novice") skill = Novice; else if(argument == "-amateur") skill = Normal; else if(argument == "-expert") skill = Expert; else if(argument == "-master") skill = Master; else if(argument == "-nosound") issound = false; } setWindowTitle(tr("QNeoroid")); setWindowIcon(QPixmap(":/computer2.png")); #ifdef QTOPIA_PHONE QMenu *m = QSoftMenuBar::menuFor(this); #else QMenu *m = menuBar()->addMenu(tr("Options")); #endif soundaction = new QAction(tr("&Sound"), this); soundaction->setCheckable(true); soundaction->setChecked(issound); gamemenu = m->addMenu(tr("&Game")); gamemenu->addAction(QPixmap(":/newgame.png"), tr("&New"), this, SLOT(newGame())); gamemenu->addAction(QPixmap(":/highscores.png"), tr("&Highscores"), this, SLOT(showHighscores())); gamemenu->addAction(soundaction); #ifndef QTOPIA_PHONE gamemenu->addSeparator(); gamemenu->addAction(QPixmap(":/quit.png"), tr("&Quit"), qApp, SLOT(closeAllWindows())); #endif skillmenu = m->addMenu(tr("&Skill")); skillActionGroup = new QActionGroup(this); QAction* action; action = skillActionGroup->addAction(tr("&Novice")); action->setCheckable(true); if(skill == Novice) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillNovice())); action = skillActionGroup->addAction(tr("&Amateur")); action->setCheckable(true); if(skill == Normal) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillNormal())); action = skillActionGroup->addAction(tr("&Expert")); action->setCheckable(true); if(skill == Expert) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillExpert())); action = skillActionGroup->addAction(tr("&Master")); action->setCheckable(true); if(skill == Master) action->setChecked(true); connect(action, SIGNAL(triggered()), this, SLOT(setSkillMaster())); skillmenu->addActions(skillActionGroup->actions()); QMenu* helpmenu = m->addMenu(tr("&Help")); helpmenu->addAction(tr("&Rules of Play"), this, SLOT(help())); helpmenu->addAction(QPixmap(":/homepage.png"), tr("&Homepage"), this, SLOT(openHomepage())); helpmenu->addSeparator(); helpmenu->addAction(QPixmap(":/qnetwalk.png"), tr("&About QNeoroid"), this, SLOT(about())); helpmenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); QToolBar* toolbar = new QToolBar(this); toolbar->setFloatable(false); toolbar->setMovable(false); toolbar->addAction(QPixmap(":/newgame.png"), tr("New Game"), this, SLOT(newGame())); toolbar->addAction(QPixmap(":/highscores.png"), tr("Show Highscores"), this, SLOT(showHighscores())); //toolbar->addWidget(new QLabel(tr("Moves"),this)); lcd = new QLCDNumber(toolbar); lcd->setFrameStyle(QFrame::Plain); toolbar->addWidget(lcd); //toolbar->addWidget(new QLabel(tr("Left:"),this)); cellsLcd = new QLCDNumber(toolbar); cellsLcd->setFrameStyle(QFrame::Plain); toolbar->addWidget(cellsLcd); addToolBar(toolbar); Cell::initPixmaps(); srand(time(0)); setSkill(skill); installEventFilter(this); resize(240,320); }
MainWindow::MainWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, NULL), m_historyIndex(0), m_inputHistory() { setGeometry(300, 300, 1000, 600); // // The main frame and its input and log widgets // QFrame* mainWindowFrame = new QFrame(this); // The input line m_inputEdit = new QLineEdit(mainWindowFrame); connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot); m_inputEdit->installEventFilter(this); // The log view m_consoleView = new DebuggerView(DVT_CONSOLE, m_machine, mainWindowFrame); m_consoleView->setFocusPolicy(Qt::NoFocus); m_consoleView->setPreferBottom(true); QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); vLayout->addWidget(m_consoleView); vLayout->addWidget(m_inputEdit); vLayout->setSpacing(3); vLayout->setContentsMargins(4,0,4,2); setCentralWidget(mainWindowFrame); // // Options Menu // // Create three commands m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this); m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this); m_runToCursorAct = new QAction("Run to Cursor", this); m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); connect(m_breakpointToggleAct, &QAction::triggered, this, &MainWindow::toggleBreakpointAtCursor); connect(m_breakpointEnableAct, &QAction::triggered, this, &MainWindow::enableBreakpointAtCursor); connect(m_runToCursorAct, &QAction::triggered, this, &MainWindow::runToCursor); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); rightBarGroup->setObjectName("rightbargroup"); QAction* rightActRaw = new QAction("Raw Opcodes", this); QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); QAction* rightActComments = new QAction("Comments", this); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); rightActRaw->setActionGroup(rightBarGroup); rightActEncrypted->setActionGroup(rightBarGroup); rightActComments->setActionGroup(rightBarGroup); rightActRaw->setShortcut(QKeySequence("Ctrl+R")); rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); connect(rightBarGroup, &QActionGroup::triggered, this, &MainWindow::rightBarChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addAction(m_breakpointToggleAct); optionsMenu->addAction(m_breakpointEnableAct); optionsMenu->addAction(m_runToCursorAct); optionsMenu->addSeparator(); optionsMenu->addActions(rightBarGroup->actions()); // // Images menu // image_interface_iterator imageIterTest(m_machine->root_device()); if (imageIterTest.first() != NULL) { createImagesMenu(); } // // Dock window menu // QMenu* dockMenu = menuBar()->addMenu("Doc&ks"); setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); // The processor dock QDockWidget* cpuDock = new QDockWidget("processor", this); cpuDock->setObjectName("cpudock"); cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea); m_procFrame = new ProcessorDockWidget(m_machine, cpuDock); cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame)); addDockWidget(Qt::LeftDockWidgetArea, cpuDock); dockMenu->addAction(cpuDock->toggleViewAction()); // The disassembly dock QDockWidget* dasmDock = new QDockWidget("dasm", this); dasmDock->setObjectName("dasmdock"); dasmDock->setAllowedAreas(Qt::TopDockWidgetArea); m_dasmFrame = new DasmDockWidget(m_machine, dasmDock); dasmDock->setWidget(m_dasmFrame); connect(m_dasmFrame->view(), &DebuggerView::updated, this, &MainWindow::dasmViewUpdated); addDockWidget(Qt::TopDockWidgetArea, dasmDock); dockMenu->addAction(dasmDock->toggleViewAction()); }
/** * @brief FilesWidget::FilesWidget * @param parent */ FilesWidget::FilesWidget(QWidget *parent) : QWidget(parent), ui(new Ui::FilesWidget) { m_instance = this; ui->setupUi(this); ui->statusLabel->setText(tr("%n movies", "", 0)); #ifdef Q_OS_MAC QFont font = ui->files->font(); font.setPointSize(font.pointSize()-2); ui->files->setFont(font); #endif #ifdef Q_OS_WIN32 ui->verticalLayout->setContentsMargins(0, 0, 0, 1); #endif m_lastMovie = 0; m_mouseIsIn = false; m_movieProxyModel = new MovieProxyModel(this); m_movieProxyModel->setSourceModel(Manager::instance()->movieModel()); m_movieProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_movieProxyModel->setDynamicSortFilter(true); ui->files->setModel(m_movieProxyModel); for (int i=1, n=ui->files->model()->columnCount() ; i<n ; ++i) { ui->files->setColumnWidth(i, 24); ui->files->setColumnHidden(i, true); } ui->files->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); ui->files->setIconSize(QSize(12, 12)); foreach (const MediaStatusColumns &column, Settings::instance()->mediaStatusColumns()) ui->files->setColumnHidden(MovieModel::mediaStatusToColumn(column), false); m_alphaList = new AlphabeticalList(this, ui->files); m_baseLabelCss = ui->sortByYear->styleSheet(); m_activeLabelCss = ui->sortByNew->styleSheet(); QMenu *mediaStatusColumnsMenu = new QMenu(tr("Media Status Columns"), ui->files); for (int i=MediaStatusFirst, n=MediaStatusLast ; i<=n ; ++i) { QAction *action = new QAction(MovieModel::mediaStatusToText(static_cast<MediaStatusColumns>(i)), this); action->setProperty("mediaStatusColumn", i); action->setCheckable(true); action->setChecked(Settings::instance()->mediaStatusColumns().contains(static_cast<MediaStatusColumns>(i))); connect(action, SIGNAL(triggered()), this, SLOT(onActionMediaStatusColumn())); mediaStatusColumnsMenu->addAction(action); } QMenu *labelsMenu = new QMenu(tr("Label"), ui->files); QMapIterator<int, QString> it(Helper::instance()->labels()); while (it.hasNext()) { it.next(); QAction *action = new QAction(it.value(), this); action->setIcon(Helper::instance()->iconForLabel(it.key())); action->setProperty("color", it.key()); connect(action, SIGNAL(triggered()), this, SLOT(onLabel())); labelsMenu->addAction(action); } QAction *actionMultiScrape = new QAction(tr("Load Information"), this); QAction *actionMarkAsWatched = new QAction(tr("Mark as watched"), this); QAction *actionMarkAsUnwatched = new QAction(tr("Mark as unwatched"), this); QAction *actionLoadStreamDetails = new QAction(tr("Load Stream Details"), this); QAction *actionMarkForSync = new QAction(tr("Add to Synchronization Queue"), this); QAction *actionUnmarkForSync = new QAction(tr("Remove from Synchronization Queue"), this); QAction *actionOpenFolder = new QAction(tr("Open Movie Folder"), this); m_contextMenu = new QMenu(ui->files); m_contextMenu->addAction(actionMultiScrape); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionMarkAsWatched); m_contextMenu->addAction(actionMarkAsUnwatched); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionLoadStreamDetails); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionMarkForSync); m_contextMenu->addAction(actionUnmarkForSync); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionOpenFolder); m_contextMenu->addSeparator(); m_contextMenu->addMenu(labelsMenu); m_contextMenu->addMenu(mediaStatusColumnsMenu); connect(actionMultiScrape, SIGNAL(triggered()), this, SLOT(multiScrape())); connect(actionMarkAsWatched, SIGNAL(triggered()), this, SLOT(markAsWatched())); connect(actionMarkAsUnwatched, SIGNAL(triggered()), this, SLOT(markAsUnwatched())); connect(actionLoadStreamDetails, SIGNAL(triggered()), this, SLOT(loadStreamDetails())); connect(actionMarkForSync, SIGNAL(triggered()), this, SLOT(markForSync())); connect(actionUnmarkForSync, SIGNAL(triggered()), this, SLOT(unmarkForSync())); connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolder())); connect(ui->files, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(ui->files->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(itemActivated(QModelIndex, QModelIndex))); connect(ui->files->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setAlphaListData())); connect(ui->files, SIGNAL(sigLeftEdge(bool)), this, SLOT(onLeftEdge(bool))); connect(ui->files, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(playMovie(QModelIndex))); connect(m_alphaList, SIGNAL(sigAlphaClicked(QString)), this, SLOT(scrollToAlpha(QString))); connect(ui->sortByNew, SIGNAL(clicked()), this, SLOT(onSortByNew())); connect(ui->sortByName, SIGNAL(clicked()), this, SLOT(onSortByName())); connect(ui->sortByLastAdded, SIGNAL(clicked()), this, SLOT(onSortByAdded())); connect(ui->sortBySeen, SIGNAL(clicked()), this, SLOT(onSortBySeen())); connect(ui->sortByYear, SIGNAL(clicked()), this, SLOT(onSortByYear())); connect(m_movieProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(onViewUpdated())); connect(m_movieProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(onViewUpdated())); }
void QvvMainWindow::setupMenuBar() { /*--------------------------------------------------------------------*/ QMenu *menu; toolbar = new QToolBar( this ); toolbar->setVisible( opt_use_toolbar ? 1 : 0 ); menu = menuBar()->addMenu( tr("&File") ); QAction *action; /* action = menu->addAction(tr("Save layout...")); connect(action, SIGNAL(triggered()), this, SLOT(saveLayout())); action = menu->addAction(tr("Load layout...")); connect(action, SIGNAL(triggered()), this, SLOT(loadLayout())); action = menu->addAction(tr("Switch layout direction")); connect(action, SIGNAL(triggered()), this, SLOT(switchLayoutDirection())); menu->addSeparator(); */ action = menu->addAction( tr("&Reload directory"), this, SLOT(slotReloadDir()), Qt::Key_F5 ); action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Delete selected images"), this, SLOT(slotDeleteSelected()), Qt::Key_Delete ); //action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Quit"), this, SLOT(close()), Qt::AltModifier + Qt::Key_X ); action->setIcon( QIcon( ":/images/system-log-out.png" ) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&View")); action = menu->addAction( tr("&Toggle toolbar"), this, SLOT(slotToggleToolbar()) ); action = menu->addAction( tr("Enable &thumbnails") ); action->setCheckable( true ); action->setChecked( opt_thumbs ); action->setShortcut( Qt::Key_F6 ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotThumbs()) ); action = menu->addAction( tr("Show d&irectories only") ); action->setCheckable( true ); action->setChecked( opt_dirs_only ); action->setShortcut( Qt::AltModifier + Qt::Key_I ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotShowDirsOnly()) ); menu->addSeparator(); action = menu->addAction( tr("Sort by &Name"), this, SLOT(slotSortColumn1()), Qt::AltModifier + Qt::Key_N ); action = menu->addAction( tr("Sort by &Modify Time"), this, SLOT(slotSortColumn3()), Qt::AltModifier + Qt::Key_M ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Go")); action = menu->addAction( tr("Go to p&arent directory"), this, SLOT(slotGoUp()), Qt::Key_Backspace ); action->setIcon( QIcon( ":/images/go-up.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Change &directory"), this, SLOT(slotChangeDir()), Qt::AltModifier + Qt::Key_D ); action->setIcon( QIcon( ":/images/folder.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Go to &home directory"), this, SLOT(slotHomeDir()), Qt::AltModifier + Qt::Key_Home ); action->setIcon( QIcon( ":/images/go-home.png" ) ); toolbar->addAction( action ); menu->addSeparator(); action = menu->addAction( tr("Go to &Random image"), this, SLOT(slotRandomItem()), Qt::Key_Asterisk ); action = menu->addAction( tr("Activate current item"), this, SLOT(enterCurrent()), Qt::Key_Right ); action = menu->addAction( tr("Display all &selected images"), this, SLOT(enterAllSelected()), Qt::ControlModifier + Qt::Key_Right ); action->setIcon( QIcon( ":/images/view_all.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Window")); action = menu->addAction( tr("&New browser window"), this, SLOT(slotNewWindow()), Qt::Key_F3 ); action->setIcon( QIcon( ":/images/window-new.png" ) ); toolbar->addAction( action ); menu->addAction( tr("&Close window"), this, SLOT(close()), Qt::Key_F4 ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Settings")); action = menu->addAction( tr("Create thumbnails if needed") ); action->setCheckable( true ); action->setChecked( opt_create_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotCreateThumbs()) ); action = menu->addAction( tr("Create smooth thumbnails") ); action->setCheckable( true ); action->setChecked( opt_create_smooth_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotSmoothThumbs()) ); action = menu->addAction( tr("Create new thumbnails in JPEG for JPEGs") ); action->setCheckable( true ); action->setChecked( opt_create_jpeg_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotJPEGThumbs()) ); menu->addSeparator(); action = menu->addAction( tr("Use toolbar upon startup") ); action->setCheckable( true ); action->setChecked( opt_use_toolbar ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotUseToolbar()) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Help") ); action = menu->addAction( tr("&Help Contents"), this, SLOT(slotHelp()), Qt::Key_F1 ); action->setIcon( QIcon( ":/images/help-browser.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("&About"), this, SLOT(slotAbout()), Qt::AltModifier + Qt::Key_A ); action->setIcon( QIcon( ":/images/face-glasses.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ addToolBar( toolbar ); }
PianorollEditor::PianorollEditor(QWidget* parent) : QMainWindow(parent) { setWindowTitle(QString("MuseScore")); waveView = 0; _score = 0; staff = 0; QWidget* mainWidget = new QWidget; QToolBar* tb = addToolBar(tr("toolbar1")); tb->addAction(getAction("undo")); tb->addAction(getAction("redo")); tb->addSeparator(); tb->addAction(getAction("sound-on")); #ifdef HAS_MIDI tb->addAction(getAction("midi-on")); #endif QAction* a = getAction("follow"); a->setCheckable(true); a->setChecked(preferences.followSong); tb->addAction(a); tb->addSeparator(); tb->addAction(getAction("rewind")); tb->addAction(getAction("play")); tb->addSeparator(); showWave = new QAction(tr("Wave"), tb); showWave->setToolTip(tr("show wave display")); showWave->setCheckable(true); showWave->setChecked(false); connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool))); tb->addAction(showWave); //------------- tb = addToolBar(tr("toolbar2")); VoiceSelector* vs = new VoiceSelector; tb->addWidget(vs); tb->addSeparator(); tb->addWidget(new QLabel(tr("Cursor:"))); pos = new Awl::PosLabel; tb->addWidget(pos); Awl::PitchLabel* pl = new Awl::PitchLabel(); tb->addWidget(pl); tb->addSeparator(); tb->addWidget(new QLabel(tr("Velocity:"))); veloType = new QComboBox; veloType->addItem(tr("offset"), MScore::OFFSET_VAL); veloType->addItem(tr("user"), MScore::USER_VAL); tb->addWidget(veloType); velocity = new QSpinBox; velocity->setRange(-1, 127); velocity->setSpecialValueText("--"); velocity->setReadOnly(true); tb->addWidget(velocity); tb->addWidget(new QLabel(tr("Pitch:"))); pitch = new Awl::PitchEdit; pitch->setReadOnly(true); tb->addWidget(pitch); //------------- qreal xmag = .1; ruler = new Ruler; ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); ruler->setFixedHeight(rulerHeight); ruler->setMag(xmag, 1.0); Piano* piano = new Piano; piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); piano->setFixedWidth(pianoWidth); gv = new PianoView; gv->scale(xmag, 1.0); gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); hsb = new QScrollBar(Qt::Horizontal); connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(rangeChanged(int,int))); // layout QHBoxLayout* hbox = new QHBoxLayout; hbox->setSpacing(0); hbox->addWidget(piano); hbox->addWidget(gv); split = new QSplitter(Qt::Vertical); split->setLineWidth(0); split->setMidLineWidth(0); QWidget* split1 = new QWidget; split1->setLayout(hbox); split->addWidget(split1); QGridLayout* layout = new QGridLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); mainWidget->setLayout(layout); layout->setColumnMinimumWidth(0, pianoWidth + 5); layout->setSpacing(0); layout->addWidget(tb, 0, 1, 1, 1); layout->addWidget(ruler, 1, 1); layout->addWidget(split, 2, 0, 1, 2); layout->addWidget(hsb, 3, 1); setCentralWidget(mainWidget); connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int))); connect(gv, SIGNAL(magChanged(double,double)), ruler, SLOT(setMag(double,double))); connect(gv, SIGNAL(magChanged(double,double)), piano, SLOT(setMag(double,double))); connect(gv, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int))); connect(piano, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(gv, SIGNAL(posChanged(const Pos&)), ruler, SLOT(setPos(const Pos&))); connect(ruler, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(hsb, SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(gv, SIGNAL(xposChanged(int)), SLOT(setXPos(int))); connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(ruler, SIGNAL(locatorMoved(int)), SLOT(moveLocator(int))); connect(veloType, SIGNAL(activated(int)), SLOT(veloTypeChanged(int))); connect(velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int))); connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(piano, SIGNAL(keyPressed(int)), SLOT(keyPressed(int))); connect(piano, SIGNAL(keyReleased(int)), SLOT(keyReleased(int))); resize(800, 400); QActionGroup* ag = new QActionGroup(this); a = new QAction(this); a->setData("delete"); a->setShortcut(Qt::Key_Delete); ag->addAction(a); addActions(ag->actions()); connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); setXpos(0); }
void MainWindow::setupUi() { QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setSpacing(0); mainLayout->setMargin(0); setLayout(mainLayout); mpPlayerLayout = new QVBoxLayout(); mpControl = new QWidget(this); mpControl->setMaximumHeight(25); //mpPreview = new QLable(this); mpTimeSlider = new Slider(mpControl); mpTimeSlider->setDisabled(true); //mpTimeSlider->setFixedHeight(8); mpTimeSlider->setMaximumHeight(8); mpTimeSlider->setTracking(true); mpTimeSlider->setOrientation(Qt::Horizontal); mpTimeSlider->setMinimum(0); mpCurrent = new QLabel(mpControl); mpCurrent->setToolTip(tr("Current time")); mpCurrent->setMargin(2); mpCurrent->setText("00:00:00"); mpEnd = new QLabel(mpControl); mpEnd->setToolTip(tr("Duration")); mpEnd->setMargin(2); mpEnd->setText("00:00:00"); mpTitle = new QLabel(mpControl); mpTitle->setToolTip(tr("Render engine")); mpTitle->setText("QPainter"); mpTitle->setIndent(8); mpSpeed = new QLabel("1.00"); mpSpeed->setMargin(1); mpSpeed->setToolTip(tr("Speed. Ctrl+Up/Down")); mPlayPixmap = QPixmap(":/theme/button-play-pause.png"); int w = mPlayPixmap.width(), h = mPlayPixmap.height(); mPausePixmap = mPlayPixmap.copy(QRect(w/2, 0, w/2, h)); mPlayPixmap = mPlayPixmap.copy(QRect(0, 0, w/2, h)); qDebug("%d x %d", mPlayPixmap.width(), mPlayPixmap.height()); mpPlayPauseBtn = new Button(mpControl); int a = qMin(w/2, h); const int kMaxButtonIconWidth = 20; const int kMaxButtonIconMargin = kMaxButtonIconWidth/3; a = qMin(a, kMaxButtonIconWidth); mpPlayPauseBtn->setIconWithSates(mPlayPixmap); mpPlayPauseBtn->setIconSize(QSize(a, a)); mpPlayPauseBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpStopBtn = new Button(mpControl); mpStopBtn->setIconWithSates(QPixmap(":/theme/button-stop.png")); mpStopBtn->setIconSize(QSize(a, a)); mpStopBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpBackwardBtn = new Button(mpControl); mpBackwardBtn->setIconWithSates(QPixmap(":/theme/button-rewind.png")); mpBackwardBtn->setIconSize(QSize(a, a)); mpBackwardBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpForwardBtn = new Button(mpControl); mpForwardBtn->setIconWithSates(QPixmap(":/theme/button-fastforward.png")); mpForwardBtn->setIconSize(QSize(a, a)); mpForwardBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpOpenBtn = new Button(mpControl); mpOpenBtn->setToolTip(tr("Open")); mpOpenBtn->setIconWithSates(QPixmap(":/theme/open_folder.png")); mpOpenBtn->setIconSize(QSize(a, a)); mpOpenBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpInfoBtn = new Button(); mpInfoBtn->setToolTip(QString("Media information. Not implemented.")); mpInfoBtn->setIconWithSates(QPixmap(":/theme/info.png")); mpInfoBtn->setIconSize(QSize(a, a)); mpInfoBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpCaptureBtn = new Button(); mpCaptureBtn->setIconWithSates(QPixmap(":/theme/screenshot.png")); mpCaptureBtn->setIconSize(QSize(a, a)); mpCaptureBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpVolumeBtn = new Button(); mpVolumeBtn->setIconWithSates(QPixmap(":/theme/button-max-volume.png")); mpVolumeBtn->setIconSize(QSize(a, a)); mpVolumeBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); mpVolumeSlider = new Slider(); mpVolumeSlider->hide(); mpVolumeSlider->setOrientation(Qt::Horizontal); mpVolumeSlider->setMinimum(0); const int kVolumeSliderMax = 100; mpVolumeSlider->setMaximum(kVolumeSliderMax); mpVolumeSlider->setMaximumHeight(8); mpVolumeSlider->setMaximumWidth(88); mpVolumeSlider->setValue(int(1.0/kVolumeInterval*qreal(kVolumeSliderMax)/100.0)); setVolume(); mpMenuBtn = new Button(); mpMenuBtn->setAutoRaise(true); mpMenuBtn->setPopupMode(QToolButton::InstantPopup); /* mpMenuBtn->setIconWithSates(QPixmap(":/theme/search-arrow.png")); mpMenuBtn->setIconSize(QSize(a, a)); mpMenuBtn->setMaximumSize(a+kMaxButtonIconMargin+2, a+kMaxButtonIconMargin); */ QMenu *subMenu = 0; QWidgetAction *pWA = 0; mpMenu = new QMenu(mpMenuBtn); mpMenu->addAction(tr("Open Url"), this, SLOT(openUrl())); //mpMenu->addAction(tr("Online channels"), this, SLOT(onTVMenuClick())); mpMenu->addSeparator(); subMenu = new QMenu(tr("Play list")); mpMenu->addMenu(subMenu); mpPlayList = new PlayList(this); mpPlayList->setSaveFile(Config::instance().defaultDir() + "/playlist.qds"); mpPlayList->load(); connect(mpPlayList, SIGNAL(aboutToPlay(QString)), SLOT(play(QString))); pWA = new QWidgetAction(0); pWA->setDefaultWidget(mpPlayList); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? subMenu = new QMenu(tr("History")); mpMenu->addMenu(subMenu); mpHistory = new PlayList(this); mpHistory->setMaxRows(20); mpHistory->setSaveFile(Config::instance().defaultDir() + "/history.qds"); mpHistory->load(); connect(mpHistory, SIGNAL(aboutToPlay(QString)), SLOT(play(QString))); pWA = new QWidgetAction(0); pWA->setDefaultWidget(mpHistory); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? mpMenu->addSeparator(); //mpMenu->addAction(tr("Report"))->setEnabled(false); //report bug, suggestions etc. using maillist? mpMenu->addAction(tr("About"), this, SLOT(about())); mpMenu->addAction(tr("Help"), this, SLOT(help())); mpMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt())); mpMenu->addAction(tr("Donate"), this, SLOT(donate())); mpMenu->addAction(tr("Setup"), this, SLOT(setup())); mpMenu->addSeparator(); mpMenuBtn->setMenu(mpMenu); mpMenu->addSeparator(); subMenu = new QMenu(tr("Speed")); mpMenu->addMenu(subMenu); QDoubleSpinBox *pSpeedBox = new QDoubleSpinBox(0); pSpeedBox->setRange(0.01, 20); pSpeedBox->setValue(1.0); pSpeedBox->setSingleStep(0.01); pSpeedBox->setCorrectionMode(QAbstractSpinBox::CorrectToPreviousValue); pWA = new QWidgetAction(0); pWA->setDefaultWidget(pSpeedBox); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? subMenu = new ClickableMenu(tr("Repeat")); mpMenu->addMenu(subMenu); //subMenu->setEnabled(false); mpRepeatEnableAction = subMenu->addAction(tr("Enable")); mpRepeatEnableAction->setCheckable(true); connect(mpRepeatEnableAction, SIGNAL(toggled(bool)), SLOT(toggleRepeat(bool))); // TODO: move to a func or class mpRepeatBox = new QSpinBox(0); mpRepeatBox->setMinimum(-1); mpRepeatBox->setValue(-1); mpRepeatBox->setToolTip("-1: " + tr("infinity")); connect(mpRepeatBox, SIGNAL(valueChanged(int)), SLOT(setRepeateMax(int))); QLabel *pRepeatLabel = new QLabel(tr("Times")); QHBoxLayout *hb = new QHBoxLayout; hb->addWidget(pRepeatLabel); hb->addWidget(mpRepeatBox); QVBoxLayout *vb = new QVBoxLayout; vb->addLayout(hb); pRepeatLabel = new QLabel(tr("From")); mpRepeatA = new QTimeEdit(); mpRepeatA->setDisplayFormat("HH:mm:ss"); mpRepeatA->setToolTip(tr("negative value means from the end")); connect(mpRepeatA, SIGNAL(timeChanged(QTime)), SLOT(repeatAChanged(QTime))); hb = new QHBoxLayout; hb->addWidget(pRepeatLabel); hb->addWidget(mpRepeatA); vb->addLayout(hb); pRepeatLabel = new QLabel(tr("To")); mpRepeatB = new QTimeEdit(); mpRepeatB->setDisplayFormat("HH:mm:ss"); mpRepeatB->setToolTip(tr("negative value means from the end")); connect(mpRepeatB, SIGNAL(timeChanged(QTime)), SLOT(repeatBChanged(QTime))); hb = new QHBoxLayout; hb->addWidget(pRepeatLabel); hb->addWidget(mpRepeatB); vb->addLayout(hb); QWidget *wgt = new QWidget; wgt->setLayout(vb); pWA = new QWidgetAction(0); pWA->setDefaultWidget(wgt); pWA->defaultWidget()->setEnabled(false); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? mpRepeatAction = pWA; mpMenu->addSeparator(); subMenu = new ClickableMenu(tr("Subtitle")); mpMenu->addMenu(subMenu); QAction *act = subMenu->addAction(tr("Enable")); act->setCheckable(true); act->setChecked(mpSubtitle->isEnabled()); connect(act, SIGNAL(toggled(bool)), SLOT(toggoleSubtitleEnabled(bool))); act = subMenu->addAction(tr("Auto load")); act->setCheckable(true); act->setChecked(mpSubtitle->autoLoad()); connect(act, SIGNAL(toggled(bool)), SLOT(toggleSubtitleAutoLoad(bool))); subMenu->addAction(tr("Open"), this, SLOT(openSubtitle())); wgt = new QWidget(); hb = new QHBoxLayout(); wgt->setLayout(hb); hb->addWidget(new QLabel(tr("Engine"))); QComboBox *box = new QComboBox(); hb->addWidget(box); pWA = new QWidgetAction(0); pWA->setDefaultWidget(wgt); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? box->addItem("FFmpeg", "FFmpeg"); box->addItem("LibASS", "LibASS"); connect(box, SIGNAL(activated(QString)), SLOT(setSubtitleEngine(QString))); mpSubtitle->setEngines(QStringList() << box->itemData(box->currentIndex()).toString()); box->setToolTip(tr("FFmpeg supports more subtitles but only render plain text") + "\n" + tr("LibASS supports ass styles")); wgt = new QWidget(); hb = new QHBoxLayout(); wgt->setLayout(hb); hb->addWidget(new QLabel(tr("Charset"))); box = new QComboBox(); hb->addWidget(box); pWA = new QWidgetAction(0); pWA->setDefaultWidget(wgt); subMenu->addAction(pWA); //must add action after the widget action is ready. is it a Qt bug? box->addItem(tr("Auto detect"), "AutoDetect"); box->addItem(tr("System"), "System"); foreach (const QByteArray& cs, QTextCodec::availableCodecs()) { box->addItem(cs, cs); }
void ManualAlignment::probePickedCallback(void * ud, SoEventCallback * n) { Gui::View3DInventorViewer* view = reinterpret_cast<Gui::View3DInventorViewer*>(n->getUserData()); const SoEvent* ev = n->getEvent(); if (ev->getTypeId() == SoMouseButtonEvent::getClassTypeId()) { // set as handled n->getAction()->setHandled(); n->setHandled(); const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent *>(ev); if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) { // if we are in 'align' mode then handle the click event ManualAlignment* self = ManualAlignment::instance(); // Get the closest point to the camera of the whole scene. // This point doesn't need to be part of this view provider. Gui::WaitCursor wc; const SoPickedPoint * point = n->getPickedPoint(); if (point) { Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath())); if (vp && vp->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) { Gui::ViewProviderDocumentObject* that = static_cast<Gui::ViewProviderDocumentObject*>(vp); self->applyPickedProbe(that, point); const SbVec3f& vec = point->getPoint(); Gui::getMainWindow()->statusBar()->showMessage( tr("Point picked at (%1,%2,%3)") .arg(vec[0]).arg(vec[1]).arg(vec[2])); } } else { Gui::getMainWindow()->statusBar()->showMessage( tr("No point was picked")); } } else if (mbe->getButton() == SoMouseButtonEvent::BUTTON2 && mbe->getState() == SoButtonEvent::UP) { ManualAlignment* self = ManualAlignment::instance(); if (self->myAlignModel.isEmpty() || self->myFixedGroup.isEmpty()) return; self->showInstructions(); int nPoints; if (view == self->myViewer->getViewer(0)) nPoints = self->myAlignModel.activeGroup().countPoints(); else nPoints = self->myFixedGroup.countPoints(); QMenu menu; QAction* fi = menu.addAction(QLatin1String("&Align")); QAction* rem = menu.addAction(QLatin1String("&Remove last point")); //QAction* cl = menu.addAction("C&lear"); QAction* ca = menu.addAction(QLatin1String("&Cancel")); fi->setEnabled(self->canAlign()); rem->setEnabled(nPoints > 0); menu.addSeparator(); QAction* sync = menu.addAction(QLatin1String("&Synchronize views")); sync->setCheckable(true); if (self->d->sensorCam1->getAttachedNode()) sync->setChecked(true); QAction* id = menu.exec(QCursor::pos()); if (id == fi) { // call align->align(); QTimer::singleShot(300, self, SLOT(onAlign())); } else if ((id == rem) && (view == self->myViewer->getViewer(0))) { QTimer::singleShot(300, self, SLOT(onRemoveLastPointMoveable())); } else if ((id == rem) && (view == self->myViewer->getViewer(1))) { QTimer::singleShot(300, self, SLOT(onRemoveLastPointFixed())); } //else if (id == cl) { // // call align->clear(); // QTimer::singleShot(300, self, SLOT(onClear())); //} else if (id == ca) { // call align->cancel(); QTimer::singleShot(300, self, SLOT(onCancel())); } else if (id == sync) { // setup sensor connection if (sync->isChecked()) { SoCamera* cam1 = self->myViewer->getViewer(0)->getCamera(); SoCamera* cam2 = self->myViewer->getViewer(1)->getCamera(); if (cam1 && cam2) { self->d->sensorCam1->attach(cam1); self->d->rot_cam1 = cam1->orientation.getValue(); self->d->pos_cam1 = cam1->position.getValue(); self->d->sensorCam2->attach(cam2); self->d->rot_cam2 = cam2->orientation.getValue(); self->d->pos_cam2 = cam2->position.getValue(); } } else { self->d->sensorCam1->detach(); self->d->sensorCam2->detach(); } } } } }