From 79f1863b83d0b3df619eb3e96c01c06dd12cb72f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 09:42:19 -0400 Subject: Finish up the switch over to the new UI for lumina-config --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 44 +- src-qt5/core-utils/lumina-config/PanelWidget.h | 9 +- src-qt5/core-utils/lumina-config/lumina-config.pro | 7 +- src-qt5/core-utils/lumina-config/main.cpp | 2 +- src-qt5/core-utils/lumina-config/mainUI.cpp | 1932 -------------------- src-qt5/core-utils/lumina-config/mainUI.h | 171 -- src-qt5/core-utils/lumina-config/mainUI.ui | 1792 ------------------ src-qt5/core-utils/lumina-config/mainWindow.cpp | 4 + .../core-utils/lumina-config/pages/page_main.cpp | 10 +- 9 files changed, 52 insertions(+), 3919 deletions(-) delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.cpp delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.h delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.ui diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index 49b3d797..10e12cbb 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -7,13 +7,8 @@ #include "PanelWidget.h" #include "ui_PanelWidget.h" -#include "LPlugins.h" #include "GetPluginDialog.h" -#include "mainUI.h" -#include - -#include -#include +#include "AppDialog.h" PanelWidget::PanelWidget(QWidget *parent, QWidget *Main, LPlugins *Pinfo) : QWidget(parent), ui(new Ui::PanelWidget){ @@ -126,6 +121,39 @@ void PanelWidget::reloadColorSample(){ ui->label_color_sample->setStyleSheet("background: "+ui->label_color_sample->whatsThis()); } +XDGDesktop PanelWidget::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +QString PanelWidget::getColorStyle(QString current, bool allowTransparency){ + QString out; + //Convert the current color string into a QColor + QStringList col = current.section(")",0,0).section("(",1,1).split(","); + if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; } + QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA + QColor ncol; + if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); } + else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); } + //Now convert the new color into a usable string and return + if(ncol.isValid()){ //if the dialog was not cancelled + if(allowTransparency){ + out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")"; + }else{ + out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; + } + } + return out; +} + void PanelWidget::on_tool_rm_clicked(){ emit PanelRemoved(pnum); } @@ -140,7 +168,7 @@ void PanelWidget::UseColorChanged(){ } void PanelWidget::on_tool_selectcolor_clicked(){ - QString color = static_cast(mainui)->getColorStyle(ui->label_color_sample->whatsThis()); + QString color = getColorStyle(ui->label_color_sample->whatsThis()); if( color.isEmpty()){ return; } ui->label_color_sample->setWhatsThis(color); reloadColorSample(); @@ -155,7 +183,7 @@ void PanelWidget::on_tool_addplugin_clicked(){ QString pan = dlg.plugID; //getNewPanelPlugin(); if(pan == "applauncher"){ //Prompt for the application to add - XDGDesktop app = static_cast(mainui)->getSysApp(); + XDGDesktop app =getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled pan.append("::"+app.filePath); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name); diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.h b/src-qt5/core-utils/lumina-config/PanelWidget.h index e407391e..3f3cb360 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.h +++ b/src-qt5/core-utils/lumina-config/PanelWidget.h @@ -7,11 +7,8 @@ #ifndef _LUMINA_CONFIG_PANEL_WIDGET_H #define _LUMINA_CONFIG_PANEL_WIDGET_H -#include -#include -#include +#include "globals.h" -//#include "mainUI.h" #include "LPlugins.h" //namespace for using the *.ui file @@ -42,7 +39,8 @@ private: int dnum, pnum; void reloadColorSample(); - + XDGDesktop getSysApp(bool allowreset = false); + QString getColorStyle(QString current, bool allowTransparency = true); private slots: void on_tool_rm_clicked(); void ItemChanged(); @@ -60,4 +58,3 @@ signals: }; #endif - diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index f7359df9..2e950fe1 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -11,7 +11,6 @@ target.path = $${L_BINDIR} TEMPLATE = app SOURCES += main.cpp \ - mainUI.cpp \ mainWindow.cpp \ LPlugins.cpp \ ColorDialog.cpp \ @@ -19,8 +18,7 @@ SOURCES += main.cpp \ GetPluginDialog.cpp \ PanelWidget.cpp -HEADERS += mainUI.h \ - mainWindow.h \ +HEADERS += mainWindow.h \ LPlugins.h \ AppDialog.h \ ColorDialog.h \ @@ -28,8 +26,7 @@ HEADERS += mainUI.h \ GetPluginDialog.h \ PanelWidget.h -FORMS += mainUI.ui \ - mainWindow.ui \ +FORMS += mainWindow.ui \ AppDialog.ui \ ColorDialog.ui \ ThemeDialog.ui \ diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index 8056a083..856570c0 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -4,7 +4,7 @@ #include #include -#include "mainUI.h" + #include "mainWindow.h" #include #include diff --git a/src-qt5/core-utils/lumina-config/mainUI.cpp b/src-qt5/core-utils/lumina-config/mainUI.cpp deleted file mode 100644 index 36e45a9e..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.cpp +++ /dev/null @@ -1,1932 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "mainUI.h" -#include "ui_mainUI.h" //the designer *.ui file - -#include -#include -#include -#include -//#include -#include - -#include - -MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ - ui->setupUi(this); //load the designer file - this->setWindowIcon( LXDG::findIcon("preferences-desktop-display","") ); - PINFO = new LPlugins(); //load the info class - panadjust = false; - DEFAULTBG = LOS::LuminaShare()+"desktop-background.jpg"; - //Be careful about the QSettings setup, it must match the lumina-desktop setup - settings = new QSettings( QSettings::UserScope, "lumina-desktop", "desktopsettings", this); - appsettings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-open", this); - sessionsettings = new QSettings( QSettings::UserScope, "lumina-desktop","sessionsettings", this); - qDebug() << "Settings File:" << settings->fileName(); - desktop = new QDesktopWidget(); - ui->spin_screen->setMinimum(1); - //Make sure this is only allows the current number of screens - ui->spin_screen->setMaximum(desktop->screenCount()); - ui->spin_screen->setValue(desktop->screenNumber(this->mapToGlobal(this->geometry().center()))+1); //have the current screen auto-selected - //qDebug() << "Number of Screens:" << desktop->screenCount(); - sysApps = LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ); - //Add a couple spacers to center the toolbar items - QWidget *tmp = new QWidget(this); - tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - ui->toolBar->insertWidget(ui->actionDesktop, tmp); - tmp = new QWidget(this); - tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - ui->toolBar->addWidget(tmp); - //Now finish setting up the UI - setupIcons(); - setupMenus(); - setupConnections(); - - //Start on the Desktop page (and first tab for all tab widgets) - ui->stackedWidget->setCurrentWidget(ui->page_desktop); - ui->tabWidget_desktop->setCurrentWidget(ui->tab_wallpaper); - ui->tabWidget_session->setCurrentIndex(0); - ui->tabWidget_apps->setCurrentIndex(0); - ui->tabWidget_panels->setCurrentIndex(0); - - slotChangePage(false); - - QTimer::singleShot(10, this, SLOT(loadCurrentSettings()) ); - - //Disable the incomplete pages/items at the moment - -} - -MainUI::~MainUI(){ - -} - -void MainUI::slotSingleInstance(){ - //Make sure this window is visible - this->showNormal(); - this->activateWindow(); - this->raise(); -} - -//================ -// PRIVATE FUNCTIONS -//================ -void MainUI::setupIcons(){ - //Pull all the icons from the current theme using libLumina (LXDG) - - //General UI - ui->actionDesktop->setIcon( LXDG::findIcon("preferences-desktop-display","") ); - ui->actionPanels->setIcon( LXDG::findIcon("preferences-desktop-icons","") ); - //ui->actionMenu->setIcon( LXDG::findIcon("preferences-desktop-icons","") ); - ui->actionShortcuts->setIcon( LXDG::findIcon("configure-shortcuts","") ); - ui->actionDefaults->setIcon( LXDG::findIcon("preferences-system-windows","") ); - ui->actionSession->setIcon( LXDG::findIcon("preferences-system-session-services","") ); - ui->push_save->setIcon( LXDG::findIcon("document-save","") ); - - - //Desktop Page - ui->tool_desk_addbg->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_desk_rmbg->setIcon( LXDG::findIcon("list-remove","") ); - ui->tabWidget_desktop->setTabIcon( ui->tabWidget_desktop->indexOf(ui->tab_wallpaper), LXDG::findIcon("preferences-desktop-wallpaper","") ); - ui->tabWidget_desktop->setTabIcon( ui->tabWidget_desktop->indexOf(ui->tab_themes), LXDG::findIcon("preferences-desktop-theme","") ); - ui->tool_desktop_addplugin->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_desktop_rmplugin->setIcon( LXDG::findIcon("list-remove","") ); - - //Panels Page - ui->tool_panels_add->setIcon( LXDG::findIcon("list-add","") ); - - //Menu Page - ui->tool_menu_add->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_menu_rm->setIcon( LXDG::findIcon("list-remove","") ); - ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") ); - ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") ); - - //Shortcuts Page - ui->tool_shortcut_set->setIcon( LXDG::findIcon("input-keyboard","") ); - ui->tool_shortcut_clear->setIcon( LXDG::findIcon("edit-clear","") ); - - //Defaults Page - //ui->tool_defaults_addextension->setIcon( LXDG::findIcon("list-add","") ); - //ui->tool_defaults_addgroup->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_defaults_clear->setIcon( LXDG::findIcon("edit-clear","") ); - ui->tool_defaults_set->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_defaults_setbin->setIcon( LXDG::findIcon("application-x-executable","") ); - ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_auto), LXDG::findIcon("system-run", "") ); - ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_defaults), LXDG::findIcon("preferences-desktop-filetype-association", "") ); - - //Session Page - //ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") ); - ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") ); - ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") ); - ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); - ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") ); - ui->push_session_resetSysDefaults->setIcon( LXDG::findIcon("pcbsd","view-refresh") ); - ui->push_session_resetLuminaDefaults->setIcon( LXDG::findIcon("Lumina-DE","") ); - ui->tool_help_time->setIcon( LXDG::findIcon("help-about","") ); - ui->tool_help_date->setIcon( LXDG::findIcon("help-about","") ); -} - -void MainUI::setupConnections(){ - //General UI - connect(ui->actionDesktop, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionPanels, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - //connect(ui->actionMenu, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionShortcuts, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionDefaults, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionSession, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->push_save, SIGNAL(clicked()), this, SLOT(saveCurrentSettings()) ); - connect(ui->spin_screen, SIGNAL(valueChanged(int)), this, SLOT(slotChangeScreen()) ); - - //Desktop Page - //connect(ui->combo_desk_plugs, SIGNAL(currentIndexChanged(int)), this, SLOT(deskplugchanged()) ); - connect(ui->combo_desk_bg, SIGNAL(currentIndexChanged(int)), this, SLOT(deskbgchanged()) ); - connect(ui->radio_desk_multi, SIGNAL(toggled(bool)), this, SLOT(desktimechanged()) ); - connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) ); - connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) ); - connect(ui->tool_desk_addbg, SIGNAL(clicked()), this, SLOT(deskbgadded()) ); - connect(ui->tool_desk_rmbg, SIGNAL(clicked()), this, SLOT(deskbgremoved()) ); - connect(ui->spin_desk_min, SIGNAL(valueChanged(int)), this, SLOT(desktimechanged()) ); - connect(ui->check_desktop_autolaunchers, SIGNAL(clicked()), this, SLOT(desktimechanged()) ); //just need to poke the save routines - connect(ui->combo_desk_layout, SIGNAL(currentIndexChanged(int)), this, SLOT(desktimechanged()) ); //just need to poke the save routines - - //Panels Page - connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) ); - - //Menu Page - connect(ui->tool_menu_add, SIGNAL(clicked()), this, SLOT(addmenuplugin()) ); - connect(ui->tool_menu_rm, SIGNAL(clicked()), this, SLOT(rmmenuplugin()) ); - connect(ui->tool_menu_up, SIGNAL(clicked()), this, SLOT(upmenuplugin()) ); - connect(ui->tool_menu_dn, SIGNAL(clicked()), this, SLOT(downmenuplugin()) ); - connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) ); - - //Shortcuts Page - connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) ); - connect(ui->tool_shortcut_set, SIGNAL(clicked()), this, SLOT(applyKeyBinding()) ); - connect(ui->tree_shortcut, SIGNAL(itemSelectionChanged()), this, SLOT(updateKeyConfig()) ); - - //Defaults Page - connect(ui->tool_default_filemanager, SIGNAL(clicked()), this, SLOT(changeDefaultFileManager()) ); - connect(ui->tool_default_terminal, SIGNAL(clicked()), this, SLOT(changeDefaultTerminal()) ); - connect(ui->tool_default_webbrowser, SIGNAL(clicked()), this, SLOT(changeDefaultBrowser()) ); - connect(ui->tool_default_email, SIGNAL(clicked()), this, SLOT(changeDefaultEmail()) ); - connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) ); - connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) ); - connect(ui->tool_defaults_setbin, SIGNAL(clicked()), this, SLOT(setdefaultbinary()) ); - connect(ui->tree_defaults, SIGNAL(itemSelectionChanged()), this, SLOT(checkdefaulticons()) ); - - //Session Page - connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) ); - connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) ); - connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) ); - connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); - connect(ui->combo_session_cursortheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionCursorChanged()) ); - connect(ui->check_session_numlock, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->check_session_playloginaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); - //connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) ); - connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(sessionoptchanged()) ); - connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_icontheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) ); - connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) ); - connect(ui->push_session_setUserIcon, SIGNAL(clicked()), this, SLOT(sessionChangeUserIcon()) ); - connect(ui->push_session_resetSysDefaults, SIGNAL(clicked()), this, SLOT(sessionResetSys()) ); - connect(ui->push_session_resetLuminaDefaults, SIGNAL(clicked()), this, SLOT(sessionResetLumina()) ); - connect(ui->tool_help_time, SIGNAL(clicked()), this, SLOT(sessionShowTimeCodes()) ); - connect(ui->tool_help_date, SIGNAL(clicked()), this, SLOT(sessionShowDateCodes()) ); - connect(ui->line_session_time, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadTimeSample()) ); - connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) ); - connect(ui->combo_session_datetimeorder, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_lang, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_collate, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_ctype, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_message, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_monetary, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_numeric, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_time, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); -} - -void MainUI::setupMenus(){ - //Background file menu (different ways of loading files) - if(ui->tool_desk_addbg->menu()==0){ ui->tool_desk_addbg->setMenu(new QMenu(this)); } - ui->tool_desk_addbg->menu()->clear(); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-new",""), tr("File(s)"), this, SLOT(deskbgadded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("folder-new",""), tr("Directory (Single)"), this, SLOT(deskbgdiradded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-open-folder",""), tr("Directory (Recursive)"), this, SLOT(deskbgdirradded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("format-fill-color",""), tr("Solid Color"), this, SLOT(deskbgcoloradded()) ); - - //Session window manager settings - 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; icombo_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()); - } - //Display formats for panel clock - ui->combo_session_datetimeorder->clear(); - ui->combo_session_datetimeorder->addItem( tr("Time (Date as tooltip)"), "timeonly"); - ui->combo_session_datetimeorder->addItem( tr("Date (Time as tooltip)"), "dateonly"); - ui->combo_session_datetimeorder->addItem( tr("Time first then Date"), "timedate"); - ui->combo_session_datetimeorder->addItem( tr("Date first then Time"), "datetime"); - - //Available Cursor Themes - ui->combo_session_cursortheme->clear(); - ui->combo_session_cursortheme->addItems( LTHEME::availableSystemCursors() ); - //int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); - //if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } - - //Available Wallpaper layout options - ui->combo_desk_layout->clear(); - ui->combo_desk_layout->addItem(tr("Automatic"), "stretch"); - ui->combo_desk_layout->addItem(tr("Fullscreen"), "full"); - ui->combo_desk_layout->addItem(tr("Fit screen"), "fit"); - ui->combo_desk_layout->addItem(tr("Tile"), "tile"); - ui->combo_desk_layout->addItem(tr("Center"), "center"); - ui->combo_desk_layout->addItem(tr("Top Left"), "topleft"); - ui->combo_desk_layout->addItem(tr("Top Right"), "topright"); - ui->combo_desk_layout->addItem(tr("Bottom Left"), "bottomleft"); - ui->combo_desk_layout->addItem(tr("Bottom Right"), "bottomright"); - - - - //Available localizations - QStringList langs = LUtils::knownLocales(); - langs.sort(); - QString def = tr("System Default"); - ui->combo_locale_lang->addItem(def,""); - ui->combo_locale_collate->addItem(def,""); - ui->combo_locale_ctype->addItem(def,""); - ui->combo_locale_message->addItem(def,""); - ui->combo_locale_monetary->addItem(def,""); - ui->combo_locale_numeric->addItem(def,""); - ui->combo_locale_time->addItem(def,""); - for(int i=0; icombo_locale_lang->addItem(lan,langs[i]); - ui->combo_locale_collate->addItem(lan,langs[i]); - ui->combo_locale_ctype->addItem(lan,langs[i]); - ui->combo_locale_message->addItem(lan,langs[i]); - ui->combo_locale_monetary->addItem(lan,langs[i]); - ui->combo_locale_numeric->addItem(lan,langs[i]); - ui->combo_locale_time->addItem(lan,langs[i]); - } -} - -int MainUI::currentDesktop(){ - return ui->spin_screen->value()-1; //backend starts at 0, not 1 -} - -QString MainUI::getColorStyle(QString current, bool allowTransparency){ - QString out; - //Convert the current color string into a QColor - QStringList col = current.section(")",0,0).section("(",1,1).split(","); - if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; } - QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA - QColor ncol; - if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); } - else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); } - //Now convert the new color into a usable string and return - if(ncol.isValid()){ //if the dialog was not cancelled - if(allowTransparency){ - out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")"; - }else{ - out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; - } - } - return out; -} - -XDGDesktop MainUI::getSysApp(bool allowreset){ - AppDialog dlg(this, sysApps); - dlg.allowReset(allowreset); - dlg.exec(); - XDGDesktop desk; - if(dlg.appreset && allowreset){ - desk.filePath = "reset"; //special internal flag - }else{ - desk = dlg.appselected; - } - return desk; -} - -//Convert to/from fluxbox key codes -QString MainUI::dispToFluxKeys(QString in){ - in.replace("Ctrl", "Control"); - in.replace("Shift", "Shift"); - in.replace("Alt", "Mod1"); - in.replace("Meta", "Mod4"); - in.replace("PgUp", "Prior"); - in.replace("PgDown", "Next"); - in.replace("Del", "Delete"); - in.replace("Backspace", "BackSpace"); - in.replace("Ins","Insert"); - in.replace("Volume Up", "XF86AudioRaiseVolume"); //multimedia key - in.replace("Volume Down", "XF86AudioLowerVolume"); //multimedia key - in.replace("+"," "); - return in; -} - -QString MainUI::fluxToDispKeys(QString in){ - in.replace("Control", "Ctrl"); - in.replace("Shift", "Shift"); - in.replace("Mod1", "Alt"); - in.replace("Mod4", "Meta"); - in.replace("Prior", "PgUp"); - in.replace("Next", "PgDown"); - //in.replace("Delete", "Del"); //the "Delete" is better looking - in.replace("BackSpace", "Backspace"); - //in.replace("Insert", "Ins"); //the "Insert" is better looking - in.replace("XF86AudioRaiseVolume", "Volume Up"); //multimedia key - in.replace("XF86AudioLowerVolume", "Volume Down"); //multimedia key - return in; -} - -//Read/overwrite a text file -QStringList MainUI::readFile(QString path){ - QStringList out; - QFile file(path); - if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QTextStream txt(&file); - while(!txt.atEnd()){ - out << txt.readLine(); - } - file.close(); - } - return out; -} - -bool MainUI::overwriteFile(QString path, QStringList contents){ - QFile file(path); - if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ - QTextStream txt(&file); - for(int i=0; iactionDesktop->setChecked(ui->stackedWidget->currentWidget()==ui->page_desktop); - ui->actionPanels->setChecked(ui->stackedWidget->currentWidget()==ui->page_panels); - //ui->actionMenu->setChecked(ui->stackedWidget->currentWidget()==ui->page_menu); - ui->actionShortcuts->setChecked(ui->stackedWidget->currentWidget()==ui->page_shortcuts); - ui->actionDefaults->setChecked(ui->stackedWidget->currentWidget()==ui->page_defaults); - ui->actionSession->setChecked(ui->stackedWidget->currentWidget()==ui->page_session); - showScreen = (ui->actionDesktop->isChecked() || ui->actionPanels->isChecked()); - //Ask if they want to reset any changes on the current page - - }else{ - //uncheck the button associated with the currently open page - if(ui->stackedWidget->currentWidget()==ui->page_desktop){ ui->actionDesktop->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_panels){ ui->actionPanels->setChecked(false); } - //if(ui->stackedWidget->currentWidget()==ui->page_menu){ ui->actionMenu->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_shortcuts){ ui->actionShortcuts->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_defaults){ ui->actionDefaults->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_session){ ui->actionSession->setChecked(false); } - //switch to the new page - if(ui->actionDesktop->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_desktop); showScreen=true;} - else if(ui->actionPanels->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_panels); showScreen=true; } - //else if(ui->actionMenu->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_menu); } - else if(ui->actionShortcuts->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_shortcuts); } - else if(ui->actionDefaults->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_defaults); } - else if(ui->actionSession->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_session); } - } - ui->group_screen->setVisible(showScreen && (ui->spin_screen->maximum()>1) ); - //Hide the save button for particular pages - //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || moddesk || modpan || modmenu || modshort || moddef || modses); //hide on the default page if nothing waiting to be saved - //Special functions for particular pages - //if(ui->page_panels->isVisible()){ checkpanels(); } - -} - -void MainUI::slotChangeScreen(){ - static int cscreen = 0; //current screen - int newscreen = currentDesktop(); - if(cscreen!=newscreen){ - if(moddesk || modpan){ - if(QMessageBox::Yes == QMessageBox::question(this, tr("Save Changes?"), tr("You currently have unsaved changes for this screen. Do you want to save them first?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ){ - ui->spin_screen->setValue(cscreen+1); //Make sure the old screen is selected for a moment - saveCurrentSettings(true); //only save current screen settings - ui->spin_screen->setValue(newscreen+1); //Now reset back to the new screen - } - } - loadCurrentSettings(true); - cscreen = newscreen; //save that this screen is current now - } -} - -void MainUI::saveAndQuit(){ - saveCurrentSettings(); - this->close(); -} - -//General Utility Functions -void MainUI::loadCurrentSettings(bool screenonly){ - loading = true; - settings->sync(); - appsettings->sync(); - int cdesk = currentDesktop(); - QString DPrefix = "desktop-"+QString::number(cdesk)+"/"; - bool primary = (desktop->screenGeometry(cdesk).x()==0); - - //Desktop Page - QStringList bgs = settings->value(DPrefix+"background/filelist", QStringList()<<"default").toStringList(); - ui->combo_desk_bg->clear(); - for(int i=0; icombo_desk_bg->addItem( QIcon(DEFAULTBG), tr("System Default"), bgs[i] ); } - else if(bgs[i].startsWith("rgb(")){ui->combo_desk_bg->addItem(QString(tr("Solid Color: %1")).arg(bgs[i]), bgs[i]); } - //else{ ui->combo_desk_bg->addItem( QIcon(QPixmap(bgs[i]).scaled(64,64)), bgs[i].section("/",-1), bgs[i] ); } - else{ ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); } //disable the thumbnail - takes a long time for large collections of files - } - ui->check_desktop_autolaunchers->setChecked(settings->value(DPrefix+"generateDesktopIcons", false).toBool()); - ui->radio_desk_multi->setEnabled(bgs.length()>1); - if(bgs.length()>1){ ui->radio_desk_multi->setChecked(true);} - else{ ui->radio_desk_single->setChecked(true); } - ui->spin_desk_min->setValue( settings->value(DPrefix+"background/minutesToChange", 5).toInt() ); - desktimechanged(); //ensure the display gets updated (in case the radio selection did not change); - ui->label_desk_res->setText( tr("Screen Resolution:")+"\n"+QString::number(desktop->screenGeometry(cdesk).width())+"x"+QString::number(desktop->screenGeometry(cdesk).height()) ); - int tmp = ui->combo_desk_layout->findData(settings->value(DPrefix+"background/format","stretch")); - if(tmp>=0){ ui->combo_desk_layout->setCurrentIndex(tmp); } - QStringList dplugs = settings->value(DPrefix+"pluginlist",QStringList()).toStringList(); - ui->list_desktop_plugins->clear(); - for(int i=0; isetWhatsThis(dplugs[i]); //save the full thing instantly - //Now load the rest of the info about the plugin - QString num; - if(dplugs[i].contains("---")){ - num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number - if(num=="1"){ num.clear(); } //don't bother showing the number - dplugs[i] = dplugs[i].section("---",0,0); - } - if(dplugs[i].startsWith("applauncher::")){ - bool ok = false; - XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok); - if(!ok){ continue; } //invalid for some reason - //Now fill the item with the necessary info - it->setText(app.name); - it->setIcon(LXDG::findIcon(app.icon,"") ); - it->setToolTip(app.comment); - }else{ - //Load the info for this plugin - LPI info = PINFO->desktopPluginInfo(dplugs[i]); - if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason - it->setText(info.name); - it->setToolTip(info.description); - it->setIcon( LXDG::findIcon(info.icon,"") ); - } - if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number - ui->list_desktop_plugins->addItem(it); - } - - //Panels Page - int panels = settings->value(DPrefix+"panels",-1).toInt(); - if(panels==-1 && primary){ panels=1; } - panelnumber = panels; - loadPanels(); - - if(!screenonly){ - // Menu Page - //Default terminal and filemanager binary - //ui->line_menu_term->setText( settings->value("default-terminal","xterm").toString() ); - //ui->line_menu_fm->setText( settings->value("default-filemanager","lumina-fm").toString() ); - //Menu Items - QStringList items = settings->value("menu/itemlist", QStringList() ).toStringList(); - if(items.isEmpty()){ items << "terminal" << "filemanager" << "applications" << "line" << "settings"; } - //qDebug() << "Menu Items:" << items; - ui->list_menu->clear(); - for(int i=0; imenuPluginInfo(items[i]); - if(items[i].startsWith("app::::")){ - bool ok = false; - XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); - if(!ok){ continue; } //invalid application file (no longer installed?) - QListWidgetItem *item = new QListWidgetItem(); - item->setWhatsThis( items[i] ); - item->setIcon( LXDG::findIcon(desk.icon) ); - item->setText( desk.name ); - item->setToolTip( desk.comment ); - ui->list_menu->addItem(item); - continue; //now go to the next item - } - if(info.ID.isEmpty()){ continue; } //invalid plugin - //qDebug() << "Add Menu Item:" << info.ID; - QListWidgetItem *item = new QListWidgetItem(); - item->setWhatsThis( info.ID ); - item->setIcon( LXDG::findIcon(info.icon,"") ); - item->setText( info.name ); - item->setToolTip( info.description ); - ui->list_menu->addItem(item); - } - checkmenuicons(); //update buttons - } - //Shortcuts Page - if(!screenonly){ loadKeyboardShortcuts(); } - - //Defaults Page - if(!screenonly){ loadDefaultSettings(); } - - //Session Page - if(!screenonly){ loadSessionSettings(); } - - //Now disable the save button since nothing has changed yet - loading = false; - moddesk = modpan =false; - if(!screenonly){ modmenu = modshort = moddef = modses = false; }//all setup back to original - ui->push_save->setEnabled(modmenu || modshort || moddef || modses); -} - -void MainUI::saveCurrentSettings(bool screenonly){ - QString DPrefix = "desktop-"+QString::number(currentDesktop())+"/"; - bool needreload = false; - // Desktop Page - if(moddesk){ - QStringList bgs; //get the list of backgrounds to use - if(ui->radio_desk_multi->isChecked()){ - for(int i=0; icombo_desk_bg->count(); i++){ - bgs << ui->combo_desk_bg->itemData(i).toString(); - } - }else if(ui->combo_desk_bg->count() > 0){ - bgs << ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); - bgs.removeAll("default"); - } - if(bgs.isEmpty()){ bgs << "default"; } //Make sure to always fall back on the default - settings->setValue(DPrefix+"background/filelist", bgs); - settings->setValue(DPrefix+"background/minutesToChange", ui->spin_desk_min->value()); - settings->setValue(DPrefix+"generateDesktopIcons", ui->check_desktop_autolaunchers->isChecked()); - settings->setValue(DPrefix+"background/format", ui->combo_desk_layout->currentData().toString()); - QStringList plugs; - for(int i=0; ilist_desktop_plugins->count(); i++){ - plugs << ui->list_desktop_plugins->item(i)->whatsThis(); - } - if(settings->value(DPrefix+"pluginlist",QStringList()).toStringList() != plugs){ - settings->setValue(DPrefix+"pluginlist", plugs); - needreload = true; - } - } - - // Panels Page - if(modpan){ - settings->setValue(DPrefix+"panels", PANELS.length()); - savePanels(); - } - - // Menu Page - if(modmenu && !screenonly){ - QStringList items; - for(int i=0; ilist_menu->count(); i++){ - items << ui->list_menu->item(i)->whatsThis(); - } - settings->setValue("menu/itemlist", items); - } - - //Shortcuts page - if(modshort && !screenonly){ - saveKeyboardShortcuts(); - } - - //Defaults page - if(moddef && !screenonly){ - //saveDefaultSettings(); - } - - //Session Page - if(modses && !screenonly){ - saveSessionSettings(); - } - - //All done - make sure the changes get saved to file right now - settings->sync(); - appsettings->sync(); - moddesk = modpan = false; - if(!screenonly){ modmenu = modshort = moddef = modses = false; } - ui->push_save->setEnabled(modmenu || modshort || moddef || modses); //wait for new changes - //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses); - if(needreload){ - //Wait 1 second - for(int i=0; i<10; i++){ QApplication::processEvents(); usleep(100000); } - loadCurrentSettings(screenonly); - } -} - - -//=============== -// DESKTOP PAGE -//=============== -void MainUI::deskbgchanged(){ - //Load the new image preview - if(ui->combo_desk_bg->count()==0){ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(tr("No Background")+"\n"+tr("(use system default)")); - ui->label_desk_bgview->setStyleSheet(""); - }else{ - QString path = ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); - if(path=="default"){ path = DEFAULTBG; } - if(QFile::exists(path)){ - QSize sz = ui->label_desk_bgview->size(); - sz.setWidth( sz.width() - (2*ui->label_desk_bgview->frameWidth()) ); - sz.setHeight( sz.height() - (2*ui->label_desk_bgview->frameWidth()) ); - //Update the preview/thumbnail for this item - QPixmap pix(path); - ui->label_desk_bgview->setPixmap( pix.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation) ); - ui->combo_desk_bg->setItemIcon(ui->combo_desk_bg->currentIndex(), pix.scaled(64,64) ); - ui->label_desk_bgview->setStyleSheet(""); - }else if(path.startsWith("rgb(")){ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(""); - ui->label_desk_bgview->setStyleSheet("background-color: "+path+";"); - }else{ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(tr("File does not exist")); - ui->label_desk_bgview->setStyleSheet(""); - } - } - //See if this constitues a change to the current settings and enable the save button - if(!loading && ui->radio_desk_single->isChecked()){ ui->push_save->setEnabled(true); moddesk=true;} - //Disable the background rotation option if only one background selected - if(ui->combo_desk_bg->count()<2){ - ui->radio_desk_single->setChecked(true); - ui->radio_desk_multi->setEnabled(false); - ui->spin_desk_min->setEnabled(false); - }else{ - ui->radio_desk_multi->setEnabled(true); - ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); - } - - //Disable the bg remove button if no backgrounds loaded - ui->tool_desk_rmbg->setEnabled(ui->combo_desk_bg->count()>0); -} - -void MainUI::desktimechanged(){ - ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); - if(!loading){ ui->push_save->setEnabled(true); moddesk = true; } -} - -void MainUI::deskbgremoved(){ - if(ui->combo_desk_bg->count()<1){ return; } //nothing to remove - ui->combo_desk_bg->removeItem( ui->combo_desk_bg->currentIndex() ); - ui->push_save->setEnabled(true); - moddesk = true; -} - -void MainUI::deskbgadded(){ - //Prompt the user to find an image file to use for a background - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; icombo_desk_bg->addItem( QIcon(bgs[i]), bgs[i].section("/",-1), bgs[i]); - } - //Now move to the last item in the list (the new image(s)); - ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); - //If multiple items selected, automatically enable the background rotation option - if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgcoloradded(){ - //Prompt the user to select a color (no transparency allowed) - QString color = getColorStyle("",false); //no initial color - if(color.isEmpty()){ return; } - //Add it to the list - ui->combo_desk_bg->addItem( QString(tr("Solid Color: %1")).arg(color), color); - //Now move to the last item in the list (the new image(s)); - ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); - - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgdiradded(){ - //Add the files from a single directory - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly); - if(dir.isEmpty()){ return; } - //Got a directory - go ahead and find all the valid image files within it - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; icombo_desk_bg->addItem( bgs[i], qdir.absoluteFilePath(bgs[i])); - } - //Now move to the last item in the list (the new image(s)); - ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); - //If multiple items selected, automatically enable the background rotation option - if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgdirradded(){ - //Recursively add files from a directory - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly); - if(dir.isEmpty()){ return; } - //Got a directory - go ahead and get all the valid image file formats - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; icombo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); - } - //Now move to the last item in the list (the new image(s)); - ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); - //If multiple items selected, automatically enable the background rotation option - if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - - -void MainUI::deskplugadded(){ - GetPluginDialog dlg(this); - dlg.LoadPlugins("desktop", PINFO); - dlg.exec(); - if( !dlg.selected ){ return; } //cancelled - QString newplug = dlg.plugID; - QListWidgetItem *it = new QListWidgetItem(); - if(newplug=="applauncher"){ - //Prompt for the application to add - XDGDesktop app = getSysApp(); - if(app.filePath.isEmpty()){ return; } //cancelled - newplug.append("::"+app.filePath); - //Now fill the item with the necessary info - it->setWhatsThis(newplug); - it->setText(app.name); - it->setIcon(LXDG::findIcon(app.icon,"") ); - it->setToolTip(app.comment); - }else{ - //Load the info for this plugin - LPI info = PINFO->desktopPluginInfo(newplug); - if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen) - it->setWhatsThis(newplug); - it->setText(info.name); - it->setToolTip(info.description); - it->setIcon( LXDG::findIcon(info.icon,"") ); - } - ui->list_desktop_plugins->addItem(it); - ui->list_desktop_plugins->scrollToItem(it); - ui->push_save->setEnabled(true); - moddesk = true; -} - -void MainUI::deskplugremoved(){ - QList sel = ui->list_desktop_plugins->selectedItems(); - if(sel.isEmpty()){ return; } //nothing to do - for(int i=0; ipush_save->setEnabled(true); - moddesk = true; -} - -//============= -// PANELS PAGE -//============= -void MainUI::panelValChanged(){ - ui->tool_panels_add->setEnabled(panelnumber < 12); - if(!loading){ ui->push_save->setEnabled(true); modpan = true; } -} - -void MainUI::newPanel(){ - - if(panelnumber<0){ panelnumber=0; } //just in case - panelnumber++; - //Now create a new Panel widget with this number - PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); - tmp->LoadSettings(settings, currentDesktop(), panelnumber-1); - PANELS << tmp; - connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); - connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); - static_cast(ui->scroll_panels->widget()->layout())->insertWidget(PANELS.length()-1, tmp); - //update the widget first (2 necessary for scroll below to work) - ui->scroll_panels->update(); - QApplication::processEvents(); - QApplication::processEvents(); - ui->scroll_panels->ensureWidgetVisible(tmp); - panelValChanged(); -} - -void MainUI::removePanel(int pan){ - //connected to a signal from the panel widget - bool changed = false; - for(int i=0; iPanelNumber(); - if(num==pan){ - delete PANELS.takeAt(i); - i--; - changed = true; - }else if(num > pan){ - PANELS[i]->ChangePanelNumber(num-1); - changed = true; - } - } - if(!changed){ return; } //nothing done - panelnumber--; - panelValChanged(); -} - -void MainUI::loadPanels(){ - //First clean any current panels - for(int i=0; iscroll_panels->widget()->layout()==0){ - ui->scroll_panels->widget()->setLayout( new QHBoxLayout() ); - ui->scroll_panels->widget()->layout()->setContentsMargins(0,0,0,0); - } - ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft); - //Clear anything left over in the layout - for(int i=0; iscroll_panels->widget()->layout()->count(); i++){ - delete ui->scroll_panels->widget()->layout()->takeAt(i); - } - for(int i=0; iscroll_panels->widget(), this, PINFO); - tmp->LoadSettings(settings, dnum, i); - PANELS << tmp; - connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); - connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); - ui->scroll_panels->widget()->layout()->addWidget(tmp); - } - static_cast(ui->scroll_panels->widget()->layout())->addStretch(); -} - -void MainUI::savePanels(){ - for(int i=0; iSaveSettings(settings); - } -} - -//============ -// MENU PAGE -//============ -void MainUI::addmenuplugin(){ - GetPluginDialog dlg(this); - dlg.LoadPlugins("menu", PINFO); - dlg.exec(); - if(!dlg.selected){ return; } //cancelled - QString plug = dlg.plugID; - //Now add the item to the list - LPI info = PINFO->menuPluginInfo(plug); - QListWidgetItem *it; - if(info.ID=="app"){ - //Need to prompt for the exact application to add to the menu - // Note: whatsThis() format: "app::::< *.desktop file path >" - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; }//nothing selected - //Create the item for the list - it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); - it->setWhatsThis(info.ID+"::::"+desk.filePath); - it->setToolTip( desk.comment ); - }else{ - it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); - it->setWhatsThis(info.ID); - it->setToolTip( info.description ); - } - ui->list_menu->addItem(it); - ui->list_menu->setCurrentRow(ui->list_menu->count()-1); //make sure it is auto-selected - ui->push_save->setEnabled(true); - modmenu = true; -} - -void MainUI::rmmenuplugin(){ - if(ui->list_menu->currentRow() < 0){ return; } //no selection - delete ui->list_menu->takeItem( ui->list_menu->currentRow() ); - ui->push_save->setEnabled(true); - modmenu = true; -} - -void MainUI::upmenuplugin(){ - int row = ui->list_menu->currentRow(); - if(row <= 0){ return; } - ui->list_menu->insertItem(row-1, ui->list_menu->takeItem(row)); - ui->list_menu->setCurrentRow(row-1); - ui->push_save->setEnabled(true); - checkmenuicons(); - modmenu = true; -} - -void MainUI::downmenuplugin(){ - int row = ui->list_menu->currentRow(); - if(row < 0 || row >= (ui->list_menu->count()-1) ){ return; } - ui->list_menu->insertItem(row+1, ui->list_menu->takeItem(row)); - ui->list_menu->setCurrentRow(row+1); - ui->push_save->setEnabled(true); - checkmenuicons(); - modmenu = true; -} - -void MainUI::checkmenuicons(){ - ui->tool_menu_up->setEnabled( ui->list_menu->currentRow() > 0 ); - ui->tool_menu_dn->setEnabled( ui->list_menu->currentRow() < (ui->list_menu->count()-1) ); - ui->tool_menu_rm->setEnabled( ui->list_menu->currentRow() >=0 ); -} - -//=========== -// Shortcuts Page -//=========== -void MainUI::loadKeyboardShortcuts(){ - ui->tree_shortcut->clear(); - QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); - //First take care of the special Lumina options - QStringList special; - special << "Exec lumina-open -volumeup::::"+tr("Audio Volume Up") \ - << "Exec lumina-open -volumedown::::"+tr("Audio Volume Down") \ - << "Exec lumina-open -brightnessup::::"+tr("Screen Brightness Up") \ - << "Exec lumina-open -brightnessdown::::"+tr("Screen Brightness Down") \ - << "Exec lumina-screenshot::::"+tr("Take Screenshot") \ - << "Exec xscreensaver-command -lock::::"+tr("Lock Screen"); - for(int i=0; isetText(0, special[i].section("::::",1,1)); - it->setWhatsThis(0, special[i].section("::::",0,0)); - if(!spec.isEmpty()){ - info.removeAll(spec); //this line has been dealt with - remove it - it->setText(1, fluxToDispKeys(spec.section(":",0,0)) ); //need to make this easier to read later - it->setWhatsThis(1, spec.section(":",0,0) ); - } - ui->tree_shortcut->addTopLevelItem(it); - } - //Now add support for all the other fluxbox shortcuts - for(int i=0; isetText(0, showexec.simplified() ); - it->setWhatsThis(0, exec); - it->setText(1, fluxToDispKeys(info[i].section(":",0,0)) ); //need to make this easier to read later - it->setWhatsThis(1, info[i].section(":",0,0) ); - ui->tree_shortcut->addTopLevelItem(it); - } -} - -void MainUI::saveKeyboardShortcuts(){ - //First get all the current listings - QStringList current; - for(int i=0; itree_shortcut->topLevelItemCount(); i++){ - QTreeWidgetItem *it = ui->tree_shortcut->topLevelItem(i); - current << it->whatsThis(1)+" :"+it->whatsThis(0); //Full Fluxbox command line - } - - QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); - for(int i=0; i 0){ - //Found Item to be replaced/removed - QString it = current.filter(info[i].section(":",1,10)).join("\n").section("\n",0,0); //ensure only the first match - if(it.section(" :",0,0).isEmpty()){ info.removeAt(i); i--; } //remove this entry - else{ info[i] = it; } //replace this entry - current.removeAll(it); //already taken care of - remove it from the current list - } - } - //Now save the new contents - for(int i=0; itree_shortcut->currentItem()==0){ return; } - ui->tree_shortcut->currentItem()->setText(1,""); - ui->tree_shortcut->currentItem()->setWhatsThis(1,""); - ui->push_save->setEnabled(true); - modshort=true; -} - -void MainUI::applyKeyBinding(){ - QKeySequence seq = ui->keyEdit_shortcut->keySequence(); - qDebug() << "New Key Sequence:" << seq.toString(QKeySequence::NativeText) << seq.toString(QKeySequence::PortableText); - if(seq.isEmpty()){ - //Verify removal of the action first - - //Now remove the action - delete ui->tree_shortcut->currentItem(); - }else{ - QTreeWidgetItem *it = ui->tree_shortcut->currentItem(); - it->setText(1,seq.toString(QKeySequence::NativeText)); - it->setWhatsThis(1,dispToFluxKeys(seq.toString(QKeySequence::PortableText))); - qDebug() << " - Flux Sequence:" << it->whatsThis(1); - } - ui->keyEdit_shortcut->clear(); - ui->push_save->setEnabled(true); - modshort=true; -} - -void MainUI::updateKeyConfig(){ - ui->group_shortcut_modify->setEnabled(ui->tree_shortcut->currentItem()!=0); - ui->keyEdit_shortcut->clear(); -} - -//=========== -// Defaults Page -//=========== -void MainUI::changeDefaultBrowser(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath=""; - } - //save the new app setting and adjust the button appearance - appsettings->setValue("default/webbrowser", desk.filePath); - LXDG::setDefaultAppForMime("x-scheme-handler/http", desk.filePath.section("/",-1)); - LXDG::setDefaultAppForMime("x-scheme-handler/https", desk.filePath.section("/",-1)); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_webbrowser->setText(desk.name); - ui->tool_default_webbrowser->setIcon(LXDG::findIcon(desk.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_webbrowser->setText(tr("Click to Set")); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultEmail(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); //allow reset to default - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath=""; - } - //save the new app setting and adjust the button appearance - LXDG::setDefaultAppForMime("application/email",desk.filePath); - // appsettings->setValue("default/email", desk.filePath); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_email->setText(file.name); - ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_email->setText(tr("Click to Set")); - ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultFileManager(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath="lumina-fm"; - } - //save the new app setting and adjust the button appearance - //appsettings->setValue("default/directory", desk.filePath); - //sessionsettings->setValue("default-filemanager", desk.filePath); - LXDG::setDefaultAppForMime("inode/directory", desk.filePath.section("/",-1)); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_filemanager->setText(file.name); - ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_filemanager->setText(tr("Click to Set")); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultTerminal(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath="xterm"; - } - //save the new app setting and adjust the button appearance - LXDG::setDefaultAppForMime("application/terminal",desk.filePath); - //sessionsettings->setValue("default-terminal", desk.filePath); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_terminal->setText(file.name); - ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_terminal->setText(tr("Click to Set")); - ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::loadDefaultSettings(){ - //First load the lumina-open specific defaults - // - Default File Manager - QString tmp = LXDG::findDefaultAppForMime("inode/directory"); - if(tmp.isEmpty()){ tmp = "lumina-fm"; } - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_filemanager->setText(file.name); - ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_filemanager->setText(tr("Click to Set")); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Terminal - tmp =LXDG::findDefaultAppForMime("application/terminal"); //sessionsettings->value("default-terminal", "xterm").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_terminal->setText(file.name); - ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_terminal->setText(tr("Click to Set")); - ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Web Browser - tmp = LXDG::findDefaultAppForMime("x-scheme-handler/http"); //appsettings->value("default/webbrowser", "").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_webbrowser->setText(file.name); - ui->tool_default_webbrowser->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_webbrowser->setText(tr("Click to Set")); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Email Client - tmp = LXDG::findDefaultAppForMime("application/email"); //appsettings->value("default/email", "").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_email->setText(file.name); - ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_email->setText(tr("Click to Set")); - ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - } - - //Now load the XDG mime defaults - ui->tree_defaults->clear(); - QStringList defMimeList = LXDG::listFileMimeDefaults(); - //qDebug() << "Mime List:\n" << defMimeList.join("\n"); - defMimeList.sort(); //sort by group/mime - //Now fill the tree by group/mime - QTreeWidgetItem *group = new QTreeWidgetItem(0); //nothing at the moment - QString ccat; - for(int i=0; isetText(0, cat); //add translations for known/common groups later - ui->tree_defaults->addTopLevelItem(group); - ccat = cat; - } - //Now create the entry - QTreeWidgetItem *it = new QTreeWidgetItem(); - it->setWhatsThis(0,mime); // full mimetype - it->setText(0, QString(tr("%1 (%2)")).arg(mime.section("/",-1), extlist) ); - it->setText(2,comment); - it->setToolTip(0, comment); it->setToolTip(1,comment); - //Now load the default (if there is one) - it->setWhatsThis(1,def); //save for later - if(def.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(def, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - it->setText(1,def.section("/",-1)); - it->setIcon(1, LXDG::findIcon("application-x-executable","") ); - }else{ - it->setText(1, file.name); - it->setIcon(1, LXDG::findIcon(file.icon,"") ); - } - }else if(!def.isEmpty()){ - //Binary/Other default - it->setText(1, def.section("/",-1)); - it->setIcon(1, LXDG::findIcon("application-x-executable","") ); - } - group->addChild(it); - } - - ui->tree_defaults->sortItems(0,Qt::AscendingOrder); - - checkdefaulticons(); -} - -void MainUI::cleardefaultitem(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList list; - for(int i=0; ichildCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Now clear the items - for(int i=0; iwhatsThis(0), ""); - //Now clear it in the UI - list[i]->setWhatsThis(1,""); //clear the app path - list[i]->setIcon(1,QIcon()); //clear the icon - list[i]->setText(1,""); //clear the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::setdefaultitem(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList list; - for(int i=0; ichildCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Prompt for which application to use - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; }//nothing selected - //Now set the items - for(int i=0; iwhatsThis(0), desk.filePath); - //Set it in the UI - list[i]->setWhatsThis(1,desk.filePath); //app path - list[i]->setIcon(1,LXDG::findIcon(desk.icon,"")); //reset the icon - list[i]->setText(1,desk.name); //reset the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::setdefaultbinary(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList list; - for(int i=0; ichildCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Prompt for which binary to use - QFileDialog dlg(this); - //dlg.setFilter(QDir::Executable | QDir::Files); //Does not work! Filters executable files as well as breaks browsing capabilities - dlg.setFileMode(QFileDialog::ExistingFile); - dlg.setDirectory( LOS::AppPrefix()+"bin" ); - dlg.setWindowTitle(tr("Select Binary")); - if( !dlg.exec() || dlg.selectedFiles().isEmpty() ){ - return; //cancelled - } - QString path = dlg.selectedFiles().first(); - //Make sure it is executable - if( !QFileInfo(path).isExecutable()){ - QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected binary is not executable!")); - return; - } - //Now set the items - for(int i=0; iwhatsThis(0), path); - //Set it in the UI - list[i]->setWhatsThis(1,path); //app path - list[i]->setIcon(1,LXDG::findIcon("application-x-executable","")); //clear the icon - list[i]->setText(1,path.section("/",-1)); //clear the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::checkdefaulticons(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - ui->tool_defaults_set->setEnabled(it!=0); - ui->tool_defaults_clear->setEnabled(it!=0); - ui->tool_defaults_setbin->setEnabled(it!=0); -} - -//=========== -// Session Page -//=========== -void MainUI::loadSessionSettings(){ - 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()); } - - //Now do the startup applications - STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items - //qDebug() << "StartApps:"; - ui->list_session_start->clear(); - for(int i=0; i " +STARTAPPS[i].name << STARTAPPS[i].isHidden; - if( !LXDG::checkValidity(STARTAPPS[i],false) || !QFile::exists(STARTAPPS[i].filePath) ){ continue; } - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i].icon,"application-x-executable"), STARTAPPS[i].name ); - it->setWhatsThis(STARTAPPS[i].filePath); //keep the file location - it->setToolTip(STARTAPPS[i].comment); - if(STARTAPPS[i].isHidden){ it->setCheckState( Qt::Unchecked); } - else{it->setCheckState( Qt::Checked); } - ui->list_session_start->addItem(it); - } - - - //Now do the general session options - ui->check_session_numlock->setChecked( sessionsettings->value("EnableNumlock", true).toBool() ); - ui->check_session_playloginaudio->setChecked( sessionsettings->value("PlayStartupAudio",true).toBool() ); - ui->check_session_playlogoutaudio->setChecked( sessionsettings->value("PlayLogoutAudio",true).toBool() ); - ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") ); - ui->line_session_time->setText( sessionsettings->value("TimeFormat","").toString() ); - ui->line_session_date->setText( sessionsettings->value("DateFormat","").toString() ); - index = ui->combo_session_datetimeorder->findData( sessionsettings->value("DateTimeOrder","timeonly").toString() ); - ui->combo_session_datetimeorder->setCurrentIndex(index); - - //Now do the localization settings - val = sessionsettings->value("InitLocale/LANG", "").toString(); - index = ui->combo_locale_lang->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_lang->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/LC_MESSAGES", "").toString(); - index = ui->combo_locale_message->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_message->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/LC_TIME", "").toString(); - index = ui->combo_locale_time->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_time->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/NUMERIC", "").toString(); - index = ui->combo_locale_numeric->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_numeric->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/MONETARY", "").toString(); - index = ui->combo_locale_monetary->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_monetary->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/COLLATE", "").toString(); - index = ui->combo_locale_collate->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_collate->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/CTYPE", "").toString(); - index = ui->combo_locale_ctype->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_ctype->setCurrentIndex(index); - - //Now do the session theme options - ui->combo_session_themefile->clear(); - ui->combo_session_colorfile->clear(); - ui->combo_session_icontheme->clear(); - QStringList current = LTHEME::currentSettings(); - // - local theme templates - QStringList tmp = LTHEME::availableLocalThemes(); - tmp.sort(); - for(int i=0; icombo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } - } - // - system theme templates - tmp = LTHEME::availableSystemThemes(); - tmp.sort(); - for(int i=0; icombo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } - } - // - local color schemes - tmp = LTHEME::availableLocalColors(); - tmp.sort(); - for(int i=0; icombo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } - } - // - system color schemes - tmp = LTHEME::availableSystemColors(); - tmp.sort(); - for(int i=0; icombo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } - } - // - icon themes - tmp = LTHEME::availableSystemIcons(); - tmp.sort(); - for(int i=0; icombo_session_icontheme->addItem(tmp[i]); - if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); } - } - // - Font - ui->font_session_theme->setCurrentFont( QFont(current[3]) ); - // - Font Size - ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() ); - - int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); - if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } - - //sessionstartchanged(); //make sure to update buttons - sessionLoadTimeSample(); - sessionLoadDateSample(); - sessionCursorChanged(); -} - -void MainUI::saveSessionSettings(){ - //Do the fluxbox settings first - 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 - - //Save the fluxbox settings - bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB); - if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/fluxbox-init"; } - - //Now do the start apps - bool newstartapps = false; - for(int i=0; ilist_session_start->count(); i++){ - QString file = ui->list_session_start->item(i)->whatsThis(); - bool enabled = ui->list_session_start->item(i)->checkState()==Qt::Checked; - bool found = false; - for(int i=0; ipush_session_setUserIcon->whatsThis().isEmpty()){ - QString filepath = ui->push_session_setUserIcon->whatsThis(); - if(filepath.isEmpty()){ filepath = QDir::homePath()+"/.loginIcon.png"; } - if(filepath=="reset"){ - QFile::remove(QDir::homePath()+"/.loginIcon.png"); - }else{ - QPixmap pix(filepath); - //Now scale it down if necessary - if(pix.width() > 64 || pix.height()>64){ - pix = pix.scaled(64,64,Qt::KeepAspectRatio, Qt::SmoothTransformation); - } - //Now save that to the icon file (will automatically convert it to a PNG file format) - pix.save(QDir::homePath()+"/.loginIcon.png"); - } - ui->push_session_setUserIcon->setWhatsThis(""); //clear it for later - //Now touch the settings file so that it re-loads the panel - QProcess::startDetached("touch \""+settings->fileName()+"\""); - } - - //Now do the general session options - sessionsettings->setValue("EnableNumlock", ui->check_session_numlock->isChecked()); - sessionsettings->setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked()); - sessionsettings->setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked()); - sessionsettings->setValue("TimeFormat", ui->line_session_time->text()); - sessionsettings->setValue("DateFormat", ui->line_session_date->text()); - sessionsettings->setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString()); - - //Now do the locale settings - sessionsettings->setValue("InitLocale/LANG", ui->combo_locale_lang->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_MESSAGES", ui->combo_locale_message->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_TIME", ui->combo_locale_time->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_NUMERIC", ui->combo_locale_numeric->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_MONETARY", ui->combo_locale_monetary->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_COLLATE", ui->combo_locale_collate->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_CTYPE", ui->combo_locale_ctype->currentData().toString() ); - - - //Now do the theme options - QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); - QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); - QString iconset = ui->combo_session_icontheme->currentText(); - QString font = ui->font_session_theme->currentFont().family(); - QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; - //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; - LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); - LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText()); - if(newstartapps){ loadSessionSettings(); } //make sure to re-load the session settings to catch the new files -} - -void MainUI::rmsessionstartitem(){ - if(ui->list_session_start->currentRow() < 0){ return; } //no item selected - delete ui->list_session_start->takeItem(ui->list_session_start->currentRow()); - sessionoptchanged(); -} - -void MainUI::addsessionstartapp(){ - //Prompt for the application to start - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; } //cancelled - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); - it->setWhatsThis(desk.filePath); - it->setToolTip(desk.comment); - it->setCheckState(Qt::Checked); - - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::addsessionstartbin(){ - QString chkpath = LOS::AppPrefix() + "bin"; - if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } - QString bin = QFileDialog::getOpenFileName(this, tr("Select Binary"), chkpath, tr("Application Binaries (*)") ); - if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - if( !QFileInfo(bin).isExecutable() ){ - QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); - return; - } - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) ); - it->setWhatsThis(bin); //command to be saved/run - it->setToolTip(bin); - it->setCheckState(Qt::Checked); - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::addsessionstartfile(){ - QString chkpath = QDir::homePath(); - QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") ); - if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) ); - it->setWhatsThis(bin); //file to be saved/run - it->setToolTip(bin); - it->setCheckState(Qt::Checked); - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::sessionoptchanged(){ - if(!loading){ - ui->push_save->setEnabled(true); - modses = true; - } -} - -void MainUI::sessionthemechanged(){ - //Update the Fluxbox Theme preview - QString previewfile = ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); - previewfile.append( (previewfile.endsWith("/") ? "preview.jpg": "/preview.jpg") ); - if(QFile::exists(previewfile)){ - ui->label_session_wpreview->setPixmap(QPixmap(previewfile)); - }else{ - ui->label_session_wpreview->setText(tr("No Preview Available")); - } - sessionoptchanged(); -} - -void MainUI::sessionCursorChanged(){ - //Update the Cursor Theme preview - QStringList info = LTHEME::cursorInformation(ui->combo_session_cursortheme->currentText()); - // - info format: [name, comment. sample file] - qDebug() << "Cursor Information:" << ui->combo_session_cursortheme->currentText() << info; - QPixmap img(info[2]); - //qDebug() << "Image Data:" << img.isNull() << img.size(); - if(!img.isNull()){ - ui->label_cursor_sample->setPixmap( img.scaledToHeight(ui->label_cursor_sample->height(), Qt::SmoothTransformation) ); - } - ui->label_cursor_sample->setToolTip(info[1]); - ui->combo_session_cursortheme->setToolTip(info[1]); - sessionoptchanged(); -} - -void MainUI::sessionEditColor(){ - //Get the current color file - QString file = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); - //Open the color edit dialog - ColorDialog dlg(this, PINFO, file); - dlg.exec(); - //Check whether the file got saved/changed - if(dlg.colorname.isEmpty() || dlg.colorpath.isEmpty() ){ return; } //cancelled - //Reload the color list and activate the new color - // - local color schemes - ui->combo_session_colorfile->clear(); - QStringList tmp = LTHEME::availableLocalColors(); - tmp.sort(); - for(int i=0; icombo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } - } - // - system color schemes - tmp = LTHEME::availableSystemColors(); - tmp.sort(); - for(int i=0; icombo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } - } - -} - -void MainUI::sessionEditTheme(){ - QString file = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); - //Open the theme editor dialog - ThemeDialog dlg(this, PINFO, file); - dlg.exec(); - //Check for file change/save - if(dlg.themename.isEmpty() || dlg.themepath.isEmpty()){ return; } //cancelled - //Reload the theme list and activate the new theme - ui->combo_session_themefile->clear(); - // - local theme templates - QStringList tmp = LTHEME::availableLocalThemes(); - tmp.sort(); - for(int i=0; icombo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } - } - // - system theme templates - tmp = LTHEME::availableSystemThemes(); - tmp.sort(); - for(int i=0; icombo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); - if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } - } -} - -void MainUI::sessionChangeUserIcon(){ - //Prompt for a new image file - QStringList imgformats; - QList fmts = QImageReader::supportedImageFormats(); - for(int i=0; ipush_session_setUserIcon->setWhatsThis("reset"); - }else{ - return; - } - } - }else{ - ui->push_session_setUserIcon->setWhatsThis(filepath); - } - //Now re-load the icon in the UI - QString path = ui->push_session_setUserIcon->whatsThis(); - if(path.isEmpty()){ path = QDir::homePath()+"/.loginIcon.png"; } - if(path=="reset"){ path.clear(); } - ui->push_session_setUserIcon->setIcon( LXDG::findIcon(path, "user-identity") ); - sessionoptchanged(); -} - -void MainUI::sessionResetSys(){ - LUtils::LoadSystemDefaults(); - QTimer::singleShot(500,this, SLOT(loadCurrentSettings()) ); -} - -void MainUI::sessionResetLumina(){ - LUtils::LoadSystemDefaults(true); //skip OS customizations - QTimer::singleShot(500,this, SLOT(loadCurrentSettings()) ); -} - -void MainUI::sessionLoadTimeSample(){ - if(ui->line_session_time->text().simplified().isEmpty()){ - ui->label_session_timesample->setText( QTime::currentTime().toString(Qt::DefaultLocaleShortDate) ); - }else{ - ui->label_session_timesample->setText( QTime::currentTime().toString( ui->line_session_time->text() ) ); - } - sessionoptchanged(); -} - -void MainUI::sessionShowTimeCodes(){ - QStringList msg; - msg << tr("Valid Time Codes:") << "\n"; - msg << QString(tr("%1: Hour without leading zero (1)")).arg("h"); - msg << QString(tr("%1: Hour with leading zero (01)")).arg("hh"); - msg << QString(tr("%1: Minutes without leading zero (2)")).arg("m"); - msg << QString(tr("%1: Minutes with leading zero (02)")).arg("mm"); - msg << QString(tr("%1: Seconds without leading zero (3)")).arg("s"); - msg << QString(tr("%1: Seconds with leading zero (03)")).arg("ss"); - msg << QString(tr("%1: AM/PM (12-hour) clock (upper or lower case)")).arg("A or a"); - msg << QString(tr("%1: Timezone")).arg("t"); - QMessageBox::information(this, tr("Time Codes"), msg.join("\n") ); -} - -void MainUI::sessionLoadDateSample(){ - if(ui->line_session_date->text().simplified().isEmpty()){ - ui->label_session_datesample->setText( QDate::currentDate().toString(Qt::DefaultLocaleShortDate) ); - }else{ - ui->label_session_datesample->setText( QDate::currentDate().toString( ui->line_session_date->text() ) ); - } - sessionoptchanged(); -} - -void MainUI::sessionShowDateCodes(){ - QStringList msg; - msg << tr("Valid Date Codes:") << "\n"; - msg << QString(tr("%1: Numeric day without a leading zero (1)")).arg("d"); - msg << QString(tr("%1: Numeric day with leading zero (01)")).arg("dd"); - msg << QString(tr("%1: Day as abbreviation (localized)")).arg("ddd"); - msg << QString(tr("%1: Day as full name (localized)")).arg("dddd"); - msg << QString(tr("%1: Numeric month without leading zero (2)")).arg("M"); - msg << QString(tr("%1: Numeric month with leading zero (02)")).arg("MM"); - msg << QString(tr("%1: Month as abbreviation (localized)")).arg("MMM"); - msg << QString(tr("%1: Month as full name (localized)")).arg("MMMM"); - msg << QString(tr("%1: Year as 2-digit number (15)")).arg("yy"); - msg << QString(tr("%1: Year as 4-digit number (2015)")).arg("yyyy"); - msg << tr("Text may be contained within single-quotes to ignore replacements"); - QMessageBox::information(this, tr("Date Codes"), msg.join("\n") ); -} diff --git a/src-qt5/core-utils/lumina-config/mainUI.h b/src-qt5/core-utils/lumina-config/mainUI.h deleted file mode 100644 index da267948..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.h +++ /dev/null @@ -1,171 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_CONFIG_MAIN_UI_H -#define _LUMINA_CONFIG_MAIN_UI_H - -// Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// libLumina includes -#include -#include - -// local includes -#include "LPlugins.h" -//#include "KeyCatch.h" -#include "AppDialog.h" -#include "ColorDialog.h" -#include "ThemeDialog.h" -#include "GetPluginDialog.h" -#include "PanelWidget.h" - -//namespace for using the *.ui file -namespace Ui{ - class MainUI; -}; - -class MainUI : public QMainWindow{ - Q_OBJECT -public: - MainUI(); - ~MainUI(); - - //Panels Page simplifications - QString getColorStyle(QString current, bool allowTransparency = true); - - //Get an application on the system - XDGDesktop getSysApp(bool allowreset = false); - -private: - Ui::MainUI *ui; //the *.ui file access - QSettings *settings, *appsettings, *sessionsettings; - QDesktopWidget *desktop; - LPlugins *PINFO; - QMenu *ppmenu, *mpmenu; - QString panelcolor; - QString DEFAULTBG; - QList sysApps; - QList STARTAPPS; - bool loading, panadjust; - bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags - int panelnumber; - QList PANELS; - - //General purpose functions (not connected to buttons) - void setupMenus(); //called during initialization - void setupConnections(); //called during intialization - - int currentDesktop(); //the number for the current desktop - - //Convert to/from fluxbox keyboard shortcuts - QString dispToFluxKeys(QString); - QString fluxToDispKeys(QString); - - //Read/overwrite a text file - QStringList readFile(QString path); - bool overwriteFile(QString path, QStringList contents); - -public slots: - void setupIcons(); //called during initialization - -private slots: - void slotSingleInstance(); - - //General UI Behavior - void slotChangePage(bool enabled); - void slotChangeScreen(); - void saveAndQuit(); - - //General Utility Functions - void loadCurrentSettings(bool screenonly = false); - void saveCurrentSettings(bool screenonly = false); - - //Desktop Page - //void deskplugchanged(); - void deskbgchanged(); - void desktimechanged(); - void deskbgremoved(); - void deskbgadded(); - void deskbgcoloradded(); - void deskbgdiradded(); - void deskbgdirradded(); - void deskplugadded(); - void deskplugremoved(); - - - //Panels Page - void panelValChanged(); - void newPanel(); - void removePanel(int); //connected to a signal from the panel widget - void loadPanels(); - void savePanels(); - - //Menu Page/Tab - void addmenuplugin(); - void rmmenuplugin(); - void upmenuplugin(); - void downmenuplugin(); - void checkmenuicons(); - - //Shortcuts Page - void loadKeyboardShortcuts(); - void saveKeyboardShortcuts(); - void clearKeyBinding(); - void applyKeyBinding(); - void updateKeyConfig(); - //void getKeyPress(); - - //Defaults Page - void changeDefaultBrowser(); - void changeDefaultEmail(); - void changeDefaultFileManager(); - void changeDefaultTerminal(); - void loadDefaultSettings(); - //void saveDefaultSettings(); - void cleardefaultitem(); - void setdefaultitem(); - void setdefaultbinary(); - void checkdefaulticons(); - - //Session Page - void loadSessionSettings(); - void saveSessionSettings(); - void rmsessionstartitem(); - void addsessionstartapp(); - void addsessionstartbin(); - void addsessionstartfile(); - void sessionoptchanged(); - void sessionthemechanged(); - void sessionCursorChanged(); - //void sessionstartchanged(); - void sessionEditColor(); - void sessionEditTheme(); - void sessionChangeUserIcon(); - void sessionResetSys(); - void sessionResetLumina(); - void sessionLoadTimeSample(); - void sessionShowTimeCodes(); - void sessionLoadDateSample(); - void sessionShowDateCodes(); -}; - -#endif diff --git a/src-qt5/core-utils/lumina-config/mainUI.ui b/src-qt5/core-utils/lumina-config/mainUI.ui deleted file mode 100644 index 9edff2e7..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.ui +++ /dev/null @@ -1,1792 +0,0 @@ - - - MainUI - - - true - - - - 0 - 0 - 660 - 448 - - - - Lumina Settings - - - true - - - false - - - false - - - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 1 - - - 0 - - - 1 - - - - - Qt::Horizontal - - - - 195 - 20 - - - - - - - - Screen Number: - - - - - - - 1 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - 4 - - - - - 3 - - - 2 - - - 2 - - - - - 0 - - - - Wallpaper - - - - - - - - - - - QToolButton::InstantPopup - - - Qt::ToolButtonTextBesideIcon - - - - - - - rm - - - - - - - - - - - - - - - - Qt::Horizontal - - - - - - - (Resolution) - - - Qt::AlignCenter - - - false - - - - - - - Qt::Horizontal - - - - - - - Single Background - - - true - - - - - - - Rotate Background - - - - - - - Minutes - - - Every - - - 1 - - - 120 - - - 5 - - - - - - - Qt::Horizontal - - - - - - - Layout: - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - BG-sample - - - false - - - Qt::AlignCenter - - - - - - - - - - Theme - - - - - - Font: - - - - - - - false - - - - - - - Font Size: - - - - - - - point - - - - - - - Theme Template: - - - - - - - - - QComboBox::AdjustToContents - - - - - - - Create/Edit a theme template (Advanced) - - - - - - Edit - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - Color Scheme: - - - - - - - - - QComboBox::AdjustToContents - - - - - - - Create/Edit a color scheme - - - - - - Edit - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - Icon Pack: - - - - - - - - - - Mouse Cursors: - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - - - true - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - 3 - - - 2 - - - 3 - - - 2 - - - - - 1 - - - - Desktop - - - - - - - 75 - true - - - - Quick-Access Menu - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - - - - - 75 - true - - - - Embedded Utilities - - - Qt::AlignCenter - - - - - - - - - - QAbstractItemView::ExtendedSelection - - - true - - - - - - - - - add - - - - - - - rem - - - - - - - Qt::Horizontal - - - - 10 - 20 - - - - - - - - - - - - add - - - - - - - rem - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - up - - - - - - - dn - - - - - - - - - Display Desktop Folder Contents - - - - - - - - Panels - - - - 0 - - - 0 - - - 0 - - - 0 - - - 2 - - - - - - - add - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - QAbstractScrollArea::AdjustToContents - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - - - - - - - - - - - 3 - - - 2 - - - 2 - - - - - 0 - - - false - - - false - - - true - - - false - - - 200 - - - true - - - 200 - - - true - - - - Action - - - - - Keyboard Shortcut - - - - - - - - Modify Shortcut - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - - - Clear Shortcut - - - Qt::ToolButtonTextBesideIcon - - - - - - - Apply Change - - - Qt::ToolButtonTextBesideIcon - - - - - - - Change Key Binding: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Note: Current key bindings need to be cleared and saved before they can be re-used. - - - Qt::AlignCenter - - - true - - - - - - - - - 3 - - - 2 - - - 2 - - - - - 0 - - - - Auto-Started - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Application - - - Qt::ToolButtonTextBesideIcon - - - - - - - Binary - - - Qt::ToolButtonTextBesideIcon - - - - - - - File - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - true - - - - - - - - File Defaults - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - false - - - - Specific File Types - - - - 2 - - - 2 - - - - - - 20 - 20 - - - - 20 - - - true - - - true - - - true - - - 200 - - - 150 - - - - Type/Group - - - - - Default Application - - - - - Description - - - - - - - - - - Clear - - - Qt::ToolButtonTextBesideIcon - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Set App - - - Qt::ToolButtonTextBesideIcon - - - - - - - Set Binary - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - - - - - Common Applications - - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - - 75 - true - - - - Web Browser: - - - - - - - ... - - - Qt::ToolButtonTextBesideIcon - - - - - - - - 75 - true - - - - E-Mail Client: - - - - - - - ... - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - - - - 75 - true - - - - File Manager: - - - - - - - - 75 - true - - - - Virtual Terminal: - - - - - - - ... - - - Qt::ToolButtonTextBesideIcon - - - - - - - ... - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - 3 - - - 2 - - - 2 - - - - - - - - 2 - - - - General Options - - - - - - - - Enable numlock on startup - - - - - - - Play chimes on startup - - - - - - - Play chimes on exit - - - - - - - - - Change User Icon - - - - 32 - 32 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 50 - false - - - - Reset Desktop Settings - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Return to system defaults - - - - - - - Return to Lumina defaults - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - Time Format: - - - - - - - - - - - - View format codes - - - ... - - - true - - - - - - - - - Sample: - - - - - - - - - - Qt::AlignCenter - - - - - - - Date Format: - - - - - - - - - - - - View format codes - - - ... - - - true - - - - - - - - - Sample: - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - Qt::AlignCenter - - - - - - - Display Format - - - - - - - - - - - - Qt::Vertical - - - - 20 - 128 - - - - - - - - - Locale - - - - - - Language - - - - - - - - - - Messages - - - - - - - - - - Time - - - - - - - - - - Numeric - - - - - - - - - - Monetary - - - - - - - - - - Collate - - - - - - - - - - CType - - - - - - - - - - System localization settings (restart required) - - - - - - - - Window System - - - - - - - - Number of Workspaces - - - - - - - 1 - - - 10 - - - - - - - New Window Placement - - - - - - - - - - Focus Policy - - - - - - - - - - Window Theme - - - - - - - - - - - - - 0 - 0 - - - - Window Theme Preview - - - - - - true - - - - - 0 - 0 - 573 - 97 - - - - - 0 - 0 - - - - - 1 - - - 1 - - - 1 - - - 1 - - - - - - 0 - 0 - - - - - - - QFrame::NoFrame - - - QFrame::Sunken - - - No Preview Available - - - false - - - Qt::AlignCenter - - - - - - - - - - - - - - - - - - - - - - 4 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Save Changes - - - Ctrl+S - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 120 - 0 - - - - Qt::CustomContextMenu - - - toolBar - - - false - - - Qt::ToolButtonTextUnderIcon - - - false - - - TopToolBarArea - - - false - - - - - - - - - - true - - - Appearance - - - Appearance - - - Desktop Appearance - - - - - true - - - Interface - - - Interface - - - Interface Configuration - - - - - true - - - Session - - - Session - - - Session Options - - - - - true - - - Applications - - - Applications - - - Application Management - - - - - true - - - Shortcuts - - - Shortcuts - - - Keyboard Shortcuts - - - - - - diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 3102fe7b..0bb3cbf0 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -86,6 +86,10 @@ void mainWindow::changePage(QString id){ connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) ); page->setFocus(); ui->toolBar->setVisible( !cpage.isEmpty() ); + }else{ + //No change in page (some other refresh) + // just re-use the current widget + page = static_cast(this->centralWidget()); } //Now load the new page page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.cpp b/src-qt5/core-utils/lumina-config/pages/page_main.cpp index ec03f8a5..976e7c69 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); ui->treeWidget->setMouseTracking(true); + ui->treeWidget->setSortingEnabled(false); //the QTreeView sort flag always puts them in backwards (reverse-alphabetical) connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); @@ -65,10 +66,11 @@ void page_main::UpdateItems(QString search){ else{ ui->treeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } - if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(!search.isEmpty()); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(!search.isEmpty()); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(!search.isEmpty()); } + if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(!search.isEmpty()); } + ui->treeWidget->sortItems(0, Qt::AscendingOrder); } //================ -- cgit From f7e5fc2a5fc9795fa7cc3203d133d2eb5b1d09a5 Mon Sep 17 00:00:00 2001 From: q5sys Date: Tue, 28 Jun 2016 10:28:45 -0400 Subject: Add files via upload --- .../defaults/desktop-background-trueos.jpg | Bin 0 -> 4005674 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg new file mode 100644 index 00000000..de11074e Binary files /dev/null and b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg differ -- cgit From 89cf83b31069cd3358ef31083faaa717f551eec9 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 11:22:58 -0400 Subject: Commit some WIP (but disabled) to get the panels using the compositing WM for transparency effects (issues with xcompmgr at the moment?). --- src-qt5/core/lumina-desktop/LPanel.cpp | 29 ++++++++++++++--------- src-qt5/core/lumina-desktop/LPanel.h | 2 +- src-qt5/core/lumina-desktop/panel-plugins/NewPP.h | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 7c0630f5..55ec5469 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -13,6 +13,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ //Take care of inputs this->setMouseTracking(true); + hascompositer = false; //LUtils::isValidBinary("xcompmgr"); //NOT WORKING YET - xcompmgr issue with special window flags? if(DEBUG){ qDebug() << " - Creating Panel:" << scr << num; } bgWindow = parent; //save for later //Setup the widget overlay for the entire panel to provide transparency effects @@ -42,7 +43,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->setWindowTitle("LuminaPanel"); this->setObjectName("LuminaPanelBackgroundWidget"); - this->setStyleSheet("QToolButton::menu-indicator{ image: none; }"); + this->setStyleSheet("QToolButton::menu-indicator{ image: none; } QWidget#LuminaPanelBackgroundWidget{ background: transparent; }"); panelArea->setObjectName("LuminaPanelColor"); layout = new QBoxLayout(QBoxLayout::LeftToRight); layout->setContentsMargins(0,0,0,0); @@ -53,7 +54,11 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->show(); LSession::handle()->XCB->SetAsPanel(this->winId()); LSession::handle()->XCB->SetAsSticky(this->winId()); - + if(hascompositer){ + //qDebug() << "Enable Panel compositing"; + this->setWindowOpacity(0.0); //fully transparent background for the main widget + panelArea->setWindowOpacity(0.0); + } QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes } @@ -309,15 +314,17 @@ void LPanel::checkPanelFocus(){ // PROTECTED //=========== void LPanel::paintEvent(QPaintEvent *event){ - QPainter *painter = new QPainter(this); - //qDebug() << "Paint Tray:"; - //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow - QRect rec = this->geometry(); //start with the global geometry of the panel - //Need to translate that rectangle to the background image coordinates - //qDebug() << " - Rec:" << rec << hidden << this->geometry(); - rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y() ); - //qDebug() << " - Adjusted Global Rec:" << rec; - painter->drawPixmap(QRect(0,0,this->width(), this->height()), bgWindow->grab(rec) ); + if(!hascompositer){ + QPainter *painter = new QPainter(this); + //qDebug() << "Paint Tray:"; + //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow + QRect rec = this->geometry(); //start with the global geometry of the panel + //Need to translate that rectangle to the background image coordinates + //qDebug() << " - Rec:" << rec << hidden << this->geometry(); + rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y() ); + //qDebug() << " - Adjusted Global Rec:" << rec; + painter->drawPixmap(QRect(0,0,this->width(), this->height()), bgWindow->grab(rec) ); + } QWidget::paintEvent(event); //now pass the event along to the normal painting event } diff --git a/src-qt5/core/lumina-desktop/LPanel.h b/src-qt5/core/lumina-desktop/LPanel.h index 396ffecc..b3c9ba60 100644 --- a/src-qt5/core/lumina-desktop/LPanel.h +++ b/src-qt5/core/lumina-desktop/LPanel.h @@ -36,7 +36,7 @@ private: QDesktopWidget *screen; QWidget *bgWindow, *panelArea; QPoint hidepoint, showpoint; //for hidden panels: locations when hidden/visible - bool defaultpanel, horizontal, hidden; + bool defaultpanel, horizontal, hidden, hascompositer; int screennum; int panelnum; int viswidth; diff --git a/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h b/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h index 50bf2232..2641ad79 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h @@ -50,7 +50,7 @@ public: plug = new LSysTray(parent, plugin, horizontal); }else if(plugin.startsWith("desktopswitcher---")){ plug = new LDesktopSwitcher(parent, plugin, horizontal); - }else if(plugin.startsWith("battery---")){ + }else if(plugin.startsWith("battery---") && LOS::hasBattery()){ plug = new LBattery(parent, plugin, horizontal); }else if(plugin.startsWith("clock---")){ plug = new LClock(parent, plugin, horizontal); -- cgit From 2979715098badeeedca5709817d7944ca16d2d69 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 12:50:54 -0400 Subject: Cleanup the build system for how the special OS-specific config file/wallpaper are added into the build. This now means that we can commit any generic *-${OS}.[jpg/conf] here to the defaults directory and it will automatically get pulled in at build time. --- .../core/lumina-desktop/defaults/defaultapps.conf | 1 - .../defaults/desktop-background-TrueOS.jpg | Bin 0 -> 4005674 bytes .../defaults/desktop-background-trueos.jpg | Bin 4005674 -> 0 bytes .../defaults/desktop-background.pcbsd.jpg | Bin 3237484 -> 0 bytes .../lumina-desktop/defaults/desktopsettings.conf | 1 - .../defaults/luminaDesktop-TrueOS.conf | 98 +++++++++++++++++++ .../lumina-desktop/defaults/luminaDesktop.conf | 2 +- .../defaults/luminaDesktop.pcbsd.conf | 105 --------------------- src-qt5/core/lumina-desktop/lumina-desktop.pro | 18 +++- 9 files changed, 113 insertions(+), 112 deletions(-) delete mode 100644 src-qt5/core/lumina-desktop/defaults/defaultapps.conf create mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktopsettings.conf create mode 100644 src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf delete mode 100644 src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf diff --git a/src-qt5/core/lumina-desktop/defaults/defaultapps.conf b/src-qt5/core/lumina-desktop/defaults/defaultapps.conf deleted file mode 100644 index 8b137891..00000000 --- a/src-qt5/core/lumina-desktop/defaults/defaultapps.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg new file mode 100644 index 00000000..de11074e Binary files /dev/null and b/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg deleted file mode 100644 index de11074e..00000000 Binary files a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg and /dev/null differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg deleted file mode 100644 index 80c3cf02..00000000 Binary files a/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg and /dev/null differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf b/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf deleted file mode 100644 index 8b137891..00000000 --- a/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf new file mode 100644 index 00000000..f3f4a7bc --- /dev/null +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf @@ -0,0 +1,98 @@ +#This is the configuration file that generates all the default settings files for the Lumina desktop +# For any setting that can take a list of values, each vale needs to be seperated by a comma and a space (", ") +# Example: some_setting=item1, item2, item3 + +#NOTE: To pre-setup default applications for particular mime-types, you need to create *.desktop entries on +# system corresponding to the XDG mime-type specifications for default applications +# See Here for specifications: http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/ + +# Possible Desktop Plugins (Lumina version 0.9.1): +# calendar, applauncher[::absolute path to *.desktop file], desktopview, notepad, audioplayer, rssreader +# Possible Panel Plugins (Lumina version 0.9.1): +# userbutton, desktopbar, spacer, desktopswitcher, battery, clock, systemdashboard, systemstart +# taskmanager[-nogroups], systemtray, homebutton, appmenu, applauncher[::absolute path to *.desktop file] +# Possible Menu Plugins (Lumina version 0.9.1): +# terminal, filemanager, applications, line, settings, windowlist, app:: + +#GENERAL SESSION SETTINGS +session_enablenumlock=false #[true/false] Enable numlock on login using "numlockx" +session_playloginaudio=true #[true/false] Play the audio chimes on log in +session_playlogoutaudio=true #[true/false] Play the audio chimes on log out + +# DEFAULT UTILITIES +# Provide the full path to *.desktop file, or a binary name which exists on PATH +# *.desktop files provide better support for input formats, and are recommended +#Note: the last "ifexists" entry has the highest priority for each session utility +session_default_terminal_ifexists=xterm.desktop +session_default_terminal_ifexists=lumina-terminal.desktop +session_default_filemanager=lumina-fm.desktop +session_default_webbrowser_ifexists=chromium-browser.desktop +session_default_webbrowser_ifexists=firefox.desktop +session_default_webbrowser_ifexists=qupzilla.desktop +session_default_email_ifexists=trojita.desktop + +#DEFAULT UTILITIES FOR INDIVIDUAL MIME TYPES +# Format: mime_default_[_ifexists]=<*.desktop file> +mime_default_text/*_ifexists=lumina-textedit.desktop +mime_default_audio/*_ifexists=vlc.desktop +mime_default_video/*_ifexists=vlc.desktop +mime_default_application/zip_ifexists=peazip.desktop +mime_default_application/x-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-tar_ifexists=peazip.desktop +mime_default_unknown/*=lumina-textedit.desktop +mime_default_application/x-shellscript=lumina-textedit.desktop + +#THEME SETTINGS +theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) +theme_colorfile=Grey-Dark #Name of the color spec file to use for theming +theme_iconset=oxygen #Name of the icon theme to use +theme_font=Arial #Name of the font family to use +theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (%) ) + +#DESKTOP SETTINGS (used for the primary screen in multi-screen setups) +desktop_visiblepanels=2 #[0 - 12] The number of panels visible by default +#desktop.backgroundfiles= #list of absolute file paths for image files (disable for Lumina default) +desktop_backgroundrotateminutes=5 #[positive integer] number of minutes between background rotations (if multiple files) +desktop_plugins=rssreader #list of plugins to be shown on the desktop by default +desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop items + +#PANEL SETTINGS (preface with panel1. or panel2., depending on the number of panels you have visible by default) +panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on +panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or %[W/H] for a percentage of the screen width/height) +panel1_autohide=false #[true/false] Have the panel become visible on mouse-over +panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock, battery #list of plugins for the panel +panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels +panel1_edgepercent=99 #[1->100] percentage of the screen edge to use + +#MENU SETTINGS (right-click menu) +menu_plugins=terminal, filemanager, applications, line, settings #list of menu plugins to show + +#FAVORITES CUSTOMIZATION +#favorites_add= #Create a favorites entry for this file/dir +#favorites_remove= #Remove a favorites entry for this file/dir +#favorites_add_ifexists= #Create a favorites entry for this file/dir if the file/dir exists +favorites_add_ifexists=firefox.desktop +favorites_add_ifexists=chromium-browser.desktop +favorites_add_ifexists=qupzilla.desktop +favorites_add_ifexists=thunderbird.desktop +favorites_add_ifexists=trojita.desktop +favorites_add_ifexists=smplayer.desktop +favorites_add_ifexists=vlc.desktop +favorites_add_ifexists=pithos.desktop +favorites_add_ifexists=~/Documents +favorites_add_ifexists=~/Downloads +favorites_add_ifexists=~/Pictures +favorites_add_ifexists=~/Videos + +#QUICKLAUNCH CUSTOMIZATION (requires the use of the "systemstart" panel plugin) +#quicklaunch_add= #Create a quicklaunch shortcut for this file/dir +#quicklaunch_add_ifexists= #Create a quicklaunch shortcut for this file/dir if the file/dir exists + +#Generic scripts/utilities to run for any additional setup procedures +# These are always run after all other settings are saved +#Format: usersetup_run= +usersetup_run=xdg-user-dirs-update diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 68ea1f3c..7f8e363c 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -64,7 +64,7 @@ desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or %[W/H] for a percentage of the screen width/height) panel1_autohide=false #[true/false] Have the panel become visible on mouse-over -panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock #list of plugins for the panel +panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock, battery #list of plugins for the panel panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels panel1_edgepercent=99 #[1->100] percentage of the screen edge to use diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf deleted file mode 100644 index 3d434501..00000000 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf +++ /dev/null @@ -1,105 +0,0 @@ -#This is the configuration file that generates all the default settings files for the Lumina desktop -# For any setting that can take a list of values, each vale needs to be seperated by a comma and a space (", ") -# Example: some_setting=item1, item2, item3 - -#NOTE: To pre-setup default applications for particular mime-types, you need to create *.desktop entries on -# system corresponding to the XDG mime-type specifications for default applications -# See Here for specifications: http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/ - -# Possible Desktop Plugins (Lumina version 0.9.1): -# calendar, applauncher[::absolute path to *.desktop file], desktopview, notepad, audioplayer, rssreader -# Possible Panel Plugins (Lumina version 0.9.1): -# userbutton, desktopbar, spacer, desktopswitcher, battery, clock, systemdashboard, systemstart -# taskmanager[-nogroups], systemtray, homebutton, appmenu, applauncher[::absolute path to *.desktop file] -# Possible Menu Plugins (Lumina version 0.9.1): -# terminal, filemanager, applications, line, settings, windowlist, app:: - -#GENERAL SESSION SETTINGS -session_enablenumlock=false #[true/false] Enable numlock on login using "numlockx" -session_playloginaudio=true #[true/false] Play the audio chimes on log in -session_playlogoutaudio=true #[true/false] Play the audio chimes on log out - -# DEFAULT UTILITIES -# Provide the full path to *.desktop file, or a binary name which exists on PATH -# *.desktop files provide better support for input formats, and are recommended -#Note: the last "ifexists" entry has the highest priority for each session utility -session_default_terminal_ifexists=xterm.desktop -session_default_terminal_ifexists=lumina-terminal.desktop -session_default_filemanager=lumina-fm.desktop -session_default_webbrowser_ifexists=chromium-browser.desktop -session_default_webbrowser_ifexists=firefox.desktop -session_default_webbrowser_ifexists=qupzilla.desktop -session_default_email_ifexists=trojita.desktop - -#DEFAULT UTILITIES FOR INDIVIDUAL MIME TYPES -# Format: mime_default_[_ifexists]=<*.desktop file> -mime_default_text/*_ifexists=lumina-textedit.desktop -mime_default_audio/*_ifexists=vlc.desktop -mime_default_video/*_ifexists=vlc.desktop -mime_default_application/zip_ifexists=peazip.desktop -mime_default_application/x-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-tar_ifexists=peazip.desktop -mime_default_unknown/*=lumina-textedit.desktop -mime_default_application/x-shellscript=lumina-textedit.desktop - -#THEME SETTINGS -theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) -theme_colorfile=Grey-Dark #Name of the color spec file to use for theming -theme_iconset=oxygen #Name of the icon theme to use -theme_font=Arial #Name of the font family to use -theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (%) ) - -#DESKTOP SETTINGS (used for the primary screen in multi-screen setups) -desktop_visiblepanels=2 #[0 - 12] The number of panels visible by default -#desktop.backgroundfiles= #list of absolute file paths for image files (disable for Lumina default) -desktop_backgroundrotateminutes=5 #[positive integer] number of minutes between background rotations (if multiple files) -desktop_plugins=rssreader #list of plugins to be shown on the desktop by default -desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop items - -#PANEL SETTINGS (preface with panel1. or panel2., depending on the number of panels you have visible by default) -panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on -panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or %[W/H] for a percentage of the screen width/height) -panel1_autohide=false #[true/false] Have the panel become visible on mouse-over -panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock #list of plugins for the panel -panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels -panel1_edgepercent=99 #[1->100] percentage of the screen edge to use - -panel2_location=top -panel2_pixelsize=3%H -panel2_autohide=true -panel2_plugins=spacer, desktopbar, spacer -panel2_pinlocation=center -panel2_edgepercent=10 - -#MENU SETTINGS (right-click menu) -menu_plugins=terminal, filemanager, applications, line, settings #list of menu plugins to show - -#FAVORITES CUSTOMIZATION -#favorites_add= #Create a favorites entry for this file/dir -#favorites_remove= #Remove a favorites entry for this file/dir -#favorites_add_ifexists= #Create a favorites entry for this file/dir if the file/dir exists -favorites_add_ifexists=firefox.desktop -favorites_add_ifexists=chromium-browser.desktop -favorites_add_ifexists=qupzilla.desktop -favorites_add_ifexists=thunderbird.desktop -favorites_add_ifexists=trojita.desktop -favorites_add_ifexists=smplayer.desktop -favorites_add_ifexists=vlc.desktop -favorites_add_ifexists=pithos.desktop -favorites_add_ifexists=~/Documents -favorites_add_ifexists=~/Downloads -favorites_add_ifexists=~/Pictures -favorites_add_ifexists=~/Videos - -#QUICKLAUNCH CUSTOMIZATION (requires the use of the "systemstart" panel plugin) -#quicklaunch_add= #Create a quicklaunch shortcut for this file/dir -#quicklaunch_add_ifexists= #Create a quicklaunch shortcut for this file/dir if the file/dir exists - -#Generic scripts/utilities to run for any additional setup procedures -# These are always run after all other settings are saved -#Format: usersetup_run= -usersetup_run=xdg-user-dirs-update diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 33c20502..4bf38a08 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -87,12 +87,22 @@ defaults.path = $${L_SHAREDIR}/lumina-desktop/ conf.path = $${L_ETCDIR} -#Now do any TrueOS defaults (if set) -PCBSD{ - conf.extra = cp defaults/luminaDesktop.pcbsd.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist - defaults.extra = cp defaults/desktop-background.pcbsd.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg +#Now do any OS-specific defaults (if available) +#First see if there is a known OS override first +TRUEOS{ + message("Installing defaults for OS: TrueOS") + OS=TrueOS +} +exists("defaults/luminaDesktop-$${OS}.conf"){ + message(" -- Found OS-specific system config file: $${OS}"); + conf.extra = cp defaults/luminaDesktop-$${OS}.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist }else{ conf.extra = cp defaults/luminaDesktop.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist +} +exists("defaults/desktop-background-$${OS}.jpg"){ + message(" -- Found OS-specific background image: $${OS}"); + defaults.extra = cp defaults/desktop-background-$${OS}.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg +}else{ defaults.extra = cp defaults/desktop-background.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg } -- cgit From c1ef1645eb0ca856f5f5cb6c4acb9fc1115ca88f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 13:14:39 -0400 Subject: Update the coming-soon 0.9.1 port makefile for FreeBSD, and also setup the "DEFAULT_SETTINGS=" build flag for installing config files or desktop wallpapers for other OS's. --- port-files/FreeBSD/Makefile | 11 ++++++----- src-qt5/core/lumina-desktop/lumina-desktop.pro | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 34004c0b..989a0b8f 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -24,10 +24,10 @@ RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg-minimal \ CONFLICTS= lumina-devel-0* -OPTIONS_DEFINE= MULTIMEDIA PCBSD +OPTIONS_DEFINE= MULTIMEDIA TRUEOS OPTIONS_DEFAULT= MULTIMEDIA MULTIMEDIA_DESC= Install multimedia support backend (gstreamer) -PCBSD_DESC= Use the TrueOS system interface settings. +TRUEOS_DESC= Use the TrueOS system interface settings. .include @@ -44,11 +44,12 @@ USE_QT5= core gui network svg multimedia imageformats \ buildtools_build x11extras concurrent USES= desktop-file-utils qmake USE_GITHUB= yes -GH_ACCOUNT= pcbsd +GH_ACCOUNT= trueos #Setup the qmake configuration options -.if {PORT_OPTIONS:MPCBSD} -QMAKE_ARGS= CONFIG+="configure PCBSD" +.if {PORT_OPTIONS:MTRUEOS} +QMAKE_ARGS= CONFIG+="configure" \ + DEFAULT_SETTINGS=TrueOS .endif .include diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 4bf38a08..4cebf3de 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -89,9 +89,9 @@ conf.path = $${L_ETCDIR} #Now do any OS-specific defaults (if available) #First see if there is a known OS override first -TRUEOS{ - message("Installing defaults for OS: TrueOS") - OS=TrueOS +!isEmpty(DEFAULT_SETTINGS){ + message("Installing defaults settings for OS: $${DEFAULT_SETTINGS}") + OS=$${DEFAULT_SETTINGS} } exists("defaults/luminaDesktop-$${OS}.conf"){ message(" -- Found OS-specific system config file: $${OS}"); -- cgit From c5b037322dcfcc4d11e000a83060355c4013527b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 13:30:38 -0400 Subject: Update the README to account for the new build system flags. --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 23fb6583..93ad00af 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,15 @@ How to build from source * Build Note: Compile-time options may be set at this time using qmake. The syntax for this is typically: `qmake CONFIG+="PREFIX=/some/prefix LIBPREFIX=/some/lib/prefix DESTDIR=/some/temporary/packaging/dir"`. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes. * PREFIX: Determines the base directory used to install/run Lumina ("/usr/local" by default) + Example: `qmake PREFIX=/usr/local` * LIBPREFIX: Determines the location to install the Lumina library ("PREFIX/lib" by default) + Example: `qmake LIBPREFIX=/usr/local/lib` * DESTDIR: An optional directory where the compiled files will be placed temporary (such as for packaging/distributing via some other system). + Example: `qmake DESTDIR=/my/build/dir` * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the trueos/lumina-i18n repo instead. - + Example: `qmake CONFIG+=WITH_I18N` + * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (used for performing backtraces on builds that crash or for other development tests) + Example: `qmake CONFIG+=debug` 4) Run "make" to compile all the Lumina projects (can be done as user) -- cgit From 845d9ff9425a18d11dc9934891d16c3e1a2542ed Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 13:31:34 -0400 Subject: Also add info about the new "DEFAULT_SETTINGS" build flag to the readme. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93ad00af..aba4870a 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,18 @@ How to build from source > Project MESSAGE: Build Settings Loaded: FreeBSD - * Build Note: Compile-time options may be set at this time using qmake. The syntax for this is typically: `qmake CONFIG+="PREFIX=/some/prefix LIBPREFIX=/some/lib/prefix DESTDIR=/some/temporary/packaging/dir"`. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes. + * Build Note: Compile-time options may be set at this time using qmake. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes so that it can be corrected for future builds. * PREFIX: Determines the base directory used to install/run Lumina ("/usr/local" by default) Example: `qmake PREFIX=/usr/local` * LIBPREFIX: Determines the location to install the Lumina library ("PREFIX/lib" by default) Example: `qmake LIBPREFIX=/usr/local/lib` * DESTDIR: An optional directory where the compiled files will be placed temporary (such as for packaging/distributing via some other system). Example: `qmake DESTDIR=/my/build/dir` + * DEFAULT_SETTINGS: An optional flag to install the default settings/wallpaper for some other operating system (Note: Make sure the OS name is capitalized appropriately!) + Example: `qmake DEFAULT_SETTINGS=TrueOS` * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the trueos/lumina-i18n repo instead. Example: `qmake CONFIG+=WITH_I18N` - * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (used for performing backtraces on builds that crash or for other development tests) + * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (useful for performing backtraces on builds that crash or for other development tests) Example: `qmake CONFIG+=debug` 4) Run "make" to compile all the Lumina projects (can be done as user) -- cgit From 683d9c73717007b402e53de84d74a3c064b5ae01 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 13:53:24 -0400 Subject: Update the FreeBSD port makefile and pkg-description --- port-files/FreeBSD/Makefile | 18 +++++++++--------- port-files/FreeBSD/pkg-descr | 8 +++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 989a0b8f..5561b613 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -13,14 +13,14 @@ COMMENT= Lumina Desktop Environment LICENSE= BSD3CLAUSE -RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg-minimal \ - fluxbox>=0:${PORTSDIR}/x11-wm/fluxbox \ - kde4-icons-oxygen>=0:${PORTSDIR}/x11-themes/kde4-icons-oxygen \ - xscreensaver:${PORTSDIR}/x11/xscreensaver \ - xbrightness:${PORTSDIR}/x11/xbrightness \ - xcompmgr:$PORTSDIR}/x11-wm/xcompmgr - xrandr:${PORTSDIR}/x11/xrandr \ - numlockx:${PORTSDIR}/x11/numlockx +RUN_DEPENDS= xorg>=0:x11/xorg-minimal \ + fluxbox>=0:x11-wm/fluxbox \ + kde4-icons-oxygen>=0:x11-themes/kde4-icons-oxygen \ + xscreensaver:x11/xscreensaver \ + xbrightness:x11/xbrightness \ + xcompmgr:x11-wm/xcompmgr \ + xrandr:x11/xrandr \ + numlockx:x11/numlockx CONFLICTS= lumina-devel-0* @@ -32,7 +32,7 @@ TRUEOS_DESC= Use the TrueOS system interface settings. .include .if ${PORT_OPTIONS:MMULTIMEDIA} -RUN_DEPENDS+= gstreamer1-plugins-core>=0:${PORTSDIR}/multimedia/gstreamer1-plugins-core +RUN_DEPENDS+= gstreamer1-plugins-core>=0:multimedia/gstreamer1-plugins-core .endif MAKE_JOBS_UNSAFE=yes diff --git a/port-files/FreeBSD/pkg-descr b/port-files/FreeBSD/pkg-descr index 0240a632..59c19f0d 100644 --- a/port-files/FreeBSD/pkg-descr +++ b/port-files/FreeBSD/pkg-descr @@ -1,3 +1,9 @@ -The Lumina Desktop Environment is a lightweight system interface that is designed for use on any Unix-like operating system. It takes a plugin-based approach, allowing the entire interface to be assembled/arranged by each individual user as desired, with a system-wide default layout which can be customized by the system administrator. This allows every system (or user session) to be designed to maximize the individual user's productivity. +The Lumina Desktop Environment is a lightweight system interface that is +designed for use on any Unix-like operating system. It takes a +plugin-based approach, allowing the entire interface to be assembled or +arranged by each individual user as desired, with a system-wide default +layout which can be customized by the system administrator. This allows +every system (or user session) to be designed to maximize the individual +user's productivity. WWW: https://github.com/pcbsd/lumina -- cgit From 01cdeba80820966cec48ee251955da76762dcff3 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 14:06:35 -0400 Subject: Another couple updates to the FreeBSD port files. --- port-files/FreeBSD/pkg-descr | 2 +- port-files/FreeBSD/pkg-message | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 port-files/FreeBSD/pkg-message diff --git a/port-files/FreeBSD/pkg-descr b/port-files/FreeBSD/pkg-descr index 59c19f0d..ce2d052a 100644 --- a/port-files/FreeBSD/pkg-descr +++ b/port-files/FreeBSD/pkg-descr @@ -6,4 +6,4 @@ layout which can be customized by the system administrator. This allows every system (or user session) to be designed to maximize the individual user's productivity. -WWW: https://github.com/pcbsd/lumina +WWW: http://lumina-desktop.org diff --git a/port-files/FreeBSD/pkg-message b/port-files/FreeBSD/pkg-message new file mode 100644 index 00000000..c3742ad9 --- /dev/null +++ b/port-files/FreeBSD/pkg-message @@ -0,0 +1,7 @@ +The Lumina Desktop Environment has been installed! + +An entry for for launching Lumina from a graphical login manager has already been added to the system, but if you with to start Lumina manually, you will need to do one of the following: +1) Run "start-lumina-desktop" directly from the command line after logging in. +2) Put the line "exec start-lumina-desktop" at the end of your user's "~/.xinitrc" file before running startx with any special X11 flags + +Also note that the system-wide default settings for Lumina are contained in ${PREFIX}/etc/luminaDesktop.conf[.dist]. While it is possible to customize the desktop to the user's liking after logging in, you may want to adjust the default settings as necessary if there are multiple user accounts on this system. -- cgit From 06ffd6146b0082f5d2d1124e4b3a65fb19219a68 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 14:07:45 -0400 Subject: Tag version 0.9.1-Release. --- src-qt5/core/libLumina/LuminaUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 72b451ab..55bfdc5a 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -49,7 +49,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ // LUtils Functions //============= QString LUtils::LuminaDesktopVersion(){ - QString ver = "0.9.1-devel"; + QString ver = "0.9.1-Release"; #ifdef GIT_VERSION ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) ); #endif -- cgit From 22b7283ba23b53d7747475f17c90e2f4b982cf60 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 15:03:58 -0400 Subject: Fix the symlink creation routine in lumina-textedit to work with package systems. --- src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro index 9db0db68..cfb4abf3 100644 --- a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro +++ b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro @@ -93,7 +93,7 @@ desktop.files=lumina-textedit.desktop desktop.path=$${L_SHAREDIR}/applications/ link.path=$${L_BINDIR} -link.extra=ln -sf $${L_BINDIR}/lumina-textedit $${L_BINDIR}/lte +link.extra=ln -sf $(INSTALL_ROOT)$${L_BINDIR}/lumina-textedit $(INSTALL_ROOT)$${L_BINDIR}/lte INSTALLS += target desktop link -- cgit From 0e151a7348541025ff4ff8486292257cdf5bf2dc Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 15:06:12 -0400 Subject: Another couple quick fixes for the FreeBSD port files. --- port-files/FreeBSD/Makefile | 6 +++--- port-files/FreeBSD/distinfo | 5 +++-- port-files/FreeBSD/pkg-plist | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 5561b613..85f5234c 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -37,10 +37,10 @@ RUN_DEPENDS+= gstreamer1-plugins-core>=0:multimedia/gstreamer1-plugins-core MAKE_JOBS_UNSAFE=yes -USE_XORG= x11 xdamage -USE_XCB= x11extras wm +USE_XORG= x11 xdamage xcb +USE_XCB= x11extras wm ewmh util-wm USE_LDCONFIG= yes -USE_QT5= core gui network svg multimedia imageformats \ +USE_QT5= core gui widgets network svg multimedia imageformats \ buildtools_build x11extras concurrent USES= desktop-file-utils qmake USE_GITHUB= yes diff --git a/port-files/FreeBSD/distinfo b/port-files/FreeBSD/distinfo index aaefc4dd..9570700a 100644 --- a/port-files/FreeBSD/distinfo +++ b/port-files/FreeBSD/distinfo @@ -1,2 +1,3 @@ -SHA256 (lumina-0.8.4.tar.bz2) = 5fdfbb6b75d86d3cb68dce0453d4675dd7e24312de445e188d5a988512ee9bd3 -SIZE (lumina-0.8.4.tar.bz2) = 23262377 +TIMESTAMP = 1467137694 +SHA256 (trueos-lumina-v0.9.1-Release_GH0.tar.gz) = f62d033b585d46815089a3dce5703c626af23c50db1281a3f1c662fc39cf6006 +SIZE (trueos-lumina-v0.9.1-Release_GH0.tar.gz) = 54665105 diff --git a/port-files/FreeBSD/pkg-plist b/port-files/FreeBSD/pkg-plist index 715e6dc8..fe6ce23e 100644 --- a/port-files/FreeBSD/pkg-plist +++ b/port-files/FreeBSD/pkg-plist @@ -33,7 +33,6 @@ share/pixmaps/Lumina-DE.png share/pixmaps/Insight-FileManager.png share/xsessions/Lumina-DE.desktop share/lumina-desktop/desktop-background.jpg -share/lumina-desktop/defaultapps.conf share/lumina-desktop/luminaDesktop.conf share/lumina-desktop/fluxbox-init-rc share/lumina-desktop/fluxbox-keys -- cgit From 57ad00240412d2c217d13797d2df3f54f1e1a765 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 28 Jun 2016 15:47:47 -0400 Subject: Tag version 1.0.0-Devel on the source tree (master branch) --- src-qt5/core/libLumina/LuminaUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 55bfdc5a..bf90161d 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -49,7 +49,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ // LUtils Functions //============= QString LUtils::LuminaDesktopVersion(){ - QString ver = "0.9.1-Release"; + QString ver = "1.0.0-Devel"; #ifdef GIT_VERSION ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) ); #endif -- cgit From f87756b90a21841200513dfc4db4bfac86b03f82 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 12:25:51 -0400 Subject: Add Control+[shift]+Tab shortcuts for cycling between open windows in grouped-order rather than open order (alt+[shift]+tab will do open order). --- src-qt5/core/lumina-desktop/fluxboxconf/fluxbox-keys | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src-qt5/core/lumina-desktop/fluxboxconf/fluxbox-keys b/src-qt5/core/lumina-desktop/fluxboxconf/fluxbox-keys index 21027f4c..c3bafdaf 100644 --- a/src-qt5/core/lumina-desktop/fluxboxconf/fluxbox-keys +++ b/src-qt5/core/lumina-desktop/fluxboxconf/fluxbox-keys @@ -47,8 +47,10 @@ OnTitlebar Mouse2 :Lower OnTitlebar Mouse3 :WindowMenu # alt-tab -Mod1 Tab :NextWindow {groups} (workspace=[current]) (workspace=[current]) !! FBCV13 !! -Mod1 Shift Tab :PrevWindow {groups} (workspace=[current]) (workspace=[current]) !! FBCV13 !! +Mod1 Tab :NextWindow (workspace=[current]) (workspace=[current]) !! FBCV13 !! +Mod1 Shift Tab :PrevWindow (workspace=[current]) (workspace=[current]) !! FBCV13 !! +Control Tab :NextGroup (workspace=[current]) (workspace=[current]) +Control Shift Tab :PrevGroup (workspace=[current]) (workspace=[current]) # cycle through tabs in the current window Mod4 Tab :NextTab -- cgit From b793fe62c44bf2ddfa54222f353b0a9e587af187 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 13:00:34 -0400 Subject: Fix up the resizeMenu's mouse event handling to ensure it keeps control of the mouse during resize events. --- src-qt5/core/libLumina/LuminaUtils.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 55bfdc5a..f7012d48 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -1008,30 +1008,35 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){ // since the window will be moved again the next time it is shown // The "-2" in the sizing below accounts for the menu margins QPoint gpos = this->mapToGlobal(ev->pos()); + bool handled = false; switch(resizeSide){ case TOP: if(gpos.y() >= geom.bottom()-1){ break; } geom.setTop(gpos.y()); this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } + if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} + handled = true; break; case BOTTOM: if(gpos.y() <= geom.top()+1){ break; } geom.setBottom( gpos.y()); this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } + if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} + handled = true; break; case LEFT: if(gpos.x() >= geom.right()-1){ break; } geom.setLeft(gpos.x()); this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } + if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} + handled = true; break; case RIGHT: if(gpos.x() <= geom.left()+1){ break; } geom.setRight(gpos.x()); this->setGeometry(geom); - if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } + if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));} + handled = true; break; default: //NONE //qDebug() << " - Mouse At:" << ev->pos(); @@ -1042,7 +1047,7 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){ else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ this->setCursor(Qt::SizeVerCursor); } else{ this->setCursor(Qt::ArrowCursor); } } - QMenu::mouseMoveEvent(ev); //do normal processing as well + if(!handled){ QMenu::mouseMoveEvent(ev); } //do normal processing as well } void ResizeMenu::mousePressEvent(QMouseEvent *ev){ @@ -1054,11 +1059,12 @@ void ResizeMenu::mousePressEvent(QMouseEvent *ev){ else if(ev->pos().y()<=1 && ev->pos().y() >= -1){ resizeSide = TOP; used = true; } else if(ev->pos().y() >= this->height()-1 && ev->pos().y() <= this->height()+1){ resizeSide = BOTTOM; used = true; } } - if(used){ ev->accept(); } + if(used){ ev->accept(); this->grabMouse(); } else{ QMenu::mousePressEvent(ev); } //do normal processing } void ResizeMenu::mouseReleaseEvent(QMouseEvent *ev){ + this->releaseMouse(); if(ev->button() == Qt::LeftButton && resizeSide!=NONE ){ //qDebug() << "Mouse Release Event:" << ev->pos() << resizeSide; resizeSide = NONE; -- cgit From ec1e0ce441081627b53733cdf0981af13c25bbc1 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 14:29:00 -0400 Subject: Add options for grouped windows in the task manager: Show All Windows Minimize All Windows Close All Windows --- .../panel-plugins/taskmanager/LTaskButton.cpp | 29 ++++++++++++++++++++++ .../panel-plugins/taskmanager/LTaskButton.h | 3 +++ 2 files changed, 32 insertions(+) diff --git a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp index 7e2e53de..0dd68bb0 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp @@ -157,6 +157,12 @@ void LTaskButton::UpdateMenus(){ } } actMenu->addAction( LXDG::findIcon("window-close",""), tr("Close Window"), this, SLOT(closeWindow()) ); + if(WINLIST.length()>1 && !winMenu->isVisible()){ + actMenu->addSeparator(); + actMenu->addAction( LXDG::findIcon("layer-visible-on",""), tr("Show All Windows"), this, SLOT(showAllWindows()) ); + actMenu->addAction( LXDG::findIcon("layer-visible-off",""), tr("Minimize All Windows"), this, SLOT(hideAllWindows()) ); + actMenu->addAction( LXDG::findIcon("window-close",""), tr("Close All Windows"), this, SLOT(closeAllWindows()) ); + } } //============= @@ -196,6 +202,29 @@ void LTaskButton::minimizeWindow(){ QTimer::singleShot(100, this, SLOT(UpdateButton()) ); //make sure to update this button if losing active status } +void LTaskButton::showAllWindows(){ + for(int i=WINLIST.length()-1; i>=0; i--){ + if(WINLIST[i].status()==LXCB::INVISIBLE){ + LSession::handle()->XCB->RestoreWindow(WINLIST[i].windowID()); + } + } +} + +void LTaskButton::hideAllWindows(){ + for(int i=WINLIST.length()-1; i>=0; i--){ + LXCB::WINDOWVISIBILITY state = WINLIST[i].status(); + if(state==LXCB::VISIBLE || state==LXCB::ACTIVE){ + LSession::handle()->XCB->MinimizeWindow(WINLIST[i].windowID()); + } + } +} + +void LTaskButton::closeAllWindows(){ + for(int i=WINLIST.length()-1; i>=0; i--){ + LSession::handle()->XCB->CloseWindow(WINLIST[i].windowID()); + } +} + void LTaskButton::triggerWindow(){ LWinInfo win = currentWindow(); //Check which state the window is currently in and flip it to the other diff --git a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h index 43dbaa90..6b171c6a 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/taskmanager/LTaskButton.h @@ -60,6 +60,9 @@ private slots: void closeWindow(); //send the signal to close a window void maximizeWindow(); //send the signal to maximize/restore a window void minimizeWindow(); //send the signal to minimize a window (iconify) + void showAllWindows(); + void hideAllWindows(); + void closeAllWindows(); void triggerWindow(); //change b/w visible and invisible void winClicked(QAction*); void openActionMenu(); -- cgit From 6ec840b3be14017f186b0c38e99c913d9e8c82a5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 15:40:34 -0400 Subject: A minor tweak to the "Glass" theme. --- src-qt5/core/libLumina/themes/Glass.qss.template | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src-qt5/core/libLumina/themes/Glass.qss.template b/src-qt5/core/libLumina/themes/Glass.qss.template index f3c25ec4..827d8de4 100644 --- a/src-qt5/core/libLumina/themes/Glass.qss.template +++ b/src-qt5/core/libLumina/themes/Glass.qss.template @@ -473,6 +473,10 @@ QWidget#LuminaBootSplash{ border-radius: 5px; } +LDPlugin#applauncher{ + background-color: transparent; + border: none; +} LDPlugin#applauncher QToolButton, LDPlugin, LDPlugin#desktopview QListWidget::item{ background-color: qradialgradient(spread:reflect, cx:0.113757, cy:0.875, radius:0.7, fx:0.045, fy:0.954545, stop:0 rgba(234, 236, 243, 30), stop:1 rgba(229, 229, 229, 70)); border-width: 3px; -- cgit From 1fc459836734c564aec5e92f9f4adaa29aa8178f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 17:28:54 -0400 Subject: Add a new type of menu plugin: jsonmenu This is a recursive, auto-generating menu which runs an external utility (a script of some kind usually), which generates a JSON document/object which is used to populate the menu. Syntax: (Per object) { "type" : "item", "icon" : "icon name (optional)", "action" : "something lumina-open can run (optional)" } Or for a recursive menu generation { "type" : "jsonmenu", "exec" : "some command to run to populate menu", "icon" : "icon name (optional)" } Example for a full return: { "Item1" : { "type" : "item", "icon" : "folder", "action" : "~/item1.jpg" }, "Menu1" : { "type" : "jsonmenu", "exec" : "some script", "icon" : "system-run" } } Item1 will open ~/item1.jpg with lumina-open when clicked, while Menu1 will call "some script" to generate a new menu with additional options. } --- src-qt5/core/lumina-desktop/JsonMenu.h | 68 ++++++++++++++++++++++++++ src-qt5/core/lumina-desktop/LDesktop.cpp | 12 +++++ src-qt5/core/lumina-desktop/lumina-desktop.pro | 3 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src-qt5/core/lumina-desktop/JsonMenu.h diff --git a/src-qt5/core/lumina-desktop/JsonMenu.h b/src-qt5/core/lumina-desktop/JsonMenu.h new file mode 100644 index 00000000..fbb80d28 --- /dev/null +++ b/src-qt5/core/lumina-desktop/JsonMenu.h @@ -0,0 +1,68 @@ +//=========================================== +// Lumina Desktop source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This menu is used to automatically generate menu contents +// based on the JSON output of an external script/utility +//=========================================== +#ifndef _LUMINA_DESKTOP_JSON_MENU_H +#define _LUMINA_DESKTOP_JSON_MENU_H + +#include +#include +#include +#include +#include + +#include +#include + +class JsonMenu : public QMenu{ + Q_OBJECT +private: + QString exec; + +public: + JsonMenu(QString execpath, QWidget *parent = 0) : QMenu(parent){ + exec = execpath; + connect(this, SIGNAL(aboutToShow()), this, SLOT(updateMenu()) ); + } + +private slots: + void parseObject(QString label, QJsonObject obj){ + if( label.isEmpty() || !obj.contains("type") ){ return; } + QString type = obj.value("type").toString(); + if(type.toLower()=="item"){ + QAction *act = this->addAction(label); + if(obj.contains("icon")){ act->setIcon( LXDG::findIcon(obj.value("icon").toString(),"") ); } + if(obj.contains("action")){ act->setWhatsThis( obj.value("action").toString() ); } + else{ act->setEnabled(false); } //not interactive + }else if(type.toLower()=="menu"){ + + }else if(type.toLower()=="jsonmenu"){ + //This is a recursive JSON menu object + if(!obj.contains("exec")){ return; } + JsonMenu *menu = new JsonMenu(obj.value("exec").toString(), this); + menu->setTitle(label); + if(obj.contains("icon")){ menu->setIcon(LXDG::findIcon(obj.value("icon").toString(),"") ); } + this->addMenu(menu); + } + } + void updateMenu(){ + this->clear(); + QJsonDocument doc = QJsonDocument::fromJson( LUtils::getCmdOutput(exec).join(" ").toLocal8Bit() ); + if(doc.isNull() || !doc.isObject()){ + this->addAction( QString(tr("Error parsing script output: %1")).arg("\n"+exec) )->setEnabled(false); + }else{ + QStringList keys = doc.object().keys(); + for(int i=0; i #include #include "LWinInfo.h" +#include "JsonMenu.h" #define DEBUG 0 @@ -291,6 +292,17 @@ void LDesktop::UpdateMenu(bool fast){ }else{ qDebug() << "Could not load application file:" << file; } + }else if(items[i].startsWith("jsonmenu::::")){ + //Custom JSON menu system (populated on demand via external scripts/tools + QStringList info = items[i].split("::::"); //FORMAT:[ "jsonmenu",exec,name, icon(optional)] + if(info.length()>=3){ + qDebug() << "Custom JSON Menu Loaded:" << info; + JsonMenu *tmp = new JsonMenu(info[1], deskMenu); + tmp->setTitle(info[2]); + connect(tmp, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) ); + if(info.length()>=4){ tmp->setIcon( LXDG::findIcon(info[3],"") ); } + deskMenu->addMenu(tmp); + } } } //Now add the system quit options diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 4cebf3de..7b0e5250 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -27,7 +27,7 @@ SOURCES += main.cpp \ SettingsMenu.cpp \ SystemWindow.cpp \ BootSplash.cpp \ - desktop-plugins/LDPlugin.cpp \ + desktop-plugins/LDPlugin.cpp HEADERS += Globals.h \ @@ -48,6 +48,7 @@ HEADERS += Globals.h \ panel-plugins/LTBWidget.h \ desktop-plugins/LDPlugin.h \ desktop-plugins/NewDP.h \ + JsonMenu.h FORMS += SystemWindow.ui \ BootSplash.ui -- cgit From db536f42f30514112944892f209520a2ac5a65c2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 29 Jun 2016 17:38:14 -0400 Subject: Create a directory for placing sample JSON menu generation scripts, and add one (incomplete yet) for listing the contents of the current directory (home dir ususally) --- JsonMenu_Scripts/ls.json.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 JsonMenu_Scripts/ls.json.sh diff --git a/JsonMenu_Scripts/ls.json.sh b/JsonMenu_Scripts/ls.json.sh new file mode 100755 index 00000000..9a6ab847 --- /dev/null +++ b/JsonMenu_Scripts/ls.json.sh @@ -0,0 +1,10 @@ +#!/bin/sh +cmd="ls $1" +OUT="" +for name in `${cmd}`; do + if [ "${OUT}" != "" ] ; then + OUT="${OUT}," + fi + OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"action\" : \"${name}\"}" +done +echo "{ ${OUT} }" -- cgit From 08f6b215cdaa43cb27d1a46343fbaf1a43031017 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 09:24:59 -0400 Subject: Update the new ls.json.sh script so ti works properly now. --- JsonMenu_Scripts/ls.json.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/JsonMenu_Scripts/ls.json.sh b/JsonMenu_Scripts/ls.json.sh index 9a6ab847..7bd09e2d 100755 --- a/JsonMenu_Scripts/ls.json.sh +++ b/JsonMenu_Scripts/ls.json.sh @@ -1,10 +1,20 @@ #!/bin/sh -cmd="ls $1" -OUT="" -for name in `${cmd}`; do - if [ "${OUT}" != "" ] ; then +DIR=${1} +if [ "$1" == "" ] ; then + DIR=`pwd` +fi + +ls ${DIR} > /tmp/.tmp.lines.$$ +while read name +do + if [ -n "${OUT}" ] ; then OUT="${OUT}," fi - OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"action\" : \"${name}\"}" -done + if [ -d "${DIR}/${name}" ] ; then + OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} ${DIR}/${name}\", \"icon\":\"folder\"}" + else + OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"${name}\"}" + fi +done < /tmp/.tmp.lines.$$ +rm /tmp/.tmp.lines.$$ echo "{ ${OUT} }" -- cgit From 88fbc7674f712df3ce09e1e8f29b5387fda412c5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 09:27:21 -0400 Subject: Fix the symlink creation routine so it works properly if INSTALL_ROOT is setup. --- src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro index cfb4abf3..2d0ea525 100644 --- a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro +++ b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro @@ -93,7 +93,7 @@ desktop.files=lumina-textedit.desktop desktop.path=$${L_SHAREDIR}/applications/ link.path=$${L_BINDIR} -link.extra=ln -sf $(INSTALL_ROOT)$${L_BINDIR}/lumina-textedit $(INSTALL_ROOT)$${L_BINDIR}/lte +link.extra=ln -sf $${L_BINDIR}/lumina-textedit $(INSTALL_ROOT)$${L_BINDIR}/lte INSTALLS += target desktop link -- cgit From 702d651bad7892126fdf82499f25e6e418499366 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 09:39:01 -0400 Subject: Finish up the new JSON recursive menu system as well as the test script for listing the contents of a directory recursively. --- JsonMenu_Scripts/ls.json.sh | 2 +- src-qt5/core/lumina-desktop/JsonMenu.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/JsonMenu_Scripts/ls.json.sh b/JsonMenu_Scripts/ls.json.sh index 7bd09e2d..5b4680ed 100755 --- a/JsonMenu_Scripts/ls.json.sh +++ b/JsonMenu_Scripts/ls.json.sh @@ -13,7 +13,7 @@ do if [ -d "${DIR}/${name}" ] ; then OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} ${DIR}/${name}\", \"icon\":\"folder\"}" else - OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"${name}\"}" + OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"xdg-open ${DIR}/${name}\"}" fi done < /tmp/.tmp.lines.$$ rm /tmp/.tmp.lines.$$ diff --git a/src-qt5/core/lumina-desktop/JsonMenu.h b/src-qt5/core/lumina-desktop/JsonMenu.h index fbb80d28..87377a73 100644 --- a/src-qt5/core/lumina-desktop/JsonMenu.h +++ b/src-qt5/core/lumina-desktop/JsonMenu.h @@ -18,6 +18,7 @@ #include #include +#include "LSession.h" class JsonMenu : public QMenu{ Q_OBJECT @@ -28,6 +29,7 @@ public: JsonMenu(QString execpath, QWidget *parent = 0) : QMenu(parent){ exec = execpath; connect(this, SIGNAL(aboutToShow()), this, SLOT(updateMenu()) ); + connect(this, SIGNAL(triggered(QAction*)), this, SLOT(itemTriggered(QAction*)) ); } private slots: @@ -50,6 +52,7 @@ private slots: this->addMenu(menu); } } + void updateMenu(){ this->clear(); QJsonDocument doc = QJsonDocument::fromJson( LUtils::getCmdOutput(exec).join(" ").toLocal8Bit() ); @@ -64,5 +67,13 @@ private slots: } } } + + void itemTriggered(QAction *act){ + if(act->parent()!=this || act->whatsThis().isEmpty() ){ return; } //only handle direct child actions - needed for recursive nature of menu + QString cmd = act->whatsThis(); + QString bin = cmd.section(" ",0,0); + if( !LUtils::isValidBinary(bin) ){ cmd.prepend("lumina-open "); } + LSession::handle()->LaunchApplication(cmd); + } }; #endif -- cgit From c1651e696d153428fe94b19e3550f8c3828a9852 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 09:53:05 -0400 Subject: Fix some whitespace issues with the ls.json.sh script. --- JsonMenu_Scripts/ls.json.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/JsonMenu_Scripts/ls.json.sh b/JsonMenu_Scripts/ls.json.sh index 5b4680ed..626912cb 100755 --- a/JsonMenu_Scripts/ls.json.sh +++ b/JsonMenu_Scripts/ls.json.sh @@ -4,16 +4,16 @@ if [ "$1" == "" ] ; then DIR=`pwd` fi -ls ${DIR} > /tmp/.tmp.lines.$$ +ls "${DIR}" > /tmp/.tmp.lines.$$ while read name do if [ -n "${OUT}" ] ; then OUT="${OUT}," fi if [ -d "${DIR}/${name}" ] ; then - OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} ${DIR}/${name}\", \"icon\":\"folder\"}" + OUT="${OUT} \"${name}\" : { \"type\" : \"jsonmenu\", \"exec\" : \"${0} \\\"${DIR}/${name}\\\"\", \"icon\":\"folder\"}" else - OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"xdg-open ${DIR}/${name}\"}" + OUT="${OUT} \"${name}\" : { \"type\" : \"item\", \"icon\":\"unknown\", \"action\" : \"xdg-open \\\"${DIR}/${name}\\\"\"}" fi done < /tmp/.tmp.lines.$$ rm /tmp/.tmp.lines.$$ -- cgit From 70a35d68f5db7abd57210bc289a334df8dbc1dd2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 15:05:54 -0400 Subject: Add the new jsonmenu menu plugin to lumina-config, with a new dialog for setting it up. --- src-qt5/core-utils/lumina-config/AppDialog.h | 6 +- src-qt5/core-utils/lumina-config/ColorDialog.cpp | 9 +- .../core-utils/lumina-config/GetPluginDialog.cpp | 10 +- src-qt5/core-utils/lumina-config/LPlugins.cpp | 10 ++ src-qt5/core-utils/lumina-config/ScriptDialog.cpp | 90 +++++++++++++ src-qt5/core-utils/lumina-config/ScriptDialog.h | 41 ++++++ src-qt5/core-utils/lumina-config/ScriptDialog.ui | 143 +++++++++++++++++++++ src-qt5/core-utils/lumina-config/lumina-config.pro | 3 + .../lumina-config/pages/page_interface_menu.cpp | 25 +++- 9 files changed, 327 insertions(+), 10 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/ScriptDialog.cpp create mode 100644 src-qt5/core-utils/lumina-config/ScriptDialog.h create mode 100644 src-qt5/core-utils/lumina-config/ScriptDialog.ui diff --git a/src-qt5/core-utils/lumina-config/AppDialog.h b/src-qt5/core-utils/lumina-config/AppDialog.h index 8c35d9b7..392dbe4d 100644 --- a/src-qt5/core-utils/lumina-config/AppDialog.h +++ b/src-qt5/core-utils/lumina-config/AppDialog.h @@ -4,7 +4,7 @@ // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== -// This is the dialog for catching keyboard events and converting them to X11 keycodes +// This is the dialog for selecting an installed application //=========================================== #ifndef _LUMINA_FILE_MANAGER_APP_SELECT_DIALOG_H #define _LUMINA_FILE_MANAGER_APP_SELECT_DIALOG_H @@ -40,7 +40,9 @@ public: } this->setWindowIcon( LXDG::findIcon("system-search","") ); if(parent!=0){ - QPoint center = parent->geometry().center(); + QWidget *top = parent; + while(!top->isWindow()){ top = top->parentWidget(); } + QPoint center = top->geometry().center(); this->move(center.x()-(this->width()/2), center.y()-(this->height()/2) ); } } diff --git a/src-qt5/core-utils/lumina-config/ColorDialog.cpp b/src-qt5/core-utils/lumina-config/ColorDialog.cpp index f984cf0d..860f6069 100644 --- a/src-qt5/core-utils/lumina-config/ColorDialog.cpp +++ b/src-qt5/core-utils/lumina-config/ColorDialog.cpp @@ -27,8 +27,12 @@ ColorDialog::ColorDialog(QWidget *parent, LPlugins *plugs, QString colorFilePath //Now load the given file loadColors(); //Now center the window on the parent - QPoint cen = parent->geometry().center(); - this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) ); +if(parent!=0){ + QWidget *top = parent; + while(!top->isWindow()){ top = top->parentWidget(); } + QPoint center = top->geometry().center(); + this->move(center.x()-(this->width()/2), center.y()-(this->height()/2) ); + } } void ColorDialog::loadColors(){ @@ -139,4 +143,3 @@ void ColorDialog::on_tool_editcolor_clicked(){ if(!ok || value.isEmpty()){ return; } //cancelled updateItem(it, value); } - diff --git a/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp b/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp index 08359e2d..51ff718a 100644 --- a/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp +++ b/src-qt5/core-utils/lumina-config/GetPluginDialog.cpp @@ -13,8 +13,12 @@ GetPluginDialog::GetPluginDialog(QWidget *parent) : QDialog(parent), ui(new Ui:: ui->setupUi(this); selected = false; //nothing selected by default //Now center the window on the parent - QPoint cen = parent->geometry().center(); - this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) ); + if(parent!=0){ + QWidget *top = parent; + while(!top->isWindow()){ top = top->parentWidget(); } + QPoint center = top->geometry().center(); + this->move(center.x()-(this->width()/2), center.y()-(this->height()/2) ); + } //Load the icons ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") ); ui->push_accept->setIcon( LXDG::findIcon("dialog-ok","") ); @@ -74,4 +78,4 @@ void GetPluginDialog::accept(){ plugID = ui->combo_list->currentData().toString().section("::::",1,1); selected = true; this->close(); -} \ No newline at end of file +} diff --git a/src-qt5/core-utils/lumina-config/LPlugins.cpp b/src-qt5/core-utils/lumina-config/LPlugins.cpp index 03490216..cf0c11ac 100644 --- a/src-qt5/core-utils/lumina-config/LPlugins.cpp +++ b/src-qt5/core-utils/lumina-config/LPlugins.cpp @@ -58,6 +58,7 @@ LPI LPlugins::colorInfo(QString item){ //=================== // PLUGINS //=================== +// PANEL PLUGINS void LPlugins::LoadPanelPlugins(){ PANEL.clear(); //User Button @@ -167,6 +168,7 @@ void LPlugins::LoadPanelPlugins(){ PANEL.insert(info.ID, info); } +// DESKTOP PLUGINS void LPlugins::LoadDesktopPlugins(){ DESKTOP.clear(); //Calendar Plugin @@ -232,6 +234,7 @@ void LPlugins::LoadDesktopPlugins(){ }*/ } +// MENU PLUGINS void LPlugins::LoadMenuPlugins(){ MENU.clear(); //Terminal @@ -283,6 +286,13 @@ void LPlugins::LoadMenuPlugins(){ info.ID = "app"; info.icon = "application-x-desktop"; MENU.insert(info.ID, info); + //Custom Apps + info = LPI(); //clear it + info.name = QObject::tr("Menu Script"); + info.description = QObject::tr("Run an external script to generate a menu"); + info.ID = "jsonmenu"; + info.icon = "text-x-script"; + MENU.insert(info.ID, info); } void LPlugins::LoadColorItems(){ diff --git a/src-qt5/core-utils/lumina-config/ScriptDialog.cpp b/src-qt5/core-utils/lumina-config/ScriptDialog.cpp new file mode 100644 index 00000000..3453486e --- /dev/null +++ b/src-qt5/core-utils/lumina-config/ScriptDialog.cpp @@ -0,0 +1,90 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "ScriptDialog.h" +#include "ui_ScriptDialog.h" + +//=========== +// PUBLIC +//=========== +ScriptDialog::ScriptDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ScriptDialog){ + ui->setupUi(this); + ok = false; + connect(ui->line_name, SIGNAL(textEdited(QString)), this, SLOT(checkItems()) ); + connect(ui->line_exec, SIGNAL(textEdited(QString)), this, SLOT(checkItems()) ); + connect(ui->line_icon, SIGNAL(textEdited(QString)), this, SLOT(checkItems()) ); + checkItems(true); +} + +ScriptDialog::~ScriptDialog(){ + +} + +//Main interaction functions +bool ScriptDialog::isValid(){ + return ok; +} + +QString ScriptDialog::icon(){ + return ui->line_icon->text(); +} + +QString ScriptDialog::name(){ + return ui->line_name->text(); +} + +QString ScriptDialog::command(){ + return ui->line_exec->text(); +} + +//============== +// PRIVATE SLOTS +//============== +void ScriptDialog::on_pushApply_clicked(){ + ok = true; + this->close(); +} + +void ScriptDialog::on_pushCancel_clicked(){ + ok = false; + this->close(); +} + +void ScriptDialog::on_tool_getexec_clicked(){ + QString file = QFileDialog::getOpenFileName( this, tr("Select a menu script"), QDir::homePath() ); + if(file.isEmpty()){ return; } //cancelled + ui->line_exec->setText(file); + checkItems(); +} + +void ScriptDialog::on_tool_geticon_clicked(){ + QString file = QFileDialog::getOpenFileName( this, tr("Select an icon file"), QDir::homePath() ); + if(file.isEmpty()){ return; } //cancelled + ui->line_icon->setText(file); + checkItems(); +} + +void ScriptDialog::checkItems(bool firstrun){ + if(firstrun){ + ui->line_name->setFocus(); + ui->label_sample->setPixmap( LXDG::findIcon("text-x-script","").pixmap(32,32) ); + ui->tool_geticon->setIcon( LXDG::findIcon("system-search","") ); + ui->tool_getexec->setIcon( LXDG::findIcon("system-search","") ); + } + //Update the icon sample if needed + if(icon()!=ui->label_sample->whatsThis()){ + ui->label_sample->setPixmap( LXDG::findIcon(icon(),"text-x-script").pixmap(32,32) ); + ui->label_sample->setWhatsThis(icon()); + } + bool good = true; + if(name().isEmpty()){ good = false; ui->line_name->setStyleSheet("color: red;"); } + else{ ui->line_name->setStyleSheet(""); } + QString cmd = command().section(" ",0,0).simplified(); + if( !LUtils::isValidBinary(cmd) || cmd.isEmpty() ){ good = false; ui->line_exec->setStyleSheet("color: red;"); } + else{ ui->line_exec->setStyleSheet(""); } + + ui->pushApply->setEnabled(good); +} diff --git a/src-qt5/core-utils/lumina-config/ScriptDialog.h b/src-qt5/core-utils/lumina-config/ScriptDialog.h new file mode 100644 index 00000000..07ac15d4 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/ScriptDialog.h @@ -0,0 +1,41 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This is the dialog for selecting an installed application +//=========================================== +#ifndef _LUMINA_FILE_MANAGER_SCRIPT_SELECT_DIALOG_H +#define _LUMINA_FILE_MANAGER_SCRIPT_SELECT_DIALOG_H + +#include "globals.h" + +namespace Ui{ + class ScriptDialog; +}; + +class ScriptDialog : public QDialog{ + Q_OBJECT +public: + ScriptDialog(QWidget *parent = 0); + ~ScriptDialog(); + + //Main interaction functions + bool isValid(); + QString icon(); + QString name(); + QString command(); + +private: + Ui::ScriptDialog *ui; + bool ok; + +private slots: + void on_pushApply_clicked(); + void on_pushCancel_clicked(); + void on_tool_getexec_clicked(); + void on_tool_geticon_clicked(); + void checkItems(bool firstrun = false); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/ScriptDialog.ui b/src-qt5/core-utils/lumina-config/ScriptDialog.ui new file mode 100644 index 00000000..a675f2bf --- /dev/null +++ b/src-qt5/core-utils/lumina-config/ScriptDialog.ui @@ -0,0 +1,143 @@ + + + ScriptDialog + + + + 0 + 0 + 404 + 168 + + + + Setup a JSON Menu Script + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + Visible Name: + + + + + + + Executable: + + + + + + + Icon: + + + + + + + + + + + + + + + ... + + + + + + + + + + + + 0 + 0 + + + + + 32 + 32 + + + + + + + + + + + + + + ... + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + Apply + + + + + + + + + + diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index 2e950fe1..5d6e8db9 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -16,6 +16,7 @@ SOURCES += main.cpp \ ColorDialog.cpp \ ThemeDialog.cpp \ GetPluginDialog.cpp \ + ScriptDialog.cpp \ PanelWidget.cpp HEADERS += mainWindow.h \ @@ -24,6 +25,7 @@ HEADERS += mainWindow.h \ ColorDialog.h \ ThemeDialog.h \ GetPluginDialog.h \ + ScriptDialog.h \ PanelWidget.h FORMS += mainWindow.ui \ @@ -31,6 +33,7 @@ FORMS += mainWindow.ui \ ColorDialog.ui \ ThemeDialog.ui \ GetPluginDialog.ui \ + ScriptDialog.ui \ PanelWidget.ui include("pages/pages.pri") diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp index 742c5728..d211d380 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp @@ -9,7 +9,7 @@ #include "getPage.h" #include "../AppDialog.h" #include "../GetPluginDialog.h" - +#include "../ScriptDialog.h" //========== // PUBLIC //========== @@ -52,7 +52,6 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList //qDebug() << "Menu Items:" << items; ui->list_menu->clear(); for(int i=0; imenuPluginInfo(items[i]); if(items[i].startsWith("app::::")){ bool ok = false; XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); @@ -64,7 +63,20 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList item->setToolTip( desk.comment ); ui->list_menu->addItem(item); continue; //now go to the next item + }else if(items[i].startsWith("jsonmenu::::")){ + LPI info = PINFO->menuPluginInfo( items[i].section("::::",0,0) ); + if(info.ID.isEmpty()){ continue; } //invalid plugin type (no longer available?) + QString exec = items[i].section("::::",1,1); + + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( items[i] ); + item->setIcon( LXDG::findIcon(items[i].section("::::",3,3),info.icon) ); + item->setText( items[i].section("::::",2,2) +" ("+info.name+")" ); + item->setToolTip( info.description ); + ui->list_menu->addItem(item); + continue; //now go to the next item } + LPI info = PINFO->menuPluginInfo(items[i]); if(info.ID.isEmpty()){ continue; } //invalid plugin //qDebug() << "Add Menu Item:" << info.ID; QListWidgetItem *item = new QListWidgetItem(); @@ -121,6 +133,15 @@ void page_interface_menu::addmenuplugin(){ it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(info.ID+"::::"+desk.filePath); it->setToolTip( desk.comment ); + }else if(info.ID=="jsonmenu"){ + //Need to prompt for the script file, name, and icon to use + //new ID format: "jsonmenu":::::::::::: + ScriptDialog SD(this); + SD.exec(); + if(!SD.isValid()){ return; } + it = new QListWidgetItem( LXDG::findIcon(SD.icon(),"text-x-script"), SD.name()+" ("+info.ID+")" ); + it->setWhatsThis(info.ID+"::::"+SD.command()+"::::"+SD.name()+"::::"+SD.icon()); + it->setToolTip( info.description ); }else{ it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); it->setWhatsThis(info.ID); -- cgit From 19194a73cc3619e72552713dc0c667f2fdbafcce Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 15:16:46 -0400 Subject: Fix the check routine in the new script finder dialog. --- src-qt5/core-utils/lumina-config/ScriptDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core-utils/lumina-config/ScriptDialog.cpp b/src-qt5/core-utils/lumina-config/ScriptDialog.cpp index 3453486e..2980a3e9 100644 --- a/src-qt5/core-utils/lumina-config/ScriptDialog.cpp +++ b/src-qt5/core-utils/lumina-config/ScriptDialog.cpp @@ -83,7 +83,7 @@ void ScriptDialog::checkItems(bool firstrun){ if(name().isEmpty()){ good = false; ui->line_name->setStyleSheet("color: red;"); } else{ ui->line_name->setStyleSheet(""); } QString cmd = command().section(" ",0,0).simplified(); - if( !LUtils::isValidBinary(cmd) || cmd.isEmpty() ){ good = false; ui->line_exec->setStyleSheet("color: red;"); } + if( cmd.isEmpty() || !LUtils::isValidBinary(cmd) ){ good = false; ui->line_exec->setStyleSheet("color: red;"); } else{ ui->line_exec->setStyleSheet(""); } ui->pushApply->setEnabled(good); -- cgit From 3f2d4bb80db5c04bfd4c47696049f7ba7233a6f7 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 15:36:44 -0400 Subject: Ensure that the quick command run routine will never hang the system for more than 1 second of inactivity from the subprocess. --- src-qt5/core/libLumina/LuminaUtils.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 1d0e186c..76d61f8d 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -34,15 +34,19 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ proc.setProcessEnvironment(env); proc.setProcessChannelMode(QProcess::MergedChannels); if(args.isEmpty()){ - proc.start(cmd); + proc.start(cmd, QIODevice::ReadOnly); }else{ - proc.start(cmd,args); + proc.start(cmd,args ,QIODevice::ReadOnly); } - while(!proc.waitForFinished(500)){ + QString info; + while(!proc.waitForFinished(1000)){ if(proc.state() == QProcess::NotRunning){ break; } //somehow missed the finished signal + QString tmp = proc.readAllStandardOutput(); + if(tmp.isEmpty()){ proc.terminate(); } + else{ info.append(tmp); } } out[0] = QString::number(proc.exitCode()); - out[1] = QString(proc.readAllStandardOutput()); + out[1] = info+QString(proc.readAllStandardOutput()); return out; } //============= -- cgit