AS_NAMESPACE_START EditorTabs::EditorTabs(QWidget *parent) : QTabWidget(parent), _finder(nullptr) { _connections << connect(parent, SIGNAL(editCopy()), this, SLOT(onEditCopy())); _connections << connect(parent, SIGNAL(editCut()), this, SLOT(onEditCut())); _connections << connect(parent, SIGNAL(editFind()), this, SLOT(onEditFind())); _connections << connect(parent, SIGNAL(editGoto()), this, SLOT(onEditGoto())); _connections << connect(parent, SIGNAL(editPaste()), this, SLOT(onEditPaste())); _connections << connect(parent, SIGNAL(editRedo()), this, SLOT(onEditRedo())); _connections << connect(parent, SIGNAL(editReplace()), this, SLOT(onEditReplace())); _connections << connect(parent, SIGNAL(editUndo()), this, SLOT(onEditUndo())); _connections << connect(parent, SIGNAL(fileClose()), this, SLOT(onFileClose())); _connections << connect(parent, SIGNAL(fileCloseAll()), this, SLOT(onFileCloseAll())); _connections << connect(parent, SIGNAL(fileOpen(QString)), this, SLOT(onFileOpen(QString))); _connections << connect(parent, SIGNAL(fileSave()), this, SLOT(onFileSave())); _connections << connect(parent, SIGNAL(fileSaveAll()), this, SLOT(onFileSaveAll())); _connections << connect(this, &QTabWidget::tabCloseRequested, this, &EditorTabs::onTabCloseRequested); _connections << connect(tabBar(), &QTabBar::tabMoved, this, &EditorTabs::onTabMoved); _connections << connect(this, &EditorTabs::currentChanged, this, &EditorTabs::onCurrentChanged); _connections << connect(this, SIGNAL(fileChanged(QString)), parent, SLOT(onFileChanged(QString))); _connections << connect(this, SIGNAL(fileSaved(QString)), parent, SLOT(onFileSaved(QString))); setMovable(true); setTabsClosable(true); }
void Plugin::postLoad() { Q_ASSERT(_layoutManager); Q_ASSERT(mainWindow); IonLayout::ZoneDefinition def; def.name = "central"; def.orientation = Qt::Vertical; def.parentPath = ""; def.after = "left"; def.before = "right"; def.hideIfEmpty = false; def.sizeWeight = 700; def.childrenClosable = true; def.subZonesContainerType = IonLayout::ZoneDefinition::Boxed; def.widgetsContainerType = IonLayout::ZoneDefinition::Tabbed; _layoutManager->addZone(def); def.name = "central_footer"; def.orientation = Qt::Vertical; def.parentPath = "central"; def.after = "central"; def.before = ""; def.hideIfEmpty = true; def.sizeWeight = 1; def.childrenClosable = false; def.subZonesContainerType = IonLayout::ZoneDefinition::Tabbed; def.widgetsContainerType = IonLayout::ZoneDefinition::Boxed; _layoutManager->addZone(def); def.name = "left"; def.orientation = Qt::Vertical; def.parentPath = ""; def.after = ""; def.before = "central"; def.hideIfEmpty = false; def.sizeWeight = 200; def.childrenClosable = false; def.subZonesContainerType = IonLayout::ZoneDefinition::Split; def.widgetsContainerType = IonLayout::ZoneDefinition::Tabbed; _layoutManager->addZone(def); def.name = "leftbottom"; def.orientation = Qt::Vertical; def.parentPath = "left"; def.after = "left"; def.before = ""; def.hideIfEmpty = true; def.sizeWeight = 150; def.childrenClosable = false; def.subZonesContainerType = IonLayout::ZoneDefinition::Split; def.widgetsContainerType = IonLayout::ZoneDefinition::Tabbed; _layoutManager->addZone(def); def.name = "right"; def.orientation = Qt::Vertical; def.parentPath = ""; def.after = "central"; def.before = ""; def.hideIfEmpty = true; def.sizeWeight = 150; def.childrenClosable = false; def.subZonesContainerType = IonLayout::ZoneDefinition::Split; def.widgetsContainerType = IonLayout::ZoneDefinition::Tabbed; _layoutManager->addZone(def); Private::FileTreeWidget *fileTree = new Private::FileTreeWidget(); _layoutManager->add("left", fileTree); connect(fileTree, SIGNAL(fileActivated(QString, int)), this, SLOT(openFile(QString, int))); getEditorWidgetBuilder()->registerComponentFactory("text", new Private::DefaultLineNumberAreaFactory()); QMenuBar *menuBar = mainWindow->menuBar(); QMenu *fileMenu = menuBar->addMenu("&File"); fileMenu->addAction("&Save", this, SLOT(onFileSave()), QKeySequence(Qt::CTRL + Qt::Key_S)); fileMenu->addAction("&Close", this, SLOT(onFileClose()), QKeySequence(Qt::CTRL + Qt::Key_W)); QMenu *editMenu = menuBar->addMenu("&Edit"); editMenu->addAction("&Find", this, SLOT(onEditSearch()), QKeySequence(Qt::CTRL + Qt::Key_F)); editMenu->addAction("Find &Next", this, SLOT(onEditSearchNext()), QKeySequence(Qt::CTRL + Qt::Key_G)); editMenu->addAction("Find &Previous", this, SLOT(onEditSearchPrev()), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G)); _searchPanel = new SearchPanel(); _searchPanel->setEditorPlugin(this); _layoutManager->add("central/central_footer", _searchPanel); }
bool DiffAnalystWindow::initMenuBar() { bool ret=false; // //////////////////////////////////////////////////////////////////// // FILE m_pFileMenu = new QPopupMenu (this); if(m_pFileMenu == NULL) return false; menuBar ()->insertItem ("&File", m_pFileMenu); // New m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileNew)), "&New Session Wizard", this, SLOT (onFileNew ()), CTRL + Key_N); // Open m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileOpen)), "&Open", this, SLOT (onFileOpen ()), CTRL + Key_O); // ------------------- m_pFileMenu->insertSeparator (); // Save m_SaveId = m_pFileMenu->insertItem (QIconSet (QPixmap (XpmFileSave)), "&Save", this, SLOT (onFileSave ()), CTRL + Key_S); m_pFileMenu->setItemEnabled (m_SaveId, false); // Save As m_SaveAsId = m_pFileMenu->insertItem (QIconSet(QPixmap()), "Save &As", this, SLOT (onFileSaveAs ()), CTRL + Key_A); m_pFileMenu->setItemEnabled (m_SaveAsId, false); // ------------------- // m_pFileMenu->insertSeparator (); // export data // m_ExportDataId = m_pFileMenu->insertItem ("&Export...", this, // SLOT (onExportData ())); // m_pFileMenu->setItemEnabled (m_ExportDataId, false); // ------------------- m_pFileMenu->insertSeparator (); // Close m_CloseId = m_pFileMenu->insertItem ("&Close", this, SLOT (onFileClose ()), CTRL + Key_W); m_CloseAllId = m_pFileMenu->insertItem ("Close Al&l", this, SLOT (onCloseAllWindows ())); // Quit m_pFileMenu->insertItem ("&Quit", this, SLOT (close ()), CTRL + Key_Q); QObject::connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (onAboutToQuit ())); // //////////////////////////////////////////////////////////////////// // SETTINGS // m_pSettingsMenu = new QPopupMenu (this); // if(m_pSettingsMenu == NULL) return false; // menuBar ()->insertItem ("&Settings", m_pSettingsMenu); // ///////////////////////////////////////////////////////////////////// // TOOLS m_pToolsMenu = new QPopupMenu (this); if(m_pToolsMenu == NULL) return false; m_pToolsMenu->setCheckable (TRUE); connect (m_pToolsMenu, SIGNAL (aboutToShow ()), this, SLOT (toolsMenuAboutToShow ())); menuBar ()->insertItem ("&Tools", m_pToolsMenu); // ///////////////////////////////////////////////////////////////////// // VIEW m_pViewMenu = new QPopupMenu (this); if(m_pViewMenu == NULL) return false; menuBar ()->insertItem ("&View", m_pViewMenu); // View Management m_ViewManageId = m_pViewMenu->insertItem (QPixmap(viewconfig),"&View Management", this, SLOT (onViewManage ())); // ///////////////////////////////////////////////////////////////////// // WINDOWS m_pWindowsMenu = new QPopupMenu (this); if(m_pWindowsMenu == NULL) return false; connect (m_pWindowsMenu, SIGNAL (aboutToShow ()), this, SLOT (onWindowsMenuAboutToShow ())); menuBar ()->insertItem ("&Windows", m_pWindowsMenu); // ///////////////////////////////////////////////////////////////////// // HELPS m_pHelpMenu = new QPopupMenu (this); if(m_pHelpMenu == NULL) return false; menuBar ()->insertItem ("&Help", m_pHelpMenu); m_pHelpMenu->insertItem ("&About", this, SLOT (onHelpAbout ()), Key_F1); m_pHelpMenu->insertItem ("&Help", this, SLOT (onHelpContents ())); ret = true; return ret; }// DiffAnalystWindow::initMenuBar