aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop')
-rw-r--r--lumina-desktop/AppMenu.cpp11
-rw-r--r--lumina-desktop/Globals.h15
-rw-r--r--lumina-desktop/LDesktop.cpp43
-rw-r--r--lumina-desktop/LSession.cpp31
-rw-r--r--lumina-desktop/Lumina-DE.desktop4
-rw-r--r--lumina-desktop/SystemWindow.cpp5
-rw-r--r--lumina-desktop/lumina-desktop.pro19
-rw-r--r--lumina-desktop/main.cpp5
-rw-r--r--lumina-desktop/panel-plugins/battery/LBattery.cpp2
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h11
10 files changed, 76 insertions, 70 deletions
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/Lumina-DE.desktop b/lumina-desktop/Lumina-DE.desktop
index 49b012b6..ca043ab4 100644
--- a/lumina-desktop/Lumina-DE.desktop
+++ b/lumina-desktop/Lumina-DE.desktop
@@ -1,6 +1,6 @@
[Desktop Entry]
-Exec=/usr/local/bin/Lumina-DE
-TryExec=/usr/local/bin/Lumina-DE
+Exec=Lumina-DE
+TryExec=Lumina-DE
Icon=/usr/local/share/pixmaps/Lumina-DE.png
Type=Application
Name=Lumina
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
bgstack15