diff options
author | Ken Moore <ken@pcbsd.org> | 2014-10-10 15:10:19 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2014-10-10 15:10:19 -0400 |
commit | f936d7d555972bb0f60d4f217356d7e43f231580 (patch) | |
tree | 87b602ce714d18b3230398b28d2f1b8def43512b /lumina-desktop | |
parent | Make sure the directory catch for running lumina-fm happens at the end (in ca... (diff) | |
download | lumina-f936d7d555972bb0f60d4f217356d7e43f231580.tar.gz lumina-f936d7d555972bb0f60d4f217356d7e43f231580.tar.bz2 lumina-f936d7d555972bb0f60d4f217356d7e43f231580.zip |
Large update to the Lumina project: provide full theming capabilities.
1) New libLumina classes: LuminaThemes.h
2) Single-line usage to add lumina theme usage to an application (already added to all the Lumina utilities)
3) Include a Lumina-default theme template, as well as a single color scheme (will add more later)
4) Will create a global Qt style for "lumina" so that this theme engine can be automatically applied to all Qt applications at a later date (want to make sure to beat this up and get it working reliably before turning it on for everything).
Major Features:
1) Full Qt theme capabilities through Qt stylesheets (so they can be modified and applied on the fly).
2) Stylesheets are broken into a couple pieces: an "incomplete" stylesheet file (the theme template) with variables in place of colors, font size, and font family. A "color" file which variable->value definitions for the different colors. And a themesettings.cfg files which keeps track of the files/font settings.
3) Along with this, add the ability to specify the icon theme that is used as well, and make that automatically re-loaded as necessary.
4) Add the ability to read/set thes values in lumina-config. The lumina-config usage is still a bit rough: working on cleaning it up right now.
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktop.cpp | 1 | ||||
-rw-r--r-- | lumina-desktop/LSession.cpp | 24 | ||||
-rw-r--r-- | lumina-desktop/LSession.h | 5 | ||||
-rw-r--r-- | lumina-desktop/main.cpp | 2 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.cpp | 8 |
5 files changed, 13 insertions, 27 deletions
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index b230d375..9751c487 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -48,6 +48,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) ); + bgDesktop->setStyleSheet( "QMdiArea{ border: none; }" ); //Start the update processes QTimer::singleShot(1,this, SLOT(UpdateMenu()) ); diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 95272954..055c0a69 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -36,7 +36,7 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){ this->setEffectEnabled( Qt::UI_AnimateMenu, true); this->setEffectEnabled( Qt::UI_AnimateCombo, true); this->setEffectEnabled( Qt::UI_AnimateTooltip, true); - this->setStyle( new MenuProxyStyle); //QMenu icon size override + //this->setStyle( new MenuProxyStyle); //QMenu icon size override //LuminaSessionTrayID = 0; } @@ -55,8 +55,6 @@ LSession::~LSession(){ void LSession::setupSession(){ qDebug() << "Initializing Session"; - //Load the stylesheet - loadStyleSheet(); //Setup the QSettings default paths QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); sessionsettings = new QSettings("LuminaDE", "sessionsettings"); @@ -159,8 +157,7 @@ void LSession::launchStartupApps(){ void LSession::watcherChange(QString changed){ qDebug() << "Session Watcher Change:" << changed; - if(changed.endsWith("stylesheet.qss")){ loadStyleSheet(); } - else if(changed.endsWith("fluxbox-init") || changed.endsWith("fluxbox-keys")){ refreshWindowManager(); } + if(changed.endsWith("fluxbox-init") || changed.endsWith("fluxbox-keys")){ refreshWindowManager(); } else{ emit DesktopConfigChanged(); } } @@ -199,6 +196,7 @@ void LSession::checkUserFiles(){ else if(!QFile::exists(dset+"fluxbox-keys")){fluxcopy=true; } else if(oldversion < 60){ fluxcopy=true; qDebug() << "Current fluxbox settings obsolete: Re-implementing defaults"; } if(fluxcopy){ + qDebug() << "Copying default fluxbox configuration files"; if(QFile::exists(dset+"fluxbox-init")){ QFile::remove(dset+"fluxbox-init"); } if(QFile::exists(dset+"fluxbox-keys")){ QFile::remove(dset+"fluxbox-keys"); } QFile::copy(":/fluxboxconf/fluxbox-init-rc", dset+"fluxbox-init"); @@ -217,22 +215,6 @@ void LSession::checkUserFiles(){ sessionsettings->setValue("DesktopVersion", this->applicationVersion()); } -void LSession::loadStyleSheet(){ - QString ss = QDir::homePath()+"/.lumina/stylesheet.qss"; - if(!QFile::exists(ss)){ ss = LOS::LuminaShare()+"stylesheet.qss"; } - if(!QFile::exists(ss)){ return; } //no default stylesheet on the system - //Now read/apply the custom stylesheet - QFile file(ss); - if( file.open(QIODevice::ReadOnly | QIODevice::Text) ){ - QTextStream in(&file); - QString sheet = in.readAll(); - file.close(); - //Now fix/apply the sheet - sheet.replace("\n"," "); //make sure there are no newlines - this->setStyleSheet(sheet); - } -} - void LSession::refreshWindowManager(){ WM->updateWM(); } diff --git a/lumina-desktop/LSession.h b/lumina-desktop/LSession.h index 3f3d31f9..cdf0cbd8 100644 --- a/lumina-desktop/LSession.h +++ b/lumina-desktop/LSession.h @@ -34,13 +34,13 @@ //#define SYSTEM_TRAY_BEGIN_MESSAGE 1 //#define SYSTEM_TRAY_CANCEL_MESSAGE 2 -class MenuProxyStyle : public QProxyStyle{ +/*class MenuProxyStyle : public QProxyStyle{ public: int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const{ if(metric==PM_SmallIconSize){ return 22; } //override QMenu icon size (make it larger) else{ return QProxyStyle::pixelMetric(metric, option, widget); } //use the current style for everything else } -}; +};*/ class LSession : public QApplication{ Q_OBJECT @@ -79,7 +79,6 @@ private slots: //Internal simplification functions void checkUserFiles(); - void loadStyleSheet(); void refreshWindowManager(); void updateDesktops(); diff --git a/lumina-desktop/main.cpp b/lumina-desktop/main.cpp index 690ae80d..fa23680b 100644 --- a/lumina-desktop/main.cpp +++ b/lumina-desktop/main.cpp @@ -20,6 +20,7 @@ #include "Globals.h" #include <LuminaXDG.h> //from libLuminaUtils +#include <LuminaThemes.h> QFile logfile(QDir::homePath()+"/.lumina/logs/runtime.log"); void MessageOutput(QtMsgType type, const char *msg){ @@ -62,6 +63,7 @@ int main(int argc, char ** argv) logfile.open(QIODevice::WriteOnly | QIODevice::Append); //Startup the Application LSession a(argc, argv); + LuminaThemeEngine theme(&a); //Setup Log File qInstallMsgHandler(MessageOutput); a.setupSession(); diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index e581e1c2..ef5f271c 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -278,9 +278,11 @@ void UserWidget::slotOpenDir(){ void UserWidget::mouseMoveEvent( QMouseEvent *event){ QTabBar *wid = tabBar(); - qDebug() << "Mouse Move Event:"; - if(wid && wid->tabAt(event->pos()) != -1){ + if(wid==0){ return; } //invalid widget found + QPoint relpos = wid->mapFromGlobal( this->mapToGlobal(event->pos()) ); + //qDebug() << "Mouse Move Event: " << event->pos().x() << event->pos().y() << relpos.x() << relpos.y() << wid->width() << wid->height(); + if(wid && wid->tabAt(relpos) != -1){ qDebug() << " - Mouse over tab"; - this->setCurrentIndex( wid->tabAt(event->pos()) ); + this->setCurrentIndex( wid->tabAt(relpos) ); } }
\ No newline at end of file |