diff options
-rwxr-xr-x | debian/rules | 18 | ||||
-rw-r--r-- | global.h | 10 | ||||
-rw-r--r-- | libLumina/LuminaOS-Linux.cpp | 10 | ||||
-rw-r--r-- | libLumina/libLumina.pro | 20 | ||||
-rw-r--r-- | lumina-config/lumina-config.pro | 11 | ||||
-rw-r--r-- | lumina-config/main.cpp | 9 | ||||
-rw-r--r-- | lumina-config/mainUI.cpp | 132 | ||||
-rw-r--r-- | lumina-config/mainUI.h | 23 | ||||
-rw-r--r-- | lumina-desktop/AppMenu.cpp | 11 | ||||
-rw-r--r-- | lumina-desktop/Globals.h | 15 | ||||
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 43 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 31 | ||||
-rw-r--r-- | lumina-desktop/SystemWindow.cpp | 5 | ||||
-rw-r--r-- | lumina-desktop/lumina-desktop.pro | 19 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 5 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/battery/LBattery.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.h | 11 | ||||
-rw-r--r-- | lumina-fm/lumina-fm.pro | 15 | ||||
-rw-r--r-- | lumina-fm/main.cpp | 11 | ||||
-rw-r--r-- | lumina-open/lumina-open.pro | 11 | ||||
-rw-r--r-- | lumina-open/main.cpp | 61 | ||||
-rw-r--r-- | lumina-screenshot/lumina-screenshot.pro | 15 | ||||
-rw-r--r-- | lumina-screenshot/main.cpp | 9 |
23 files changed, 263 insertions, 234 deletions
diff --git a/debian/rules b/debian/rules index af0d1ff9..8ff08a11 100755 --- a/debian/rules +++ b/debian/rules @@ -8,17 +8,21 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +DEB_PREF = $(shell gcc -print-multiarch) +USER_QMAKE = "qmake-qt4 PREFIX=/usr LIBPREFIX=/usr/lib/$(DEB_PEF)" +QMAKE_EXTRA_DIRS = libLumina \ + lumina-config \ + lumina-desktop \ + lumina-fm \ + lumina-open \ + lumina-screenshot + %: dh $@ build: - qmake-qt4 - (cd libLumina && qmake-qt4) - (cd lumina-config && qmake-qt4) - (cd lumina-desktop && qmake-qt4) - (cd lumina-fm && qmake-qt4) - (cd lumina-open && qmake-qt4) - (cd lumina-screenshot && qmake-qt4) + $(USER_QMAKE) + for d in $(QMAKE_EXTRA_DIRS) ; do (cd $$d $(USER_QMAKE)); done override_dh_auto_clean: -$(MAKE) distclean diff --git a/global.h b/global.h new file mode 100644 index 00000000..6a5fded5 --- /dev/null +++ b/global.h @@ -0,0 +1,10 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2014, Christopher Roy Bratusek +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== + +#ifndef PREFIX + #define PREFIX QString("/usr/local") +#endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index bdd16fac..acece864 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -20,7 +20,7 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system //OS-specific application shortcuts (*.desktop files) QString LOS::ControlPanelShortcut(){ return ""; } //system control panel QString LOS::AppStoreShortcut(){ return ""; } //graphical app/pkg manager -QString LOS::QtConfigShortcut(){ return "/usr/bin/qtconfig-qt4"; } //qtconfig binary (NOT *.desktop file) +QString LOS::QtConfigShortcut(){ return LOS::AppPrefix() + "/bin/qtconfig-qt4"; } //qtconfig binary (NOT *.desktop file) // ==== ExternalDevicePaths() ==== QStringList LOS::ExternalDevicePaths(){ @@ -122,12 +122,12 @@ void LOS::changeAudioVolume(int percentdiff){ //Check if a graphical audio mixer is installed bool LOS::hasMixerUtility(){ - return QFile::exists("/usr/bin/pavucontrol"); + return QFile::exists(LOS::AppPrefix() + "bin/pavucontrol"); } //Launch the graphical audio mixer utility void LOS::startMixerUtility(){ - QProcess::startDetached("/usr/bin/pavucontrol"); + QProcess::startDetached(LOS::AppPrefix() + "bin/pavucontrol"); } //Check for user system permission (shutdown/restart) @@ -150,7 +150,7 @@ bool LOS::hasBattery(){ QString my_status = LUtils::getCmdOutput("acpi -b").join(""); bool no_battery = my_status.contains("No support"); if (no_battery) return false; - return true; + return true; } //Battery Charge Level @@ -173,7 +173,7 @@ int LOS::batteryCharge(){ //Returns: percent charge (0-100), anything outside th // these include "Unknown, Full and No support. // However, it seems just one status is returned when running // on battery and that is "Discharging". So if the value we get -// is NOT Discharging then we assume the batter yis charging. +// is NOT Discharging then we assume the battery is charging. bool LOS::batteryIsCharging(){ QString my_status = LUtils::getCmdOutput("acpi -b").join(""); bool discharging = my_status.contains("Discharging"); diff --git a/libLumina/libLumina.pro b/libLumina/libLumina.pro index 45a310b7..7e2028c7 100644 --- a/libLumina/libLumina.pro +++ b/libLumina/libLumina.pro @@ -2,7 +2,15 @@ QT += core TARGET=LuminaUtils -target.path = /usr/local/lib + +isEmpty(PREFIX) { + PREFIX = /usr/local +} + +isEmtpy(LIBPREFIX) { + LIBPREFIX = $$PREFIX/lib +} +target.path = $$LIBPREFIX DESTDIR= $$_PRO_FILE_PWD_/ @@ -17,7 +25,7 @@ HEADERS += LuminaXDG.h \ SOURCES += LuminaXDG.cpp \ LuminaUtils.cpp \ - LuminaX11.cpp \ + LuminaX11.cpp \ LuminaOS-FreeBSD.cpp \ LuminaOS-DragonFly.cpp \ LuminaOS-OpenBSD.cpp \ @@ -25,16 +33,16 @@ SOURCES += LuminaXDG.cpp \ LuminaOS-kFreeBSD.cpp # new OS support can be added here -INCLUDEPATH += /usr/local/include +INCLUDEPATH += $$PREFIX/include LIBS += -lX11 -lXrender -lXcomposite -include.path=/usr/local/include/ +include.path=$$PREFIX/include/ include.files=LuminaXDG.h \ LuminaUtils.h \ LuminaX11.h \ LuminaOS.h -INSTALLS += target include +INSTALLS += target include -QMAKE_LIBDIR = /usr/local/lib/qt4 /usr/local/lib +QMAKE_LIBDIR = $$LIBPREFIX/qt4 $$LIBPREFIX diff --git a/lumina-config/lumina-config.pro b/lumina-config/lumina-config.pro index 01203a36..ae063bed 100644 --- a/lumina-config/lumina-config.pro +++ b/lumina-config/lumina-config.pro @@ -2,7 +2,10 @@ QT += core gui TARGET = lumina-config -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin TEMPLATE = app @@ -22,7 +25,7 @@ FORMS += mainUI.ui \ # RESOURCES+= lumina-config.qrc -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include LIBS += -L../libLumina -lLuminaUtils freebsd-* { @@ -104,7 +107,7 @@ TRANSLATIONS = i18n/lumina-config_af.ts \ i18n/lumina-config_zh_TW.ts \ i18n/lumina-config_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ INSTALLS += target dotrans diff --git a/lumina-config/main.cpp b/lumina-config/main.cpp index d1cb2004..65f2bf08 100644 --- a/lumina-config/main.cpp +++ b/lumina-config/main.cpp @@ -8,10 +8,7 @@ #include <QFile> #include "mainUI.h" - -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif +#include "../global.h" int main(int argc, char ** argv) { @@ -25,12 +22,12 @@ int main(int argc, char ** argv) QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - + if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-config_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("lumina-config_") + langCode, PREFIX + "/share/i18n/Lumina-DE/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; - + MainUI w; QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance()) ); diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index a29de699..ee997821 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -13,7 +13,7 @@ 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 - + //Be careful about the QSettings setup, it must match the lumina-desktop setup QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings( QSettings::UserScope, "LuminaDE", "desktopsettings", this); @@ -27,7 +27,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ ui->spin_screen->setValue(desktop->primaryScreen()+1); //have the current screen auto-selected //qDebug() << "Number of Screens:" << desktop->screenCount(); sysApps = LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ); - + //Now finish setting up the UI setupIcons(); setupMenus(); @@ -44,7 +44,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ } MainUI::~MainUI(){ - + } void MainUI::slotSingleInstance(){ @@ -59,7 +59,7 @@ void MainUI::slotSingleInstance(){ //================ void MainUI::setupIcons(){ //Pull all the icons from the current theme using libLumina (LXDG) - + //General UI ui->actionDesktop->setIcon( LXDG::findIcon("preferences-desktop-wallpaper","") ); ui->actionPanels->setIcon( LXDG::findIcon("configure-toolbars","") ); @@ -67,14 +67,14 @@ void MainUI::setupIcons(){ ui->actionShortcuts->setIcon( LXDG::findIcon("configure-shortcuts","") ); ui->actionDefaults->setIcon( LXDG::findIcon("preferences-desktop-filetype-association","") ); ui->actionSession->setIcon( LXDG::findIcon("preferences-system-session-services","") ); - ui->push_save->setIcon( LXDG::findIcon("document-save","") ); - - + 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->tool_desk_addplug->setIcon( LXDG::findIcon("list-add","") ); - + //Panels Page ui->tool_panel1_add->setIcon( LXDG::findIcon("list-add","") ); ui->tool_panel1_rm->setIcon( LXDG::findIcon("list-remove","") ); @@ -101,23 +101,23 @@ void MainUI::setupIcons(){ ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") ); ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") ); ui->tool_menu_findterm->setIcon( LXDG::findIcon("system-search","") ); - + //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","") ); - + //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","") ); - + } void MainUI::setupConnections(){ @@ -130,7 +130,7 @@ void MainUI::setupConnections(){ 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()) ); @@ -139,7 +139,7 @@ void MainUI::setupConnections(){ 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()) ); - + //Panels Page connect(ui->tool_panel1_add,SIGNAL(clicked()), this, SLOT(addpanel1()) ); connect(ui->tool_panel2_add,SIGNAL(clicked()), this, SLOT(addpanel2()) ); @@ -170,18 +170,18 @@ void MainUI::setupConnections(){ connect(ui->tool_menu_findterm, SIGNAL(clicked()), this, SLOT(findmenuterminal()) ); connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) ); connect(ui->line_menu_term, SIGNAL(textChanged(QString)), this, SLOT(checkmenuicons()) ); - + //Shortcuts Page connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) ); connect(ui->tool_shortcut_set, SIGNAL(clicked()), this, SLOT(getKeyPress()) ); - + //Defaults Page connect(ui->tool_defaults_addextension, SIGNAL(clicked()), this, SLOT(adddefaultextension()) ); connect(ui->tool_defaults_addgroup, SIGNAL(clicked()), this, SLOT(adddefaultgroup()) ); connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) ); connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) ); 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()) ); @@ -201,13 +201,13 @@ void MainUI::setupMenus(){ //Desktop Plugin Menu ui->combo_desk_plugs->clear(); QStringList plugs = PINFO->desktopPlugins(); - for(int i=0; i<plugs.length(); i++){ + for(int i=0; i<plugs.length(); i++){ LPI info = PINFO->desktopPluginInfo(plugs[i]); ui->combo_desk_plugs->addItem( LXDG::findIcon(info.icon,""), info.name, plugs[i]); } ui->tool_desk_addplug->setEnabled(!plugs.isEmpty()); deskplugchanged(); //make sure it loads the right info - + //Panel locations ui->combo_panel1_loc->clear(); ui->combo_panel2_loc->clear(); @@ -231,8 +231,8 @@ void MainUI::setupMenus(){ for(int i=0; i<fbstyles.length(); i++){ ui->combo_session_wtheme->addItem(fbstyles[i], fbdir.absoluteFilePath(fbstyles[i])); } - - + + } int MainUI::currentDesktop(){ @@ -264,7 +264,7 @@ QString MainUI::getNewPanelPlugin(){ bool ok = false; QString sel = QInputDialog::getItem(this, tr("New Panel Plugin"), tr("Add Plugin:"), names, 0, false, &ok); if(ok && !sel.isEmpty()){ - out = plugs[ names.indexOf(sel) ]; + out = plugs[ names.indexOf(sel) ]; } return out; } @@ -283,7 +283,7 @@ XDGDesktop MainUI::getSysApp(){ AppDialog dlg(this, sysApps); dlg.exec(); return dlg.appselected; - + } //Convert to/from fluxbox key codes @@ -314,7 +314,7 @@ QString MainUI::fluxToDispKeys(QString in){ //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; + return in; } //Read/overwrite a text file @@ -341,7 +341,7 @@ bool MainUI::overwriteFile(QString path, QStringList contents){ file.close(); return true; } - return false; + return false; } //================ @@ -361,7 +361,7 @@ void MainUI::slotChangePage(bool enabled){ 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); } @@ -380,7 +380,7 @@ void MainUI::slotChangePage(bool enabled){ } ui->group_screen->setVisible(showScreen && (ui->spin_screen->maximum()>1) ); if(ui->page_panels->isVisible()){ checkpanels(); } - + } void MainUI::slotChangeScreen(){ @@ -399,7 +399,7 @@ void MainUI::slotChangeScreen(){ void MainUI::saveAndQuit(){ saveCurrentSettings(); - this->close(); + this->close(); } //General Utility Functions @@ -410,7 +410,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ 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(); @@ -424,7 +424,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ 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()) ); - + //Panels Page int panels = settings->value(DPrefix+"panels",-1).toInt(); if(panels==-1 && primary){ panels=1; } @@ -499,8 +499,8 @@ void MainUI::loadCurrentSettings(bool screenonly){ ui->label_panel2_sample->setStyleSheet("background: rgba(255,255,255,160)"); } checkpanels(); //make sure buttons are updated - - + + if(!screenonly){ // Menu Page //Default terminal binary @@ -537,13 +537,13 @@ void MainUI::loadCurrentSettings(bool screenonly){ } //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; @@ -568,7 +568,7 @@ void MainUI::saveCurrentSettings(bool screenonly){ settings->setValue(DPrefix+"background/filelist", bgs); settings->setValue(DPrefix+"background/minutesToChange", ui->spin_desk_min->value()); } - + // Panels Page if(modpan){ settings->setValue(DPrefix+"panels", panelnumber); @@ -586,7 +586,7 @@ void MainUI::saveCurrentSettings(bool screenonly){ plugs << ui->list_panel1_plugins->item(i)->whatsThis(); } settings->setValue(PPrefix+"pluginlist",plugs); - + }else{ //Clear that panel's saved settings QStringList keys = settings->allKeys().filter("panel"+QString::number(currentDesktop())+".0/"); @@ -622,22 +622,22 @@ void MainUI::saveCurrentSettings(bool screenonly){ } 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(); @@ -692,7 +692,7 @@ void MainUI::deskbgchanged(){ 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); } @@ -711,7 +711,7 @@ void MainUI::deskbgremoved(){ void MainUI::deskbgadded(){ //Prompt the user to find an image file to use for a background - QString dir = "/usr/local/share/wallpapers/Lumina-DE"; + QString dir = PREFIX + "/share/wallpapers/Lumina-DE"; if( !QFile::exists(dir) ){ dir = QDir::homePath(); } QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), dir, "Images (*.png *.xpm *.jpg)"); if(bgs.isEmpty()){ return; } @@ -756,7 +756,7 @@ void MainUI::addpanel1(){ void MainUI::addpanel2(){ ui->toolBox_panel2->setVisible(true); - checkpanels(); + checkpanels(); ui->push_save->setEnabled(true); modpan = true; panelnumber = 2; @@ -764,7 +764,7 @@ void MainUI::addpanel2(){ void MainUI::rmpanel1(){ ui->toolBox_panel1->setVisible(false); - checkpanels(); + checkpanels(); ui->push_save->setEnabled(true); modpan = true; panelnumber = 0; @@ -772,7 +772,7 @@ void MainUI::rmpanel1(){ void MainUI::rmpanel2(){ ui->toolBox_panel2->setVisible(false); - checkpanels(); + checkpanels(); ui->push_save->setEnabled(true); modpan = true; panelnumber = 1; @@ -800,7 +800,7 @@ void MainUI::checkpanels(){ if(ui->tool_panel2_add->isVisible()){ panelnumber = 1; } else{panelnumber = 2; } } - + } void MainUI::adjustpanel1(){ @@ -839,7 +839,7 @@ void MainUI::adjustpanel2(){ if(!loading){ ui->push_save->setEnabled(true); modpan = true; } } - + void MainUI::getpanel1color(){ QString color = getColorStyle(ui->label_panel1_sample->whatsThis()); if(color.isEmpty()){ return; } //nothing selected @@ -909,7 +909,7 @@ void MainUI::uppanel1plugin(){ void MainUI::uppanel2plugin(){ int row = ui->list_panel2_plugins->currentRow(); if( row <= 0){ return; } - ui->list_panel2_plugins->insertItem(row-1, ui->list_panel2_plugins->takeItem(row)); + ui->list_panel2_plugins->insertItem(row-1, ui->list_panel2_plugins->takeItem(row)); ui->list_panel2_plugins->setCurrentRow(row-1); if(!loading){ ui->push_save->setEnabled(true); modpan = true; } } @@ -925,7 +925,7 @@ void MainUI::dnpanel1plugin(){ void MainUI::dnpanel2plugin(){ int row = ui->list_panel2_plugins->currentRow(); if( row < 0 || row >= (ui->list_panel2_plugins->count()-1) ){ return; } - ui->list_panel2_plugins->insertItem(row+1, ui->list_panel2_plugins->takeItem(row)); + ui->list_panel2_plugins->insertItem(row+1, ui->list_panel2_plugins->takeItem(row)); ui->list_panel2_plugins->setCurrentRow(row+1); if(!loading){ ui->push_save->setEnabled(true); modpan = true; } } @@ -992,11 +992,11 @@ void MainUI::downmenuplugin(){ } void MainUI::findmenuterminal(){ - QString chkpath = "/usr/local/bin"; + QString chkpath = PREFIX + "/bin"; if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } QString bin = QFileDialog::getOpenFileName(this, tr("Set Default Terminal Application"), chkpath, tr("Application Binaries (*)") ); if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - if( !QFileInfo(bin).isExecutable() ){ + if( !QFileInfo(bin).isExecutable() ){ QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); return; } @@ -1009,7 +1009,7 @@ 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 ); - if(settings->value("default-terminal","").toString()!=ui->line_menu_term->text()){ + if(settings->value("default-terminal","").toString()!=ui->line_menu_term->text()){ ui->push_save->setEnabled(true); modmenu = true; } @@ -1060,7 +1060,7 @@ void MainUI::saveKeyboardShortcuts(){ QTreeWidgetItem *it = ui->tree_shortcut->topLevelItem(i); current << it->whatsThis(1)+" :"+it->whatsThis(0); //Full Fluxbox command line } - + QStringList info = readFile(QDir::homePath()+"/.lumina/fluxbox-keys"); for(int i=0; i<info.length(); i++){ if(info[i].isEmpty() || info[i].startsWith("#") || info[i].startsWith("!")){ continue; } @@ -1202,7 +1202,7 @@ void MainUI::adddefaultgroup(){ QString name = QInputDialog::getText(this, tr("New Application Group"), tr("Name:"), QLineEdit::Normal, "", &ok); if(name.isEmpty() || !ok){ return; } //cancelled //Make sure that name is not already taken - + //Add it as a new top-level item ui->tree_defaults->addTopLevelItem( new QTreeWidgetItem( QStringList() << name << "" ) ); ui->push_save->setEnabled(true); @@ -1219,7 +1219,7 @@ void MainUI::adddefaultextension(){ QString name = QInputDialog::getText(this, tr("New File Extension"), tr("Extension:"), QLineEdit::Normal, "", &ok); if(name.isEmpty() || !ok){ return; } //cancelled //Make sure that name is not already taken - + //Add it as a new child of this group item it->addChild( new QTreeWidgetItem( QStringList() << name << "" ) ); ui->push_save->setEnabled(true); @@ -1273,7 +1273,7 @@ void MainUI::checkdefaulticons(){ if(it!=0){ if(it->text(0)=="Uncategorized"){ ui->tool_defaults_set->setEnabled(false); - ui->tool_defaults_clear->setEnabled(false); + ui->tool_defaults_clear->setEnabled(false); } } } @@ -1297,19 +1297,19 @@ void MainUI::loadSessionSettings(){ 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 QStringList STARTUP = readFile(QDir::homePath()+"/.lumina/startapps"); ui->list_session_start->clear(); @@ -1338,12 +1338,12 @@ void MainUI::loadSessionSettings(){ 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() ); - + sessionstartchanged(); //make sure to update buttons } @@ -1381,7 +1381,7 @@ void MainUI::saveSessionSettings(){ } ok = overwriteFile(QDir::homePath()+"/.lumina/startapps", STARTUP); if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/startapps"; } - + //Now do the general session options sessionsettings->setValue("EnableNumlock", ui->check_session_numlock->isChecked()); sessionsettings->setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked()); @@ -1406,11 +1406,11 @@ void MainUI::addsessionstartapp(){ } void MainUI::addsessionstartbin(){ - QString chkpath = "/usr/local/bin"; + QString chkpath = PREFIX + "/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() ){ + if( !QFileInfo(bin).isExecutable() ){ QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); return; } @@ -1448,7 +1448,7 @@ void MainUI::sessionthemechanged(){ }else{ ui->label_session_wpreview->setText(tr("No Preview Available")); } - sessionoptchanged(); + sessionoptchanged(); } void MainUI::sessionstartchanged(){ diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index 24e7f72c..28e38984 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -26,8 +26,9 @@ #include "LPlugins.h" #include "KeyCatch.h" #include "AppDialog.h" +#include "../global.h" -#define DEFAULTBG QString("/usr/local/share/Lumina-DE/desktop-background.jpg") +#define DEFAULTBG QString(PREFIX + "/share/Lumina-DE/desktop-background.jpg") //namespace for using the *.ui file namespace Ui{ @@ -65,15 +66,15 @@ private: //Get an application on the system XDGDesktop getSysApp(); - + //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); - + private slots: void slotSingleInstance(); @@ -100,11 +101,11 @@ private slots: void addpanel2(); void rmpanel1(); void rmpanel2(); - + void checkpanels(); void adjustpanel1(); void adjustpanel2(); - + void getpanel1color(); void getpanel2color(); void addpanel1plugin(); @@ -115,7 +116,7 @@ private slots: void uppanel2plugin(); void dnpanel1plugin(); void dnpanel2plugin(); - + //Menu Page void addmenuplugin(); void rmmenuplugin(); @@ -123,13 +124,13 @@ private slots: void downmenuplugin(); void findmenuterminal(); void checkmenuicons(); - + //Shortcuts Page void loadKeyboardShortcuts(); void saveKeyboardShortcuts(); void clearKeyBinding(); void getKeyPress(); - + //Defaults Page void loadDefaultSettings(); void saveDefaultSettings(); @@ -138,7 +139,7 @@ private slots: void cleardefaultitem(); void setdefaultitem(); void checkdefaulticons(); - + //Session Page void loadSessionSettings(); void saveSessionSettings(); @@ -151,4 +152,4 @@ private slots: void sessionstartchanged(); }; -#endif
\ No newline at end of file +#endif diff --git a/lumina-desktop/AppMenu.cpp b/lumina-desktop/AppMenu.cpp index bf7f6d6f..8893c629 100644 --- a/lumina-desktop/AppMenu.cpp +++ b/lumina-desktop/AppMenu.cpp @@ -6,10 +6,11 @@ //=========================================== #include "AppMenu.h" #include "LSession.h" +#include "../global.h" AppMenu::AppMenu(QWidget* parent) : QMenu(parent){ - appstorelink = "/usr/local/share/applications/softmanager.desktop"; //Default application "store" to display (AppCafe in PC-BSD) - controlpanellink = "/usr/local/share/applications/pccontrol.desktop"; //Default control panel + appstorelink = PREFIX + "/share/applications/softmanager.desktop"; //Default application "store" to display (AppCafe in PC-BSD) + controlpanellink = PREFIX + "/share/applications/pccontrol.desktop"; //Default control panel APPS.clear(); watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherUpdate()) ); @@ -42,12 +43,12 @@ void AppMenu::updateAppList(){ this->addAction( LXDG::findIcon("user-home", ""), tr("Open Home"), this, SLOT(launchFileManager()) ); //--Look for the app store XDGDesktop store = LXDG::loadDesktopFile(appstorelink, ok); - if(ok){ + if(ok){ this->addAction( LXDG::findIcon(store.icon, ""), tr("Install Applications"), this, SLOT(launchStore()) ); } //--Look for the control panel store = LXDG::loadDesktopFile(controlpanellink, ok); - if(ok){ + if(ok){ this->addAction( LXDG::findIcon(store.icon, ""), tr("Control Panel"), this, SLOT(launchControlPanel()) ); } this->addSeparator(); @@ -70,7 +71,7 @@ void AppMenu::updateAppList(){ else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; } else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; } else{ name = tr("Unsorted"); icon = "applications-other"; } - + QMenu *menu = new QMenu(name, this); menu->setIcon(LXDG::findIcon(icon,"")); connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(launchApp(QAction*)) ); diff --git a/lumina-desktop/Globals.h b/lumina-desktop/Globals.h index 64b1e438..b2cac1eb 100644 --- a/lumina-desktop/Globals.h +++ b/lumina-desktop/Globals.h @@ -8,6 +8,7 @@ #define _LUMINA_DESKTOP_GLOBALS_H #include <LuminaUtils.h> +#include "../global.h" #include <unistd.h> #include <stdio.h> @@ -26,11 +27,11 @@ public: class SYSTEM{ public: //Installation location for finding default files - static QString installDir(){ return "/usr/local/share/Lumina-DE/"; } + static QString installDir(){ return PREFIX + "/share/Lumina-DE/"; } //Current Username static QString user(){ return QString::fromLocal8Bit(getlogin()); } //Current Hostname - static QString hostname(){ + static QString hostname(){ char name[BUFSIZ]; int count = gethostname(name,sizeof(name)); if (count < 0) { @@ -46,25 +47,25 @@ public: #endif // #ifdef __linux //Restart the system static void restart(){ system("(shutdown -r now) &"); } - + //Determine if there is battery support static bool hasBattery(){ int val = LUtils::getCmdOutput("apm -l").join("").toInt(); return (val >= 0 && val <= 100); } - + //Get the current battery charge percentage static int batteryCharge(){ int charge = LUtils::getCmdOutput("apm -l").join("").toInt(); - if(charge > 100){ charge = -1; } //invalid charge + if(charge > 100){ charge = -1; } //invalid charge return charge; } - + //Get the current battery charge percentage static bool batteryIsCharging(){ return (LUtils::getCmdOutput("apm -a").join("").simplified() == "1"); } - + //Get the amount of time remaining for the battery static int batterySecondsLeft(){ return LUtils::getCmdOutput("apm -t").join("").toInt(); diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 2b661110..e555fac2 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -6,9 +6,10 @@ //=========================================== #include "LDesktop.h" #include "LSession.h" +#include "../global.h" LDesktop::LDesktop(int deskNum) : QObject(){ - + DPREFIX = "desktop-"+QString::number(deskNum)+"/"; desktopnumber = deskNum; desktop = QApplication::desktop(); @@ -35,7 +36,7 @@ LDesktop::LDesktop(int deskNum) : QObject(){ //connect(LSession::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) ); watcher->addPath(settings->fileName()); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) ); - + bgWindow = new QWidget(0); bgWindow->setObjectName("bgWindow"); bgWindow->setContextMenuPolicy(Qt::CustomContextMenu); @@ -45,7 +46,7 @@ LDesktop::LDesktop(int deskNum) : QObject(){ bgDesktop = new QMdiArea(bgWindow); //Make sure the desktop area is transparent to show the background bgDesktop->setBackground( QBrush(Qt::NoBrush) ); - + //Start the update processes QTimer::singleShot(1,this, SLOT(UpdateMenu()) ); QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); @@ -63,7 +64,7 @@ LDesktop::~LDesktop(){ } int LDesktop::Screen(){ - return desktopnumber; + return desktopnumber; } void LDesktop::show(){ @@ -75,20 +76,20 @@ void LDesktop::show(){ void LDesktop::hide(){ bgWindow->hide(); bgDesktop->hide(); - for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); } + for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); } } -void LDesktop::SystemLogout(){ - LSession::systemWindow(); +void LDesktop::SystemLogout(){ + LSession::systemWindow(); } -void LDesktop::SystemTerminal(){ +void LDesktop::SystemTerminal(){ QString term = settings->value("default-terminal","xterm").toString(); LSession::LaunchApplication(term); } void LDesktop::SystemFileManager(){ - LSession::LaunchApplication("lumina-fm"); + LSession::LaunchApplication("lumina-fm"); } void LDesktop::SystemApplication(QAction* act){ @@ -114,7 +115,7 @@ void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){ } // ===================== -// PRIVATE SLOTS +// PRIVATE SLOTS // ===================== void LDesktop::SettingsChanged(){ if(changingsettings || issyncing){ return; } //don't refresh for internal modifications to the fil @@ -130,7 +131,7 @@ void LDesktop::SettingsChanged(){ void LDesktop::UpdateMenu(bool fast){ //qDebug() << " - Update Menu:" << desktopnumber; - //Put a label at the top + //Put a label at the top int num = LX11::GetCurrentDesktop(); //qDebug() << "Found desktop number:" << num; if(num < 0){ workspacelabel->setText( "<b>"+tr("Lumina Desktop")+"</b>"); } @@ -161,7 +162,7 @@ void LDesktop::UpdateMenu(bool fast){ } //Now add the system quit options deskMenu->addSeparator(); - if(!desktoplocked){ + if(!desktoplocked){ deskMenu->addAction(LXDG::findIcon("document-encrypt",""),tr("Lock Desktop"), this, SLOT(ToggleDesktopLock()) ); deskMenu->addAction(LXDG::findIcon("snap-orthogonal",""),tr("Snap Plugins to Grid"), this, SLOT(AlignDesktopPlugins()) ); }else{ deskMenu->addAction(LXDG::findIcon("document-decrypt",""),tr("Unlock Desktop"), this, SLOT(ToggleDesktopLock()) ); } @@ -213,13 +214,13 @@ void LDesktop::UpdateDesktop(){ //Now create the plugin (will load existing settings if possible) qDebug() << " -- New Plugin:" << plugins[i]; plug = NewDP::createPlugin(plugins[i], bgDesktop); - if(plug != 0){ + if(plug != 0){ //qDebug() << " -- Show Plugin"; PLUGINS << plug; CreateDesktopPluginContainer(plug); } } - + } if(changed){ //save the modified plugin list to file (so per-plugin settings are preserved) @@ -246,7 +247,7 @@ void LDesktop::ToggleDesktopLock(){ CreateDesktopPluginContainer(PLUGINS[i]); } bgDesktop->update(); //refresh visuals - UpdateMenu(false); + UpdateMenu(false); } void LDesktop::AlignDesktopPlugins(){ @@ -282,7 +283,7 @@ void LDesktop::AlignDesktopPlugins(){ //Now adjust the size to also be the appropriate grid multiple geom.setWidth( qRound(geom.width()/float(xgrid))*xgrid ); geom.setHeight( qRound(geom.height()/float(ygrid))*ygrid ); - + //Now check for edge spillover and adjust accordingly int diff = (geom.x()+geom.width()) - bgDesktop->size().width(); if( diff > 0 ){ geom.moveTo( geom.x() - diff, geom.y() ); } @@ -318,7 +319,7 @@ void LDesktop::DesktopPluginRemoved(QString ID){ } //Now remove that plugin from the internal list QStringList plugins = settings->value(DPREFIX+"pluginlist",QStringList()).toStringList(); - + plugins.removeAll(ID); changingsettings=true; //don't let the change cause a refresh settings->setValue(DPREFIX+"pluginlist", plugins); @@ -374,7 +375,7 @@ void LDesktop::UpdateDesktopPluginArea(){ //Re-paint the panels (just in case a plugin was underneath it and the panel is transparent) for(int i=0; i<PANELS.length(); i++){ PANELS[i]->update(); } } - + void LDesktop::UpdateBackground(){ //Get the current Background static bool bgupdating = false; @@ -385,8 +386,8 @@ void LDesktop::UpdateBackground(){ QStringList bgL = settings->value(DPREFIX+"background/filelist", QStringList()).toStringList(); //qDebug() << " - List:" << bgL << CBG; //Remove any invalid files - for(int i=0; i<bgL.length(); i++){ - if( (!QFile::exists(bgL[i]) && bgL[i]!="default") || bgL[i].isEmpty()){ bgL.removeAt(i); i--; } + for(int i=0; i<bgL.length(); i++){ + if( (!QFile::exists(bgL[i]) && bgL[i]!="default") || bgL[i].isEmpty()){ bgL.removeAt(i); i--; } } //Determine which background to use next int index = bgL.indexOf(CBG); @@ -400,7 +401,7 @@ void LDesktop::UpdateBackground(){ //Save this file as the current background CBG = bgFile; //qDebug() << " - Set Background to:" << CBG << index << bgL; - if( (bgFile.toLower()=="default")){ bgFile = "/usr/local/share/Lumina-DE/desktop-background.jpg"; } + if( (bgFile.toLower()=="default")){ bgFile = PREFIX + "/share/Lumina-DE/desktop-background.jpg"; } //Now set this file as the current background QString style = "QWidget#bgWindow{ border-image:url(%1) stretch;}"; style = style.arg(bgFile); diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index f551b2d1..f58b83fe 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -5,6 +5,7 @@ // See the LICENSE file for full details //=========================================== #include "LSession.h" +#include "../global.h" #include <Phonon/MediaObject> #include <Phonon/AudioOutput> @@ -64,15 +65,15 @@ void LSession::setupSession(){ //Initialize the internal variables DESKTOPS.clear(); - + //Launch Fluxbox qDebug() << " - Launching Fluxbox"; WM = new WMProcess(); WM->startWM(); - + //Initialize the desktops updateDesktops(); - + //Initialize the global menus qDebug() << " - Initialize system menus"; appmenu = new AppMenu(); @@ -91,7 +92,7 @@ void LSession::setupSession(){ mediaObj->moveToThread(audioThread); audioOut->moveToThread(audioThread); }*/ - + //Now setup the system watcher for changes qDebug() << " - Initialize file system watcher"; watcher = new QFileSystemWatcher(this); @@ -99,7 +100,7 @@ void LSession::setupSession(){ //watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-init" ); watcher->addPath( QDir::homePath()+"/.lumina/fluxbox-keys" ); - + //connect internal signals/slots connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(updateDesktops()) ); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) ); @@ -130,10 +131,10 @@ void LSession::launchStartupApps(){ qDebug() << "Launching startup applications"; for(int i=0; i<2; i++){ QString startfile; - if(i==0){startfile = "/usr/local/share/Lumina-DE/startapps"; } + if(i==0){startfile = PREFIX + "/share/Lumina-DE/startapps"; } else{ startfile = QDir::homePath()+"/.lumina/startapps"; } if(!QFile::exists(startfile)){ continue; } //go to the next - + QFile file(startfile); if( file.open(QIODevice::ReadOnly | QIODevice::Text) ){ QTextStream in(&file); @@ -149,7 +150,7 @@ void LSession::launchStartupApps(){ } //Now play the login music if(sessionsettings->value("PlayStartupAudio",true).toBool()){ - LSession::playAudioFile("/usr/local/share/Lumina-DE/Login.ogg"); + LSession::playAudioFile(PREFIX + "/share/Lumina-DE/Login.ogg"); } if(sessionsettings->value("EnableNumlock",true).toBool()){ QProcess::startDetached("numlockx on"); @@ -189,7 +190,7 @@ void LSession::checkUserFiles(){ QFile::setPermissions(dset, QFile::ReadUser | QFile::WriteUser | QFile::ReadOwner | QFile::WriteOwner); } } - + } //Check the fluxbox configuration files dset = QDir::homePath()+"/.lumina/"; @@ -204,14 +205,14 @@ void LSession::checkUserFiles(){ QFile::copy(":/fluxboxconf/fluxbox-keys", dset+"fluxbox-keys"); QFile::setPermissions(dset+"fluxbox-init", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup); QFile::setPermissions(dset+"fluxbox-keys", QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadOther | QFile::ReadGroup); - } - + } + if(firstrun){ qDebug() << "First time using Lumina!!"; } else if(newversion){ qDebug() << "Updating session file to current version"; } - - + + //Save the current version of the session to the settings file (for next time) sessionsettings->setValue("DesktopVersion", this->applicationVersion()); } @@ -229,7 +230,7 @@ void LSession::loadStyleSheet(){ //Now fix/apply the sheet sheet.replace("\n"," "); //make sure there are no newlines this->setStyleSheet(sheet); - } + } } void LSession::refreshWindowManager(){ @@ -282,7 +283,7 @@ bool LSession::x11EventFilter(XEvent *event){ || event->xproperty.atom == XInternAtom(QX11Info::display(),"_NET_WM_VISIBLE_ICON_NAME",false) ){ LSession::restoreOverrideCursor(); //restore the mouse cursor back to normal (new window opened?) emit WindowListEvent(); - } + } break; } // ----------------------- diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp index 10d44524..55f1e4a4 100644 --- a/lumina-desktop/SystemWindow.cpp +++ b/lumina-desktop/SystemWindow.cpp @@ -2,6 +2,7 @@ #include "ui_SystemWindow.h" #include "LSession.h" +#include "../global.h" #include <unistd.h> //for usleep() usage SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){ @@ -32,12 +33,12 @@ SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){ } SystemWindow::~SystemWindow(){ - + } void SystemWindow::closeAllWindows(){ if( LSession::sessionSettings()->value("PlayLogoutAudio",true).toBool() ){ - LSession::playAudioFile("/usr/local/share/Lumina-DE/Logout.ogg"); + LSession::playAudioFile(PREFIX + "/share/Lumina-DE/Logout.ogg"); } QList<WId> WL = LX11::WindowList(); for(int i=0; i<WL.length(); i++){ diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro index 69c81b86..708e2046 100644 --- a/lumina-desktop/lumina-desktop.pro +++ b/lumina-desktop/lumina-desktop.pro @@ -2,7 +2,10 @@ QT += core gui network phonon TARGET = Lumina-DE -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin LIBS += -L../libLumina -lLuminaUtils -lXdamage -lX11 QMAKE_LIBDIR = ../libLumina @@ -84,25 +87,25 @@ FORMS += SystemWindow.ui \ RESOURCES+= Lumina-DE.qrc -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include desktop.files = Lumina-DE.desktop linux-* { desktop.path = /usr/share/xsessions } else { -desktop.path = /usr/local/share/xsessions +desktop.path = $$PREFIX/share/xsessions } icons.files = Lumina-DE.png \ Insight-FileManager.png -icons.path = /usr/local/share/pixmaps +icons.path = $$PREFIX/share/pixmaps wallpapers.files = wallpapers/Lumina_Wispy_gold_1920x1080.jpg \ wallpapers/Lumina_Wispy_green_1920x1080.jpg \ wallpapers/Lumina_Wispy_purple_1920x1080.jpg \ wallpapers/Lumina_Wispy_red_1920x1080.jpg -wallpapers.path = /usr/local/share/wallpapers/Lumina-DE +wallpapers.path = $$PREFIX/share/wallpapers/Lumina-DE defaults.files = defaults/desktop-background.jpg \ defaults/defaultapps.conf \ @@ -110,7 +113,7 @@ defaults.files = defaults/desktop-background.jpg \ defaults/stylesheet.qss \ audiofiles/Logout.ogg \ audiofiles/Login.ogg -defaults.path = /usr/local/share/Lumina-DE/ +defaults.path = $$PREFIX/share/Lumina-DE/ TRANSLATIONS = i18n/lumina-desktop_af.ts \ i18n/lumina-desktop_ar.ts \ @@ -175,7 +178,7 @@ TRANSLATIONS = i18n/lumina-desktop_af.ts \ i18n/lumina-desktop_zh_TW.ts \ i18n/lumina-desktop_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ INSTALLS += target desktop icons wallpapers defaults dotrans diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 1ae8cb51..3339e9ed 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -20,13 +20,10 @@ //#include "LDesktop.h" #include "LSession.h" #include "Globals.h" +#include "../global.h" #include <LuminaXDG.h> //from libLuminaUtils -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif - QFile logfile(QDir::homePath()+"/.lumina/logs/runtime.log"); void MessageOutput(QtMsgType type, const char *msg){ QString txt; diff --git a/lumina-desktop/panel-plugins/battery/LBattery.cpp b/lumina-desktop/panel-plugins/battery/LBattery.cpp index b80a4d05..dda32ecd 100644 --- a/lumina-desktop/panel-plugins/battery/LBattery.cpp +++ b/lumina-desktop/panel-plugins/battery/LBattery.cpp @@ -103,4 +103,4 @@ QString LBattery::getRemainingTime(){ rem.append(QString::number(secs)+"s"); } return rem; -}
\ No newline at end of file +} diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h index da149c42..1b1405b3 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -23,10 +23,11 @@ #include <LuminaXDG.h> #include <LuminaOS.h> #include "UserItemWidget.h" +#include "../../../global.h" -//#define APPSTORE QString("/usr/local/share/applications/softmanager.desktop") -//#define CONTROLPANEL QString("/usr/local/share/applications/pccontrol.desktop") -//#define QTCONFIG QString("/usr/local/bin/qtconfig-qt4") +//#define APPSTORE QString(PREFIX + "/share/applications/softmanager.desktop") +//#define CONTROLPANEL QString(PREFIX + "/share/applications/pccontrol.desktop") +//#define QTCONFIG QString(PREFIX + "/bin/qtconfig-qt4") #define SSAVER QString("xscreensaver-demo") namespace Ui{ @@ -60,7 +61,7 @@ private slots: //Apps Tab void updateAppCategories(); void updateApps(); - + //Home Tab void updateHome(); void slotGoToDir(QString dir); @@ -92,4 +93,4 @@ signals: }; -#endif
\ No newline at end of file +#endif diff --git a/lumina-fm/lumina-fm.pro b/lumina-fm/lumina-fm.pro index afe46993..a192d3d7 100644 --- a/lumina-fm/lumina-fm.pro +++ b/lumina-fm/lumina-fm.pro @@ -2,7 +2,10 @@ QT += core gui phonon TARGET = lumina-fm -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin TEMPLATE = app @@ -22,9 +25,9 @@ FORMS += MainUI.ui \ # RESOURCES+= lumina-fm.qrc -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include - LIBS += -L../libLumina -lLuminaUtils + LIBS += -L../libLumina -lLuminaUtils freebsd-* { LIBS += -lQtSolutions_SingleApplication-head } @@ -101,10 +104,10 @@ TRANSLATIONS = i18n/lumina-fm_af.ts \ i18n/lumina-fm_zh_TW.ts \ i18n/lumina-fm_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ desktop.files=lumina-fm.desktop -desktop.path=/usr/local/share/applications/ +desktop.path=$$PREFIX/share/applications/ INSTALLS += target dotrans desktop diff --git a/lumina-fm/main.cpp b/lumina-fm/main.cpp index 4c23366a..267e6e68 100644 --- a/lumina-fm/main.cpp +++ b/lumina-fm/main.cpp @@ -8,10 +8,7 @@ #include <QTextCodec> #include "MainUI.h" - -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif +#include "../global.h" int main(int argc, char ** argv) { @@ -33,16 +30,16 @@ int main(int argc, char ** argv) QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - + if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-fm_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("lumina-fm_") + langCode, PREFIX + "/share/i18n/Lumina-DE/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; - + //Load current encoding for this locale QTextCodec::setCodecForTr( QTextCodec::codecForLocale() ); //make sure to use the same codec qDebug() << "Locale Encoding:" << QTextCodec::codecForLocale()->name(); - + MainUI w; QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) ); w.OpenDirs(in); diff --git a/lumina-open/lumina-open.pro b/lumina-open/lumina-open.pro index 34e76d54..b70d6b27 100644 --- a/lumina-open/lumina-open.pro +++ b/lumina-open/lumina-open.pro @@ -2,7 +2,10 @@ QT += core gui TARGET = lumina-open -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin TEMPLATE = app @@ -15,7 +18,7 @@ FORMS += LFileDialog.ui RESOURCES+= lumina-open.qrc -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include LIBS += -L../libLumina -lLuminaUtils QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../libLumina @@ -89,7 +92,7 @@ TRANSLATIONS = i18n/lumina-open_af.ts \ i18n/lumina-open_zh_TW.ts \ i18n/lumina-open_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ INSTALLS += target dotrans diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp index 339446b9..427dbe04 100644 --- a/lumina-open/main.cpp +++ b/lumina-open/main.cpp @@ -25,24 +25,21 @@ #include <QTextCodec> #include "LFileDialog.h" +#include "../global.h" #include <LuminaXDG.h> #include <LuminaOS.h> -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif - void printUsageInfo(){ qDebug() << "lumina-open: Application launcher for the Lumina Desktop Environment"; - qDebug() << "Description: Given a file (with absolute path) or URL, this utility will try to find the appropriate application with which to open the file. If the file is a *.desktop application shortcut, it will just start the application appropriately. It can also perform a few specific system operations if given special flags."; + qDebug() << "Description: Given a file (with absolute path) or URL, this utility will try to find the appropriate application with which to open the file. If the file is a *.desktop application shortcut, it will just start the application appropriately. It can also perform a few specific system operations if given special flags."; qDebug() << "Usage: lumina-open [-select] <absolute file path or URL>"; qDebug() << " lumina-open [-volumeup, -volumedown, -brightnessup, -brightnessdown]"; qDebug() << " [-select] (optional) flag to bypass any default application settings and show the application selector window"; qDebug() << "Special Flags:"; qDebug() << " \"-volume[up/down]\" Flag to increase/decrease audio volume by 5%"; qDebug() << " \"-brightness[up/down]\" Flag to increase/decrease screen brightness by 5%"; - exit(1); + exit(1); } /*QApplication setupApplication(int argc, char **argv){ @@ -50,9 +47,9 @@ void printUsageInfo(){ QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); @@ -69,9 +66,9 @@ void showOSD(int argc, char **argv, QString message){ QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); @@ -106,7 +103,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS if(ok){ QString exec = LXDG::getDesktopExec(DF); if(!exec.isEmpty()){ - qDebug() << "[lumina-open] Using default application:" << DF.name << "File:" << inFile; + qDebug() << "[lumina-open] Using default application:" << DF.name << "File:" << inFile; if(!DF.path.isEmpty()){ path = DF.path; } return exec; } @@ -120,18 +117,18 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); qDebug() << "Locale:" << langCode; - + //Load current encoding for this locale QTextCodec::setCodecForTr( QTextCodec::codecForLocale() ); //make sure to use the same codec qDebug() << "Locale Encoding:" << QTextCodec::codecForLocale()->name(); - + LFileDialog w; if(inFile.startsWith(extension)){ //URL @@ -141,7 +138,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS if(inFile.endsWith("/")){ inFile.chop(1); } w.setFileInfo(inFile.section("/",-1), extension, true); } - + w.show(); App.exec(); @@ -160,7 +157,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat //Get the input file QString inFile; bool showDLG = false; //flag to bypass any default application setting - if(argc > 1){ + if(argc > 1){ for(int i=1; i<argc; i++){ if(QString(argv[i]).simplified() == "-select"){ showDLG = true; @@ -209,7 +206,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat if( !isFile && !isUrl ){ qDebug() << "Error: Invalid file or URL"; return;} //Determing the type of file (extension) QString extension; - if(isFile){ + if(isFile){ QFileInfo info(inFile); extension=info.completeSuffix(); if(info.isDir()){ extension="directory"; } @@ -221,7 +218,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat if(extension=="directory" && !showDLG){ cmd = "lumina-fm"; useInputFile=true; - }else if(extension=="desktop" && !showDLG){ + }else if(extension=="desktop" && !showDLG){ bool ok = false; XDGDesktop DF = LXDG::loadDesktopFile(inFile, ok); if(!ok){ @@ -230,10 +227,10 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat } switch(DF.type){ case XDGDesktop::APP: - if(!DF.exec.isEmpty()){ + if(!DF.exec.isEmpty()){ cmd = LXDG::getDesktopExec(DF); if(!DF.path.isEmpty()){ path = DF.path; } - }else{ + }else{ qDebug() << "[ERROR] Input *.desktop application file is missing the Exec line:" << inFile; exit(1); } @@ -246,7 +243,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat extension = inFile.section(":",0,0); }else{ qDebug() << "[ERROR] Input *.desktop link file is missing the URL line:" << inFile; - exit(1); + exit(1); } break; case XDGDesktop::DIR: @@ -257,7 +254,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat extension = "directory"; }else{ qDebug() << "[ERROR] Input *.desktop directory file is missing the Path line:" << inFile; - exit(1); + exit(1); } break; default: @@ -283,7 +280,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat int main(int argc, char **argv){ //Run all the actual code in a separate function to have as little memory usage // as possible aside from the main application when running - + //Make sure the XDG environment variables exist first LXDG::setEnvironmentVars(); //now get the command @@ -306,7 +303,7 @@ int main(int argc, char **argv){ qDebug() << "[lumina-open] Application did not startup properly:"<<cmd+" "+args; return p->exitCode(); }else if(p->state() == QProcess::Running){ - //This just missed the "started" signal - continue + //This just missed the "started" signal - continue break; } } @@ -315,16 +312,16 @@ int main(int argc, char **argv){ if(p->state() != QProcess::Running){ break; } //somehow missed the finished signal } int retcode = p->exitCode();*/ - if(retcode!=0){ + if(retcode!=0){ qDebug() << "[lumina-open] Application Error:" << retcode; //Setup the application QApplication App(argc, argv); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - - if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ - langCode.truncate( langCode.indexOf("_") ); + + if(!QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-open_" + langCode + ".qm") ){ + langCode.truncate( langCode.indexOf("_") ); } translator.load( QString("lumina-open_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" ); App.installTranslator( &translator ); diff --git a/lumina-screenshot/lumina-screenshot.pro b/lumina-screenshot/lumina-screenshot.pro index 7b647386..1681a12b 100644 --- a/lumina-screenshot/lumina-screenshot.pro +++ b/lumina-screenshot/lumina-screenshot.pro @@ -2,7 +2,10 @@ QT += core gui TARGET = lumina-screenshot -target.path = /usr/local/bin +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/bin TEMPLATE = app @@ -13,9 +16,9 @@ HEADERS += MainUI.h FORMS += MainUI.ui -INCLUDEPATH += ../libLumina /usr/local/include +INCLUDEPATH += ../libLumina $$PREFIX/include - LIBS += -L../libLumina -lLuminaUtils + LIBS += -L../libLumina -lLuminaUtils freebsd-* { LIBS += -lQtSolutions_SingleApplication-head } @@ -92,10 +95,10 @@ TRANSLATIONS = i18n/lumina-screenshot_af.ts \ i18n/lumina-screenshot_zh_TW.ts \ i18n/lumina-screenshot_zu.ts -dotrans.path=/usr/local/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/Lumina-DE/i18n/ +dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ desktop.files=lumina-screenshot.desktop -desktop.path=/usr/local/share/applications/ +desktop.path=$$PREFIX/share/applications/ INSTALLS += target dotrans desktop diff --git a/lumina-screenshot/main.cpp b/lumina-screenshot/main.cpp index 12258548..40d7242d 100644 --- a/lumina-screenshot/main.cpp +++ b/lumina-screenshot/main.cpp @@ -4,10 +4,7 @@ #include <QFile> #include "MainUI.h" - -#ifndef PREFIX -#define PREFIX QString("/usr/local") -#endif +#include "../global.h" int main(int argc, char ** argv) { @@ -16,12 +13,12 @@ int main(int argc, char ** argv) QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); - + if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-screenshot_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("lumina-screenshot_") + langCode, PREFIX + "/share/i18n/Lumina-DE/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; - + MainUI w; w.show(); |