aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-desktop/AppMenu.cpp7
-rw-r--r--lumina-desktop/LDesktop.cpp123
-rw-r--r--lumina-desktop/LDesktop.h4
-rw-r--r--lumina-desktop/LPanel.cpp5
-rw-r--r--lumina-desktop/LSession.cpp60
-rw-r--r--lumina-desktop/LSession.h24
-rw-r--r--lumina-desktop/SettingsMenu.cpp14
-rw-r--r--lumina-desktop/SettingsMenu.h1
-rw-r--r--lumina-desktop/SystemWindow.cpp4
-rw-r--r--lumina-desktop/WMProcess.cpp2
-rw-r--r--lumina-desktop/desktop-plugins/LDPluginContainer.h6
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp16
-rw-r--r--lumina-desktop/main.cpp13
-rw-r--r--lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp2
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp4
15 files changed, 199 insertions, 86 deletions
diff --git a/lumina-desktop/AppMenu.cpp b/lumina-desktop/AppMenu.cpp
index da1f43c9..590cf35b 100644
--- a/lumina-desktop/AppMenu.cpp
+++ b/lumina-desktop/AppMenu.cpp
@@ -15,8 +15,6 @@ AppMenu::AppMenu(QWidget* parent) : QMenu(parent){
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherUpdate()) );
QTimer::singleShot(200, this, SLOT(start()) ); //Now start filling the menu
- this->setTitle(tr("Applications"));
- this->setIcon( LXDG::findIcon("system-run","") );
}
AppMenu::~AppMenu(){
@@ -90,6 +88,8 @@ void AppMenu::updateAppList(){
// PRIVATE SLOTS
//=================
void AppMenu::start(){
+ this->setTitle(tr("Applications"));
+ this->setIcon( LXDG::findIcon("system-run","") );
//Setup the watcher
watcher->addPaths(LXDG::systemApplicationDirs());
//Now fill the menu the first time
@@ -109,12 +109,11 @@ void AppMenu::launchControlPanel(){
}
void AppMenu::launchFileManager(){
- QString fm = LSession::sessionSettings()->value("default-filemanager","lumina-fm").toString();
+ QString fm = LSession::handle()->sessionSettings()->value("default-filemanager","lumina-fm").toString();
LSession::LaunchApplication(fm);
}
void AppMenu::launchApp(QAction *act){
QString appFile = act->whatsThis();
LSession::LaunchApplication("lumina-open \""+appFile+"\"");
- //QProcess::startDetached("lumina-open \""+appFile+"\"");
}
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 7988d6b8..556b4560 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -16,35 +16,38 @@ LDesktop::LDesktop(int deskNum) : QObject(){
DPREFIX = "desktop-"+QString::number(deskNum)+"/";
desktopnumber = deskNum;
desktop = QApplication::desktop();
- connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
+ //connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
defaultdesktop = (desktop->screenGeometry(desktopnumber).x()==0);
desktoplocked = true;
- issyncing = false;
- qDebug() << "Desktop #"<<deskNum<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height();
+ issyncing = bgupdating = deskupdating = false;
+ /*qDebug() << "Desktop #"<<deskNum<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height();
deskMenu = new QMenu(0);
connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
winMenu = new QMenu(0);
winMenu->setTitle(tr("Window List"));
- winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );
+ winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );*/
usewinmenu=false;
- connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) );
+ //connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) );
//appmenu = new AppMenu(0);
- workspacelabel = new QLabel(0);
+ /*workspacelabel = new QLabel(0);
workspacelabel->setAlignment(Qt::AlignCenter);
wkspaceact = new QWidgetAction(0);
- wkspaceact->setDefaultWidget(workspacelabel);
+ wkspaceact->setDefaultWidget(workspacelabel);*/
//Setup the internal variables
settings = new QSettings(QSettings::UserScope, "LuminaDE","desktopsettings", this);
//qDebug() << " - Desktop Settings File:" << settings->fileName();
if(!QFile::exists(settings->fileName())){ settings->setValue(DPREFIX+"background/filelist",QStringList()<<"default"); settings->sync(); }
- bgtimer = new QTimer(this);
+ bgWindow = 0;
+ bgDesktop = 0;
+
+ /*bgtimer = new QTimer(this);
bgtimer->setSingleShot(true);
connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) );
watcher = new QFileSystemWatcher(this);
//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);
@@ -55,12 +58,13 @@ LDesktop::LDesktop(int deskNum) : QObject(){
//Make sure the desktop area is transparent to show the background
bgDesktop->setBackground( QBrush(Qt::NoBrush) );
bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" );
-
+
//Start the update processes
QTimer::singleShot(1,this, SLOT(UpdateMenu()) );
QTimer::singleShot(1,this, SLOT(UpdateBackground()) );
QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
- QTimer::singleShot(10,this, SLOT(UpdatePanels()) );
+ QTimer::singleShot(10,this, SLOT(UpdatePanels()) );*/
+ QTimer::singleShot(1,this, SLOT(InitDesktop()) );
}
@@ -78,28 +82,28 @@ int LDesktop::Screen(){
}
void LDesktop::show(){
- bgWindow->show();
- bgDesktop->show();
+ if(bgWindow!=0){ bgWindow->show(); }
+ if(bgDesktop!=0){ bgDesktop->show(); }
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->show(); }
}
void LDesktop::hide(){
- bgWindow->hide();
- bgDesktop->hide();
+ if(bgWindow!=0){ bgWindow->hide(); }
+ if(bgDesktop!=0){ bgDesktop->hide(); }
for(int i=0; i<PANELS.length(); i++){ PANELS[i]->hide(); }
}
void LDesktop::SystemLogout(){
- LSession::systemWindow();
+ LSession::handle()->systemWindow();
}
void LDesktop::SystemTerminal(){
- QString term = LSession::sessionSettings()->value("default-terminal","xterm").toString();
+ QString term = LSession::handle()->sessionSettings()->value("default-terminal","xterm").toString();
LSession::LaunchApplication(term);
}
void LDesktop::SystemFileManager(){
- QString fm = LSession::sessionSettings()->value("default-filemanager","lumina-fm").toString();
+ QString fm = LSession::handle()->sessionSettings()->value("default-filemanager","lumina-fm").toString();
LSession::LaunchApplication(fm);
}
@@ -119,6 +123,7 @@ void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){
LDPluginContainer *win = new LDPluginContainer(plug, desktoplocked);
if(desktoplocked){ bgDesktop->addSubWindow(win, Qt::FramelessWindowHint); }
else{ bgDesktop->addSubWindow(win, Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); }
+ win->adjustSize();
win->loadInitialPosition();
win->show();
win->update();
@@ -128,6 +133,47 @@ void LDesktop::CreateDesktopPluginContainer(LDPlugin *plug){
// =====================
// PRIVATE SLOTS
// =====================
+void LDesktop::InitDesktop(){
+ //This is called *once* during the main initialization routines
+ qDebug() << "Init Desktop:" << desktopnumber;
+ connect(desktop, SIGNAL(resized(int)), this, SLOT(UpdateGeometry(int)));
+ qDebug() << "Desktop #"<<desktopnumber<<" -> "<< desktop->screenGeometry(desktopnumber).x() << desktop->screenGeometry(desktopnumber).y() << desktop->screenGeometry(desktopnumber).width() << desktop->screenGeometry(desktopnumber).height();
+ deskMenu = new QMenu(0);
+ connect(deskMenu, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
+ winMenu = new QMenu(0);
+ winMenu->setTitle(tr("Window List"));
+ winMenu->setIcon( LXDG::findIcon("preferences-system-windows","") );
+ connect(winMenu, SIGNAL(triggered(QAction*)), this, SLOT(winClicked(QAction*)) );
+ workspacelabel = new QLabel(0);
+ workspacelabel->setAlignment(Qt::AlignCenter);
+ wkspaceact = new QWidgetAction(0);
+ wkspaceact->setDefaultWidget(workspacelabel);
+ bgtimer = new QTimer(this);
+ bgtimer->setSingleShot(true);
+ connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) );
+ watcher = new QFileSystemWatcher(this);
+ //connect(LSession::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) );
+ watcher->addPath(settings->fileName());
+ connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) );
+
+ bgWindow = new QWidget();
+ bgWindow->setObjectName("bgWindow");
+ bgWindow->setContextMenuPolicy(Qt::CustomContextMenu);
+ LX11::SetAsDesktop(bgWindow->winId());
+ bgWindow->setGeometry(desktop->screenGeometry(desktopnumber));
+ connect(bgWindow, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowMenu()) );
+ bgDesktop = new QMdiArea(bgWindow);
+ //Make sure the desktop area is transparent to show the background
+ bgDesktop->setBackground( QBrush(Qt::NoBrush) );
+ bgDesktop->setStyleSheet( "QMdiArea{ border: none; background: transparent;}" );
+ qDebug() << " - Desktop Init Done:" << desktopnumber;
+ //Start the update processes
+ QTimer::singleShot(1,this, SLOT(UpdateMenu()) );
+ QTimer::singleShot(1,this, SLOT(UpdateBackground()) );
+ QTimer::singleShot(1,this, SLOT(UpdateDesktop()) );
+ QTimer::singleShot(10,this, SLOT(UpdatePanels()) );
+}
+
void LDesktop::SettingsChanged(){
if(changingsettings || issyncing){ return; } //don't refresh for internal modifications to the fil
issyncing = true;
@@ -158,9 +204,9 @@ void LDesktop::UpdateMenu(bool fast){
for(int i=0; i<items.length(); i++){
if(items[i]=="terminal"){ deskMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(SystemTerminal()) ); }
else if(items[i]=="filemanager"){ deskMenu->addAction( LXDG::findIcon("Insight-FileManager",""), tr("Browse System"), this, SLOT(SystemFileManager()) ); }
- else if(items[i]=="applications"){ deskMenu->addMenu( LSession::applicationMenu() ); }
+ else if(items[i]=="applications"){ deskMenu->addMenu( LSession::handle()->applicationMenu() ); }
else if(items[i]=="line"){ deskMenu->addSeparator(); }
- else if(items[i]=="settings"){ deskMenu->addMenu( LSession::settingsMenu() ); }
+ else if(items[i]=="settings"){ deskMenu->addMenu( LSession::handle()->settingsMenu() ); }
else if(items[i]=="windowlist"){ deskMenu->addMenu( winMenu); usewinmenu=true;}
else if(items[i].startsWith("app::::") && items[i].endsWith(".desktop")){
//Custom *.desktop application
@@ -203,9 +249,8 @@ void LDesktop::winClicked(QAction* act){
void LDesktop::UpdateDesktop(){
qDebug() << " - Update Desktop Plugins for screen:" << desktopnumber;
- static bool loading = false;
- if(loading){ return; } //make sure to only run this once
- loading = true;
+ if(deskupdating){ return; } //make sure to only run this once
+ deskupdating = true;
QStringList plugins = settings->value(DPREFIX+"pluginlist", QStringList()).toStringList();
if(defaultdesktop && plugins.isEmpty()){
//plugins << "sample" << "sample" << "sample";
@@ -260,7 +305,7 @@ void LDesktop::UpdateDesktop(){
settings->sync();
changingsettings=false; //finished changing setting
}
- loading = false;
+ deskupdating = false;
}
void LDesktop::ToggleDesktopLock(){
@@ -411,8 +456,7 @@ void LDesktop::UpdateDesktopPluginArea(){
void LDesktop::UpdateBackground(){
//Get the current Background
- static bool bgupdating = false;
- if(bgupdating){ return; } //prevent multiple calls to this at the same time
+ if(bgupdating || bgWindow==0){ return; } //prevent multiple calls to this at the same time
bgupdating = true;
qDebug() << " - Update Desktop Background for screen:" << desktopnumber;
//Get the list of background(s) to show
@@ -422,15 +466,26 @@ void LDesktop::UpdateBackground(){
for(int i=0; i<bgL.length(); i++){
if( (!QFile::exists(bgL[i]) && bgL[i]!="default") || bgL[i].isEmpty()){ bgL.removeAt(i); i--; }
}
+ if(bgL.isEmpty()){ bgL << "default"; } //always fall back on the default
+ //Determine if the background needs to be changed
+ //qDebug() << "BG List:" << bgL << oldBGL << CBG << bgtimer->isActive();
+ if(bgL==oldBGL && !CBG.isEmpty() && bgtimer->isActive()){
+ //No background change scheduled - just update the widget
+ bgWindow->update();
+ bgupdating=false;
+ return;
+ }
+ oldBGL = bgL; //save this for later
//Determine which background to use next
- int index = bgL.indexOf(CBG);
- if( (index < 0) || (index >= bgL.length()-1) ){ index = ( qrand() % bgL.length() ); } //pick a random file
- else{ index++; } //use the next file in the list
- QString bgFile;
- if( bgL.isEmpty() && CBG.isEmpty()){ bgFile = "default"; }
- else if( bgL.isEmpty() && QFile::exists(CBG) ){ bgFile = CBG; }
- else if( bgL.isEmpty() ){ bgFile = "default"; }
- else{ bgFile = bgL[index]; }
+ int index;
+ if(CBG.isEmpty()){ index = ( qrand() % bgL.length() ); } //random first wallpaper
+ else{
+ //Go to the next in the list
+ index = bgL.indexOf(CBG);
+ if(index < 0 || index >= bgL.length()-1){ index = 0; } //if invalid or last item in the list - go to first
+ else{ index++; } //go to next
+ }
+ QString bgFile = bgL[index];
//Save this file as the current background
CBG = bgFile;
//qDebug() << " - Set Background to:" << CBG << index << bgL;
diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h
index 4843808d..65e40322 100644
--- a/lumina-desktop/LDesktop.h
+++ b/lumina-desktop/LDesktop.h
@@ -54,7 +54,8 @@ private:
QString DPREFIX;
int desktopnumber;
//int xoffset;
- bool defaultdesktop, desktoplocked, changingsettings, issyncing, usewinmenu;
+ bool defaultdesktop, desktoplocked, deskupdating, changingsettings, issyncing, usewinmenu, bgupdating;
+ QStringList oldBGL;
QList<LPanel*> PANELS;
QMdiArea *bgDesktop; //desktop widget area
QWidget *bgWindow; //full screen background
@@ -69,6 +70,7 @@ private:
void CreateDesktopPluginContainer(LDPlugin*);
private slots:
+ void InitDesktop();
void SettingsChanged();
void UnlockSettings(){ issyncing=false; }
//Menu functions
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index 905e3b31..138a8d77 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -195,6 +195,7 @@ void LPanel::UpdatePanel(){
}
this->update();
this->show(); //make sure the panel is visible now
+ if(hidden){ this->move(hidepoint); }
//Now go through and send the orientation update signal to each plugin
for(int i=0; i<PLUGINS.length(); i++){
QTimer::singleShot(0,PLUGINS[i], SLOT(OrientationChange()));
@@ -237,7 +238,7 @@ void LPanel::paintEvent(QPaintEvent *event){
}
void LPanel::enterEvent(QEvent *event){
- qDebug() << "Panel Enter Event:";
+ //qDebug() << "Panel Enter Event:";
if(hidden){
//Move the panel out so it is fully available
this->move(showpoint);
@@ -246,7 +247,7 @@ void LPanel::enterEvent(QEvent *event){
}
void LPanel::leaveEvent(QEvent *event){
- qDebug() << "Panel Leave Event:";
+ //qDebug() << "Panel Leave Event:";
if(hidden){
//Move the panel back to it's "hiding" spot
this->move(hidepoint);
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 9680e749..d1bd77c0 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -7,9 +7,6 @@
#include "LSession.h"
#include <LuminaOS.h>
-#include <Phonon/MediaObject>
-#include <Phonon/AudioOutput>
-#include <QThread>
#include <QTime>
//X includes (these need to be last due to Qt compile issues)
@@ -19,14 +16,9 @@
#include <X11/extensions/Xrender.h>
#include <X11/extensions/Xdamage.h>
-//Private/global variables (for static function access)
-static AppMenu *appmenu;
-static SettingsMenu *settingsmenu;
-static QTranslator *currTranslator;
-static Phonon::MediaObject *mediaObj;
-static Phonon::AudioOutput *audioOut;
-static QThread *audioThread;
-static QSettings *sessionsettings;
+#ifndef DEBUG
+#define DEBUG 0
+#endif
LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){
this->setApplicationName("Lumina Desktop Environment");
@@ -41,6 +33,14 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){
SystemTrayID = 0; VisualTrayID = 0;
TrayDmgEvent = 0;
TrayDmgError = 0;
+ //initialize the empty internal pointers to 0
+ appmenu = 0;
+ settingsmenu = 0;
+ currTranslator=0;
+ mediaObj=0;
+ audioOut=0;
+ audioThread=0;
+ sessionsettings=0;
}
LSession::~LSession(){
@@ -52,41 +52,51 @@ LSession::~LSession(){
delete settingsmenu;
delete appmenu;
delete currTranslator;
- delete mediaObj;
- delete audioOut;
+ if(mediaObj!=0){delete mediaObj;}
+ if(audioOut!=0){delete audioOut; }
}
void LSession::setupSession(){
qDebug() << "Initializing Session";
+ QTime* timer = 0;
+ if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();}
//Seed random number generator (if needed)
qsrand( QTime::currentTime().msec() );
//Setup the QSettings default paths
+ if(DEBUG){ qDebug() << " - Init QSettings:" << timer->elapsed();}
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
sessionsettings = new QSettings("LuminaDE", "sessionsettings");
//Setup the user's lumina settings directory as necessary
+ if(DEBUG){ qDebug() << " - Init User Files:" << timer->elapsed();}
checkUserFiles(); //adds these files to the watcher as well
//Initialize the internal variables
DESKTOPS.clear();
-
+
+ //Start the background system tray
+ if(DEBUG){ qDebug() << " - Init System Tray:" << timer->elapsed();}
+ startSystemTray();
+
//Launch Fluxbox
qDebug() << " - Launching Fluxbox";
+ if(DEBUG){ qDebug() << " - Init WM:" << timer->elapsed();}
WM = new WMProcess();
WM->startWM();
- //Start the background system tray
- startSystemTray();
-
//Initialize the desktops
+ if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed();}
updateDesktops();
//Initialize the global menus
qDebug() << " - Initialize system menus";
+ if(DEBUG){ qDebug() << " - Init AppMenu:" << timer->elapsed();}
appmenu = new AppMenu();
+ if(DEBUG){ qDebug() << " - Init SettingsMenu:" << timer->elapsed();}
settingsmenu = new SettingsMenu();
//Now setup the system watcher for changes
qDebug() << " - Initialize file system watcher";
+ if(DEBUG){ qDebug() << " - Init QFileSystemWatcher:" << timer->elapsed();}
watcher = new QFileSystemWatcher(this);
//watcher->addPath( QDir::homePath()+"/.lumina/stylesheet.qss" );
watcher->addPath( QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf" );
@@ -98,6 +108,7 @@ void LSession::setupSession(){
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) );
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange(QString)) );
connect(this, SIGNAL(aboutToQuit()), this, SLOT(SessionEnding()) );
+ if(DEBUG){ qDebug() << " - Init Finished:" << timer->elapsed(); delete timer;}
}
bool LSession::LoadLocale(QString langCode){
@@ -214,8 +225,9 @@ void LSession::refreshWindowManager(){
}
void LSession::updateDesktops(){
- qDebug() << " - Update Desktops";
+ //qDebug() << " - Update Desktops";
QDesktopWidget *DW = this->desktop();
+ bool firstrun = (DESKTOPS.length()==0);
for(int i=0; i<DW->screenCount(); i++){
bool found = false;
for(int j=0; j<DESKTOPS.length() && !found; j++){
@@ -227,15 +239,19 @@ void LSession::updateDesktops(){
DESKTOPS << new LDesktop(i);
}
}
+ //qDebug() << " - Done Starting Desktops";
+ if(firstrun){ return; } //Done right here on first run
//Now go through and make sure to delete any desktops for detached screens
for(int i=0; i<DESKTOPS.length(); i++){
if(DESKTOPS[i]->Screen() >= DW->screenCount()){
qDebug() << " - Hide desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->hide();
}else{
+ qDebug() << " - Show desktop on screen:" << DESKTOPS[i]->Screen();
DESKTOPS[i]->show();
}
}
+ //qDebug() << " - Done Checking Desktops";
}
@@ -350,11 +366,11 @@ void LSession::systemWindow(){
//Play System Audio
void LSession::playAudioFile(QString filepath){
//Setup the audio output systems for the desktop
- return; //Disable this for now: too many issues with Phonon at the moment (hangs the session)
+ //return; //Disable this for now: too many issues with Phonon at the moment (hangs the session)
bool init = false;
if(audioThread==0){ qDebug() << " - Initialize audio systems"; audioThread = new QThread(); init = true; }
if(mediaObj==0){ qDebug() << " - Initialize Phonon media Object"; mediaObj = new Phonon::MediaObject(); init = true;}
- //if(audioOut==0){ qDebug() << " - Initialize Phonon audio output"; audioOut = new Phonon::AudioOutput(); init=true;}
+ if(audioOut==0){ qDebug() << " - Initialize Phonon audio output"; audioOut = new Phonon::AudioOutput(); init=true;}
if(mediaObj && audioOut && init){ //in case Phonon errors for some reason
qDebug() << " -- Create path between audio objects";
Phonon::createPath(mediaObj, audioOut);
@@ -430,7 +446,9 @@ void LSession::attachTrayWindow(WId win){
if(RunningTrayApps.contains(win)){ return; } //already managed
RunningTrayApps << win;
emit TrayListChanged();
- /*//Now try to embed the window into the tray
+ /*//Now try to embed the window into the tray
+ //(NOT USED - Breaks visuals due to X11 graphics constraints - need to do embed in a single visual tray instead)
+
qDebug() << "Attach Tray App:" << appnum;
WId cont = LX11::CreateWindow( SystemTrayID, QRect(appnum*64, 0, 64, 64) );
if( LX11::EmbedWindow(win, cont) ){
diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h
index 3068aac4..8814ca3c 100644
--- a/lumina-desktop/LSession.h
+++ b/lumina-desktop/LSession.h
@@ -18,6 +18,9 @@
#include <QDesktopWidget>
#include <QList>
#include <QThread>
+#include <Phonon/MediaObject>
+#include <Phonon/AudioOutput>
+#include <QThread>
#include "Globals.h"
#include "AppMenu.h"
@@ -66,19 +69,30 @@ public:
}
static void LaunchApplication(QString cmd);
- static AppMenu* applicationMenu();
- static void systemWindow();
- static SettingsMenu* settingsMenu();
+
+ AppMenu* applicationMenu();
+ void systemWindow();
+ SettingsMenu* settingsMenu();
- static QSettings* sessionSettings();
+ QSettings* sessionSettings();
//Play System Audio
- static void playAudioFile(QString filepath);
+ void playAudioFile(QString filepath);
private:
WMProcess *WM;
QList<LDesktop*> DESKTOPS;
QFileSystemWatcher *watcher;
+
+ //Internal variable for global usage
+ AppMenu *appmenu;
+ SettingsMenu *settingsmenu;
+ QTranslator *currTranslator;
+ Phonon::MediaObject *mediaObj;
+ Phonon::AudioOutput *audioOut;
+ QThread *audioThread;
+ QSettings *sessionsettings;
+
//System Tray Variables
WId SystemTrayID, VisualTrayID;
int TrayDmgEvent, TrayDmgError;
diff --git a/lumina-desktop/SettingsMenu.cpp b/lumina-desktop/SettingsMenu.cpp
index 9d369410..0e59d77b 100644
--- a/lumina-desktop/SettingsMenu.cpp
+++ b/lumina-desktop/SettingsMenu.cpp
@@ -10,6 +10,14 @@
#include <LuminaOS.h>
SettingsMenu::SettingsMenu() : QMenu(){
+ QTimer::singleShot(10, this, SLOT(InitMenu()) );
+}
+
+SettingsMenu::~SettingsMenu(){
+
+}
+
+void SettingsMenu::InitMenu(){
this->setTitle( tr("Desktop Settings") );
this->setIcon( LXDG::findIcon("configure","") );
connect(this, SIGNAL(triggered(QAction*)), this, SLOT(runApp(QAction*)) );
@@ -36,11 +44,7 @@ SettingsMenu::SettingsMenu() : QMenu(){
act->setWhatsThis("lumina-open \""+CONTROLPANEL+"\"");
this->addAction(act);
}
- }
-}
-
-SettingsMenu::~SettingsMenu(){
-
+ }
}
void SettingsMenu::runApp(QAction* act){
diff --git a/lumina-desktop/SettingsMenu.h b/lumina-desktop/SettingsMenu.h
index b781124c..9d2d905d 100644
--- a/lumina-desktop/SettingsMenu.h
+++ b/lumina-desktop/SettingsMenu.h
@@ -20,6 +20,7 @@ public:
~SettingsMenu();
private slots:
+ void InitMenu();
void runApp(QAction* act);
};
diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp
index 3e723a36..bec15850 100644
--- a/lumina-desktop/SystemWindow.cpp
+++ b/lumina-desktop/SystemWindow.cpp
@@ -37,8 +37,8 @@ SystemWindow::~SystemWindow(){
}
void SystemWindow::closeAllWindows(){
- if( LSession::sessionSettings()->value("PlayLogoutAudio",true).toBool() ){
- LSession::playAudioFile(LOS::LuminaShare()+"Logout.ogg");
+ if( LSession::handle()->sessionSettings()->value("PlayLogoutAudio",true).toBool() ){
+ LSession::handle()->playAudioFile(LOS::LuminaShare()+"Logout.ogg");
}
QList<WId> WL = LX11::WindowList();
for(int i=0; i<WL.length(); i++){
diff --git a/lumina-desktop/WMProcess.cpp b/lumina-desktop/WMProcess.cpp
index b916cb8a..41cfb2bd 100644
--- a/lumina-desktop/WMProcess.cpp
+++ b/lumina-desktop/WMProcess.cpp
@@ -56,7 +56,7 @@ bool WMProcess::isRunning(){
}
QString WMProcess::setupWM(){
- QString WM = LSession::sessionSettings()->value("WindowManager", "fluxbox").toString();
+ QString WM = LSession::handle()->sessionSettings()->value("WindowManager", "fluxbox").toString();
QString cmd="echo WM Disabled";
//leave the option to add other window managers here (for testing purposes)
if(WM=="openbox"){
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h
index 52e426ba..109083da 100644
--- a/lumina-desktop/desktop-plugins/LDPluginContainer.h
+++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h
@@ -39,8 +39,10 @@ public:
if(settings->allKeys().isEmpty()){
//Brand new plugin - no location/size info saved yet
//save the initial size of the plugin - the initial location will be set automatically
- settings->setValue("location/width", plugin->sizeHint().width());
- settings->setValue("location/height", plugin->sizeHint().height());
+ QSize sz = plugin->sizeHint();
+ if(!sz.isValid()){ sz = QSize(64,64); }
+ settings->setValue("location/width", sz.width());
+ settings->setValue("location/height", sz.height());
settings->sync();
}
this->setContentsMargins(0,0,0,0);
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index 32937ad4..9ed9e735 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -2,14 +2,22 @@
#include "../../LSession.h"
AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
- this->setLayout( new QVBoxLayout());
- this->layout()->setContentsMargins(0,0,0,0);
+ QVBoxLayout *lay = new QVBoxLayout();
+ this->setLayout(lay);
+ lay->setContentsMargins(0,0,0,0);
button = new QToolButton(this);
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setIconSize(QSize(64,64));
button->setAutoRaise(true);
- this->layout()->addWidget(button);
+ button->setText("..."); //Need to set something here so that initial sizing works properly
+ lay->addWidget(button, 0, Qt::AlignCenter);
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ if(this->settings->allKeys().isEmpty()){
+ //Brand new plugin: set initial size
+ this->settings->setValue("location/width",64);
+ this->settings->setValue("location/height",66+this->fontMetrics().height());
+ this->settings->sync();
+ }
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) );
QTimer::singleShot(1,this, SLOT(loadButton()) );
@@ -33,6 +41,8 @@ void AppLauncherPlugin::loadButton(){
if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
watcher->addPath(file.filePath); //make sure to update this shortcut if the file changes
}
+ this->adjustSize(); //make sure to adjust the button on first show.
+ QTimer::singleShot(100, this, SLOT(update()) ); //Make sure to re-draw the image in a moment
}
void AppLauncherPlugin::buttonClicked(){
diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp
index 5ebe6bee..8c99a902 100644
--- a/lumina-desktop/main.cpp
+++ b/lumina-desktop/main.cpp
@@ -23,6 +23,8 @@
#include <LuminaThemes.h>
#include <LuminaOS.h>
+#define DEBUG 0
+
QFile logfile(QDir::homePath()+"/.lumina/logs/runtime.log");
void MessageOutput(QtMsgType type, const char *msg){
QString txt;
@@ -66,18 +68,23 @@ int main(int argc, char ** argv)
dir.mkpath(QDir::homePath()+"/.lumina/logs");
}
logfile.open(QIODevice::WriteOnly | QIODevice::Append);
+ QTime *timer=0;
+ if(DEBUG){ timer = new QTime(); timer->start(); }
//Startup the Application
+ if(DEBUG){ qDebug() << "Session Init:" << timer->elapsed(); }
LSession a(argc, argv);
+ if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); }
LuminaThemeEngine theme(&a);
//Setup Log File
qInstallMsgHandler(MessageOutput);
+ if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); }
a.setupSession();
+ if(DEBUG){ qDebug() << "Load Locale:" << timer->elapsed(); }
a.LoadLocale(QLocale().name());
//Start launching external applications
- QTimer::singleShot(1000, &a, SLOT(launchStartupApps()) ); //wait a second first
- //QTimer::singleShot(1000, &a, SLOT(playStartupAudio()) );
+ QTimer::singleShot(2000, &a, SLOT(launchStartupApps()) ); //wait a second first
+ if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;}
int retCode = a.exec();
- //a.playLogoutAudio();
//qDebug() << "Stopping the window manager";
qDebug() << "Finished Closing Down Lumina";
logfile.close();
diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
index 6314a9eb..787ad0f0 100644
--- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
+++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp
@@ -158,5 +158,5 @@ QString LSysMenuQuick::getRemainingTime(){
void LSysMenuQuick::startLogout(){
emit CloseMenu();
- LSession::systemWindow();
+ LSession::handle()->systemWindow();
}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index ef5f271c..4c2f00d9 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -13,7 +13,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
ui->setupUi(this);
if(parent!=0){ parent->setMouseTracking(true); }
this->setMouseTracking(true);
- sysapps = LSession::applicationMenu()->currentAppHash(); //get the raw info
+ sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info
//Setup the Icons
// - favorites tab
this->setTabIcon(0, rotateIcon(LXDG::findIcon("favorites","")) );
@@ -125,7 +125,7 @@ void UserWidget::UpdateMenu(){
updateFavItems();
ui->label_home_dir->setWhatsThis(QDir::homePath());
updateHome();
- if(lastUpdate < LSession::applicationMenu()->lastHashUpdate || lastUpdate.isNull()){
+ if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull()){
updateAppCategories();
updateApps();
}
bgstack15