diff options
Diffstat (limited to 'src-qt5')
3 files changed, 262 insertions, 179 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp index 8f075488..20dc4a22 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp @@ -14,10 +14,14 @@ page_fluxbox_settings::page_fluxbox_settings(QWidget *parent) : PageWidget(parent), ui(new Ui::page_fluxbox_settings()){ ui->setupUi(this); loading= false; + ui->radio_simple->setChecked(true); + ui->radio_advanced->setChecked(false); connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->text_file, SIGNAL(textChanged()), this, SLOT(settingChanged()) ); + connect(ui->radio_simple, SIGNAL(toggled(bool)), this, SLOT(switchEditor()) ); updateIcons(); } @@ -29,28 +33,33 @@ page_fluxbox_settings::~page_fluxbox_settings(){ // PUBLIC SLOTS //================ void page_fluxbox_settings::SaveSettings(){ - QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); - // - window placement - int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") ); - QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - window focus - index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") ); - line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - window theme - index = FB.indexOf( FB.filter("session.styleFile:").join("") ); - line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - workspace number - index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") ); - line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value()); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - + QStringList FB; + if(ui->radio_simple->isChecked()){ + FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); + // - window placement + int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") ); + QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - window focus + index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") ); + line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - window theme + index = FB.indexOf( FB.filter("session.styleFile:").join("") ); + line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - workspace number + index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") ); + line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value()); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + }else{ + //advanced editor + FB = ui->text_file->toPlainText().split("\n"); + } //Save the fluxbox settings bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB); if(!ok){ qDebug() << "Warning: Could not save fluxbox-init"; } @@ -61,61 +70,67 @@ void page_fluxbox_settings::LoadSettings(int){ emit HasPendingChanges(false); emit ChangePageTitle( tr("Window Manager Settings") ); loading = true; - ui->combo_session_wfocus->clear(); - ui->combo_session_wfocus->addItem( tr("Click To Focus"), "ClickToFocus"); - ui->combo_session_wfocus->addItem( tr("Active Mouse Focus"), "MouseFocus"); - ui->combo_session_wfocus->addItem( tr("Strict Mouse Focus"), "StrictMouseFocus"); - - ui->combo_session_wloc->clear(); - ui->combo_session_wloc->addItem( tr("Align in a Row"), "RowSmartPlacement"); - ui->combo_session_wloc->addItem( tr("Align in a Column"), "ColSmartPlacement"); - ui->combo_session_wloc->addItem( tr("Cascade"), "CascadePlacement"); - ui->combo_session_wloc->addItem( tr("Underneath Mouse"), "UnderMousePlacement"); - - ui->combo_session_wtheme->clear(); - QStringList dirs; dirs << LOS::AppPrefix()+"share/fluxbox/styles" << QDir::homePath()+"/.fluxbox/styles"; - QFileInfoList fbstyles; - for(int i=0; i<dirs.length(); i++){ - QDir fbdir(dirs[i]); - fbstyles << fbdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); - } - QString lastdir; - for(int i=0; i<fbstyles.length(); i++){ - if(lastdir!=fbstyles[i].absolutePath()){ - lastdir = fbstyles[i].absolutePath(); //save for checking later - if(ui->combo_session_wtheme->count()>0){ ui->combo_session_wtheme->insertSeparator(ui->combo_session_wtheme->count()); } + if(ui->radio_simple->isChecked()){ + ui->stackedWidget->setCurrentWidget(ui->page_simple); //ensure the proper page is visible + ui->combo_session_wfocus->clear(); + ui->combo_session_wfocus->addItem( tr("Click To Focus"), "ClickToFocus"); + ui->combo_session_wfocus->addItem( tr("Active Mouse Focus"), "MouseFocus"); + ui->combo_session_wfocus->addItem( tr("Strict Mouse Focus"), "StrictMouseFocus"); + + ui->combo_session_wloc->clear(); + ui->combo_session_wloc->addItem( tr("Align in a Row"), "RowSmartPlacement"); + ui->combo_session_wloc->addItem( tr("Align in a Column"), "ColSmartPlacement"); + ui->combo_session_wloc->addItem( tr("Cascade"), "CascadePlacement"); + ui->combo_session_wloc->addItem( tr("Underneath Mouse"), "UnderMousePlacement"); + + ui->combo_session_wtheme->clear(); + QStringList dirs; dirs << LOS::AppPrefix()+"share/fluxbox/styles" << QDir::homePath()+"/.fluxbox/styles"; + QFileInfoList fbstyles; + for(int i=0; i<dirs.length(); i++){ + QDir fbdir(dirs[i]); + fbstyles << fbdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); + } + QString lastdir; + for(int i=0; i<fbstyles.length(); i++){ + if(lastdir!=fbstyles[i].absolutePath()){ + lastdir = fbstyles[i].absolutePath(); //save for checking later + if(ui->combo_session_wtheme->count()>0){ ui->combo_session_wtheme->insertSeparator(ui->combo_session_wtheme->count()); } + } + ui->combo_session_wtheme->addItem(fbstyles[i].fileName(), fbstyles[i].absoluteFilePath()); } - ui->combo_session_wtheme->addItem(fbstyles[i].fileName(), fbstyles[i].absoluteFilePath()); - } - QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); - QString val; - //Do the window placement - val = FB.filter("session.screen0.windowPlacement:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Placement:" << val; - int index = ui->combo_session_wloc->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wloc->setCurrentIndex(index); - - //Do the window focus - val = FB.filter("session.screen0.focusModel:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Focus:" << val; - index = ui->combo_session_wfocus->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wfocus->setCurrentIndex(index); - - //Do the window theme - val = FB.filter("session.styleFile:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Theme:" << val; - index = ui->combo_session_wtheme->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wtheme->setCurrentIndex(index); - - //Now the number of workspaces - val = FB.filter("session.screen0.workspaces:").join("").section(":",1,1).simplified(); - //qDebug() << "Number of Workspaces:" << val; - if(!val.isEmpty()){ ui->spin_session_wkspaces->setValue(val.toInt()); } - + QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); + QString val; + //Do the window placement + val = FB.filter("session.screen0.windowPlacement:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Placement:" << val; + int index = ui->combo_session_wloc->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wloc->setCurrentIndex(index); + + //Do the window focus + val = FB.filter("session.screen0.focusModel:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Focus:" << val; + index = ui->combo_session_wfocus->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wfocus->setCurrentIndex(index); + + //Do the window theme + val = FB.filter("session.styleFile:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Theme:" << val; + index = ui->combo_session_wtheme->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wtheme->setCurrentIndex(index); + + //Now the number of workspaces + val = FB.filter("session.screen0.workspaces:").join("").section(":",1,1).simplified(); + //qDebug() << "Number of Workspaces:" << val; + if(!val.isEmpty()){ ui->spin_session_wkspaces->setValue(val.toInt()); } + }else{ + //Advanced editor + ui->stackedWidget->setCurrentWidget(ui->page_advanced); //ensure the proper page is visible + ui->text_file->setPlainText( readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init").join("\n") ); + } QApplication::processEvents(); loading = false; } @@ -168,3 +183,7 @@ void page_fluxbox_settings::sessionthemechanged(){ } settingChanged(); } + +void page_fluxbox_settings::switchEditor(){ + LoadSettings(-1); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h index b78b204b..46b923b4 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h @@ -39,5 +39,6 @@ private slots: } void sessionthemechanged(); + void switchEditor(); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui index 677eac62..13d27cf9 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui @@ -27,134 +27,197 @@ <number>6</number> </property> <item> - <layout class="QFormLayout" name="formLayout_4"> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QRadioButton" name="radio_simple"> <property name="text"> - <string>Number of Workspaces</string> + <string>Simple Editor</string> </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="spin_session_wkspaces"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>10</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>New Window Placement</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="combo_session_wloc"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Focus Policy</string> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QComboBox" name="combo_session_wfocus"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_13"> + <item> + <widget class="QRadioButton" name="radio_advanced"> <property name="text"> - <string>Window Theme</string> + <string>Advanced Editor</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QComboBox" name="combo_session_wtheme"/> - </item> </layout> </item> <item> - <widget class="QGroupBox" name="group_session_preview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QStackedWidget" name="stackedWidget"> + <property name="currentIndex"> + <number>0</number> </property> - <property name="title"> - <string>Window Theme Preview</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>362</width> - <height>115</height> - </rect> - </property> + <widget class="QWidget" name="page_simple"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QFormLayout" name="formLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Number of Workspaces</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="spin_session_wkspaces"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>New Window Placement</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="combo_session_wloc"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Focus Policy</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="combo_session_wfocus"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_13"> + <property name="text"> + <string>Window Theme</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="combo_session_wtheme"/> + </item> + </layout> + </item> + <item> + <widget class="QGroupBox" name="group_session_preview"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> + <property name="title"> + <string>Window Theme Preview</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_12"> <item> - <widget class="QLabel" name="label_session_wpreview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>No Preview Available</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>362</width> + <height>78</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_13"> + <property name="leftMargin"> + <number>1</number> + </property> + <property name="topMargin"> + <number>1</number> + </property> + <property name="rightMargin"> + <number>1</number> + </property> + <property name="bottomMargin"> + <number>1</number> + </property> + <item> + <widget class="QLabel" name="label_session_wpreview"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> + </property> + <property name="text"> + <string>No Preview Available</string> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + </layout> + </widget> </widget> </item> </layout> </widget> - </widget> - </item> - </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="page_advanced"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QPlainTextEdit" name="text_file"/> + </item> + </layout> + </widget> </widget> </item> </layout> |