diff options
author | Ken Moore <ken@ixsystems.com> | 2017-04-06 11:32:29 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-04-06 11:32:29 -0400 |
commit | a23b9f617eb1c63f07a4919455c1473edae0215d (patch) | |
tree | cab6e621992a9f529d5e722d378dd10c0d948301 /src-qt5 | |
parent | Add a tray popup message when the tray first becomes visible. (diff) | |
download | lumina-a23b9f617eb1c63f07a4919455c1473edae0215d.tar.gz lumina-a23b9f617eb1c63f07a4919455c1473edae0215d.tar.bz2 lumina-a23b9f617eb1c63f07a4919455c1473edae0215d.zip |
Add the ability to change the tab bar position/side in Lumina textedit.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/MainUI.cpp | 31 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/MainUI.h | 5 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/MainUI.ui | 53 |
3 files changed, 86 insertions, 3 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index 49314e1f..770c9a75 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -17,19 +17,29 @@ #include <QKeySequence> #include <QTimer> #include <QMessageBox> +#include <QActionGroup> MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); fontbox = new QFontComboBox(this); fontbox->setFocusPolicy(Qt::NoFocus); + fontbox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); fontSizes = new QSpinBox(this); fontSizes->setRange(5, 72); fontSizes->setValue(9); + fontSizes->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); ui->toolBar->addWidget(spacer); ui->toolBar->addWidget(fontbox); ui->toolBar->addWidget(fontSizes); + //Setup the action group for the tab location options + QActionGroup *agrp = new QActionGroup(this); + agrp->setExclusive(true); + agrp->addAction(ui->action_tabsTop); + agrp->addAction(ui->action_tabsBottom); + agrp->addAction(ui->action_tabsLeft); + agrp->addAction(ui->action_tabsRight); //Load settings settings = new QSettings("lumina-desktop","lumina-textedit"); if(settings->contains("lastfont")){ @@ -55,8 +65,14 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() ); ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() ); ui->actionShow_Popups->setChecked( settings->value("showPopupWarnings",true).toBool() ); + QString tabLoc = settings->value("tabsLocation","top").toString().toLower(); + if(tabLoc=="bottom"){ ui->action_tabsBottom->setChecked(true); ui->tabWidget->setTabPosition(QTabWidget::South);} + else if(tabLoc=="left"){ ui->action_tabsLeft->setChecked(true); ui->tabWidget->setTabPosition(QTabWidget::West);} + else if(tabLoc=="right"){ ui->action_tabsRight->setChecked(true); ui->tabWidget->setTabPosition(QTabWidget::East);} + else{ ui->action_tabsTop->setChecked(true); ui->tabWidget->setTabPosition(QTabWidget::North); } //Setup any connections + connect(agrp, SIGNAL(triggered(QAction*)), this, SLOT(changeTabsLocation(QAction*)) ); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) ); connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) ); connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(OpenFile()) ); @@ -120,6 +136,7 @@ void MainUI::updateIcons(){ ui->actionReplace->setIcon(LXDG::findIcon("edit-find-replace") ); ui->menuSyntax_Highlighting->setIcon( LXDG::findIcon("format-text-color") ); ui->actionCustomize_Colors->setIcon( LXDG::findIcon("format-fill-color") ); + ui->menuTabs_Location->setIcon( LXDG::findIcon("tab-detach") ); //icons for the special find/replace groupbox ui->tool_find_next->setIcon(LXDG::findIcon("go-down-search")); ui->tool_find_prev->setIcon(LXDG::findIcon("go-up-search")); @@ -223,6 +240,20 @@ void MainUI::changeFontSize(int newFontSize){ QApplication::setFont(currentFont, "PlainTextEditor"); } +void MainUI::changeTabsLocation(QAction *act){ + QString set; + if(act==ui->action_tabsTop){ + set = "top"; ui->tabWidget->setTabPosition(QTabWidget::North); + }else if(act==ui->action_tabsBottom){ + set = "bottom"; ui->tabWidget->setTabPosition(QTabWidget::South); + }else if(act==ui->action_tabsLeft){ + set = "left"; ui->tabWidget->setTabPosition(QTabWidget::West); + }else if(act==ui->action_tabsRight){ + set = "right"; ui->tabWidget->setTabPosition(QTabWidget::East); + } + if(!set.isEmpty()){ settings->setValue("tabsLocation",set); } +} + void MainUI::updateStatusTip(){ QString msg = currentEditor()->statusTip(); //ui->statusbar->clearMessage(); diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h index 69ea589c..53cc2398 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h @@ -38,7 +38,7 @@ private: ColorDialog *colorDLG; QSettings *settings; QShortcut *closeFindS; - QSpinBox *fontSizes; + QSpinBox *fontSizes; //Simplification functions PlainTextEditor* currentEditor(); @@ -53,7 +53,8 @@ private slots: void SaveFileAs(); void fontChanged(const QFont &font); void updateStatusTip(); - void changeFontSize(int newFontSize); + void changeFontSize(int newFontSize); + void changeTabsLocation(QAction*); //Other Menu Actions void UpdateHighlighting(QAction *act = 0); diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui index eb70184c..5d70d933 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.ui @@ -38,6 +38,12 @@ <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> + <property name="tabPosition"> + <enum>QTabWidget::North</enum> + </property> + <property name="tabShape"> + <enum>QTabWidget::Rounded</enum> + </property> <property name="tabsClosable"> <bool>true</bool> </property> @@ -203,7 +209,7 @@ <x>0</x> <y>0</y> <width>505</width> - <height>22</height> + <height>20</height> </rect> </property> <property name="contextMenuPolicy"> @@ -233,7 +239,17 @@ <addaction name="action_syntax_none"/> <addaction name="separator"/> </widget> + <widget class="QMenu" name="menuTabs_Location"> + <property name="title"> + <string>Tabs Location</string> + </property> + <addaction name="action_tabsTop"/> + <addaction name="action_tabsBottom"/> + <addaction name="action_tabsLeft"/> + <addaction name="action_tabsRight"/> + </widget> <addaction name="menuSyntax_Highlighting"/> + <addaction name="menuTabs_Location"/> <addaction name="actionLine_Numbers"/> <addaction name="actionWrap_Lines"/> <addaction name="actionShow_Popups"/> @@ -406,6 +422,41 @@ <string>Show warnings about unsaved changes</string> </property> </action> + <action name="action_tabsTop"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Top</string> + </property> + </action> + <action name="action_tabsBottom"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Bottom</string> + </property> + </action> + <action name="action_tabsLeft"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Left</string> + </property> + </action> + <action name="action_tabsRight"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Right</string> + </property> + </action> </widget> <resources/> <connections/> |