diff options
-rw-r--r-- | libLumina/LuminaThemes.cpp | 73 | ||||
-rw-r--r-- | libLumina/LuminaThemes.h | 12 | ||||
-rw-r--r-- | libLumina/libLumina.pro | 2 | ||||
-rw-r--r-- | libLumina/themes/SampleTheme.qss.template | 64 | ||||
-rw-r--r-- | lumina-config/main.cpp | 3 | ||||
-rw-r--r-- | lumina-config/mainUI.cpp | 61 | ||||
-rw-r--r-- | lumina-config/mainUI.h | 5 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 139 | ||||
-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 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 4 | ||||
-rw-r--r-- | lumina-fm/main.cpp | 6 | ||||
-rw-r--r-- | lumina-open/main.cpp | 3 | ||||
-rw-r--r-- | lumina-screenshot/MainUI.cpp | 16 | ||||
-rw-r--r-- | lumina-screenshot/MainUI.h | 3 | ||||
-rw-r--r-- | lumina-screenshot/main.cpp | 3 | ||||
-rw-r--r-- | port-files/pkg-plist | 2 |
20 files changed, 293 insertions, 143 deletions
diff --git a/libLumina/LuminaThemes.cpp b/libLumina/LuminaThemes.cpp index 5100a084..8548f739 100644 --- a/libLumina/LuminaThemes.cpp +++ b/libLumina/LuminaThemes.cpp @@ -9,6 +9,7 @@ #include "LuminaUtils.h" #include "LuminaOS.h" #include <QIcon> +#include <QFont> #include <QDebug> @@ -65,11 +66,15 @@ QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item } } //Now get all the icon themes in these directories - QStringList themes; + QStringList themes, tmpthemes; QDir dir; for(int i=0; i<paths.length(); i++){ if(dir.cd(paths[i])){ - themes << dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + tmpthemes = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); + for(int j=0; j<tmpthemes.length(); j++){ + if(tmpthemes[j].startsWith("default")){ continue; } + if(QFile::exists(dir.absoluteFilePath(tmpthemes[j]+"/index.theme")) ){ themes << tmpthemes[j]; } + } } } themes.removeDuplicates(); @@ -77,36 +82,61 @@ QStringList LTHEME::availableSystemIcons(){ //returns: [name] for each item return themes; } - //Return the currently selected Theme/Colors/Icons -QStringList LTHEME::currentSettings(){ //returns [theme path, colorspath, iconsname] - QStringList out; out << "" << "" << ""; +//Save a new theme/color file +bool LTHEME::saveLocalTheme(QString name, QStringList contents){ + QString localdir = QDir::homePath()+"/.lumina/themes/"; + if(!QFile::exists(localdir)){ QDir dir(); dir.mkpath(localdir); } + return LUtils::writeFile(localdir+name+".qss.template", contents, true); +} + +bool LTHEME::saveLocalColors(QString name, QStringList contents){ + QString localdir = QDir::homePath()+"/.lumina/colors/"; + if(!QFile::exists(localdir)){ QDir dir(); dir.mkpath(localdir); } + return LUtils::writeFile(localdir+name+".qss.colors", contents, true); +} + +//Return the currently selected Theme/Colors/Icons +QStringList LTHEME::currentSettings(){ //returns [theme path, colorspath, iconsname, font, fontsize] + QStringList out; out << "" << "" << "" << "" << ""; QStringList settings = LUtils::readFile(QDir::homePath()+"/.lumina/themesettings.cfg"); for(int i=0; i<settings.length(); i++){ if(settings[i].startsWith("THEMEFILE=")){ out[0] = settings[i].section("=",1,1).simplified(); } else if(settings[i].startsWith("COLORFILE=")){ out[1] = settings[i].section("=",1,1).simplified(); } + else if(settings[i].startsWith("ICONTHEME=")){ out[2] = settings[i].section("=",1,1).simplified(); } + else if(settings[i].startsWith("FONTFAMILY=")){ out[3] = settings[i].section("=",1,1).simplified(); } + else if(settings[i].startsWith("FONTSIZE=")){ out[4] = settings[i].section("=",1,1).simplified(); } } - out[2] = QIcon::themeName(); bool nofile = settings.isEmpty(); - if(out[0].isEmpty()){ out[0] = LOS::LuminaShare()+"themes/SampleTheme.qss.template"; } + if(out[0].isEmpty()){ out[0] = LOS::LuminaShare()+"themes/Lumina-default.qss.template"; } if(out[1].isEmpty()){ out[1] = LOS::LuminaShare()+"colors/SampleColors.qss.colors"; } - if(nofile){ setCurrentSettings(out[0], out[1], out[2]); } + if(out[3].isEmpty()){ out[3] = QFont().defaultFamily(); } + if(out[4].isEmpty()){ + int num = QFont().pointSize(); out[4] = QString::number(num)+"pt"; //Check point size first + if(num<0){ num = QFont().pixelSize(); out[4] = QString::number(num)+"px";} //Now check pixel size + if(num<0){ out[4] = "9pt"; } //Now hard-code a fallback (just in case) + } + if(nofile){ setCurrentSettings(out[0], out[1], out[2], out[3], out[4]); } return out; } //Change the current Theme/Colors/Icons -bool LTHEME::setCurrentSettings(QString themepath, QString colorpath, QString iconname){ +bool LTHEME::setCurrentSettings(QString themepath, QString colorpath, QString iconname, QString font, QString fontsize){ + QIcon::setThemeName(iconname); + //Now save the theme settings file QStringList contents; contents << "THEMEFILE="+themepath; contents << "COLORFILE="+colorpath; contents << "ICONTHEME="+iconname; + contents << "FONTFAMILY="+font; + contents << "FONTSIZE="+fontsize; bool ok = LUtils::writeFile(QDir::homePath()+"/.lumina/themesettings.cfg", contents, true); - QIcon::setThemeName(iconname); + return ok; } //Return the complete stylesheet for a given theme/colors -QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath){ +QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize){ QString stylesheet = LUtils::readFile(themepath).join("\n"); QStringList colors = LUtils::readFile(colorpath); //qDebug() << "Found Theme:" << themepath << stylesheet; @@ -126,6 +156,8 @@ QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath){ else if(colors[i].startsWith("TEXTCOLOR=")){ stylesheet = stylesheet.replace("%%TEXTCOLOR%%", colors[i].section("=",1,1).simplified()); } else if(colors[i].startsWith("TEXTHIGHLIGHTCOLOR=")){ stylesheet = stylesheet.replace("%%TEXTHIGHLIGHTCOLOR%%", colors[i].section("=",1,1).simplified()); } } + stylesheet = stylesheet.replace("%%FONT%%", font); + stylesheet = stylesheet.replace("%%FONTSIZE%%", fontsize); //qDebug() << "Assembled Style Sheet:\n" << stylesheet; return stylesheet; } @@ -135,9 +167,15 @@ QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath){ //================== LuminaThemeEngine::LuminaThemeEngine(QApplication *app){ application=app; //save this pointer for later + //Make sure to prefer font antialiasing on the application + QFont tmp = application->font(); + tmp.setStyleStrategy(QFont::PreferAntialias); + application->setFont(tmp); + // Now load the theme stylesheet QStringList current = LTHEME::currentSettings(); - theme = current[0]; colors=current[1]; icons=current[2]; - application->setStyleSheet( LTHEME::assembleStyleSheet(theme, colors) ); + theme = current[0]; colors=current[1]; icons=current[2]; font=current[3]; fontsize=current[4]; + application->setStyleSheet( LTHEME::assembleStyleSheet(theme, colors, font, fontsize) ); + QIcon::setThemeName(icons); //make sure this sets set within this environment watcher = new QFileSystemWatcher(this); watcher->addPath( QDir::homePath()+"/.lumina/themesettings.cfg" ); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange()) ); @@ -149,12 +187,13 @@ LuminaThemeEngine::~LuminaThemeEngine(){ void LuminaThemeEngine::watcherChange(){ QStringList current = LTHEME::currentSettings(); - if(theme!=current[0] || colors!=current[1]){ - application->setStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1]) ); + if(theme!=current[0] || colors!=current[1] || font!=current[3] || fontsize!=current[4]){ + application->setStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1], current[3], current[4]) ); } - if(icons!=current[3]){ + if(icons!=current[2]){ + QIcon::setThemeName(current[2]); //make sure this sets set within this environment emit updateIcons(); } //Now save this for later checking - theme = current[0]; colors=current[1]; icons=current[2]; + theme = current[0]; colors=current[1]; icons=current[2]; font=current[3]; fontsize=current[4]; } diff --git a/libLumina/LuminaThemes.h b/libLumina/LuminaThemes.h index 1026622b..e4bbd208 100644 --- a/libLumina/LuminaThemes.h +++ b/libLumina/LuminaThemes.h @@ -26,14 +26,18 @@ public: static QStringList availableLocalColors(); //returns: [name::::path] for each item static QStringList availableSystemIcons(); //returns: [name] for each item + //Save a new theme/color file + static bool saveLocalTheme(QString name, QStringList contents); + static bool saveLocalColors(QString name, QStringList contents); + //Return the currently selected Theme/Colors/Icons - static QStringList currentSettings(); //returns [theme path, colorspath, iconsname] + static QStringList currentSettings(); //returns [theme path, colorspath, iconsname, font, fontsize] //Change the current Theme/Colors/Icons - static bool setCurrentSettings(QString themepath, QString colorpath, QString iconname); + static bool setCurrentSettings(QString themepath, QString colorpath, QString iconname, QString font, QString fontsize); //Return the complete stylesheet for a given theme/colors - static QString assembleStyleSheet(QString themepath, QString colorpath); + static QString assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize); }; @@ -58,7 +62,7 @@ public: private: QApplication *application; QFileSystemWatcher *watcher; - QString theme,colors,icons; //current settings + QString theme,colors,icons, font, fontsize; //current settings private slots: void watcherChange(); diff --git a/libLumina/libLumina.pro b/libLumina/libLumina.pro index 97ebb799..cb89e7ca 100644 --- a/libLumina/libLumina.pro +++ b/libLumina/libLumina.pro @@ -52,7 +52,7 @@ colors.path=$$PREFIX/share/Lumina-DE/colors/ colors.files=colors/SampleColors.qss.colors themes.path=$$PREFIX/share/Lumina-DE/themes/ -themes.files=themes/SampleTheme.qss.template +themes.files=themes/Lumina-default.qss.template INSTALLS += target include colors themes diff --git a/libLumina/themes/SampleTheme.qss.template b/libLumina/themes/SampleTheme.qss.template deleted file mode 100644 index b60fbf5a..00000000 --- a/libLumina/themes/SampleTheme.qss.template +++ /dev/null @@ -1,64 +0,0 @@ -QWidget{ color: %%TEXTCOLOR%%; } -QWidget#page_browser,#page_audioPlayer,#page_zfs,#page_image_view{background: -qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, -stop: 0 %%ACCENTCOLOR%%, -stop: 1 %%PRIMARYCOLOR%%); -} -QMainWindow, QMenu{ background: %%BASECOLOR%%; } -QMenuBar, QMenuBar::item, QToolBar{ background: transparent; } -QMenuBar::item:selected, QMenuBar::item:pressed, QMenu::item:selected{ background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, -stop: 0 %%ACCENTCOLOR%%, -stop: 1 %%HIGHLIGHTCOLOR%%); -color: %%TEXTHIGHLIGHTCOLOR%%; -} -QMenu::item{ background: transparent; border: none; color: %%TEXTCOLOR%%; padding: 2px 25px 2px 20px;} -QMenu::indicator{ width: 14px; height: 14px; } - - QMenu::indicator:non-exclusive:unchecked { - image: url(:/trolltech/styles/commonstyle/images/standardbutton-no-16.png); - } - - QMenu::indicator:non-exclusive:unchecked:selected { - image: url(:/trolltech/styles/commonstyle/images/standardbutton-no-16.png); - } - - QMenu::indicator:non-exclusive:checked { - image: url(:/trolltech/styles/commonstyle/images/standardbutton-yes-16.png); - } - - QMenu::indicator:non-exclusive:checked:selected { - image: url(:/trolltech/styles/commonstyle/images/standardbutton-yes-16.png); - } - - QTabBar::tab { - background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, -stop: 0 %%SECONDARYDISABLECOLOR%%, -stop: 1 %%SECONDARYCOLOR%%); - border-top-left-radius: 4px; - border-top-right-radius: 4px; - min-width: 8ex; - padding: 2px; - } - - QTabBar::tab:selected{ - background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, -stop: 0 %%ACCENTDISABLECOLOR%%, -stop: 1 %%HIGHLIGHTCOLOR%%); - } -QTabBar::tab:hover { - background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, -stop: 0 %%ACCENTDISABLECOLOR%%, -stop: 1 %%HIGHLIGHTDISABLECOLOR%%); - } - - QTabBar::tab:!selected { - margin-top: 2px; /* make non-selected tabs look smaller */ - } - -QToolTip{ - background: %%BASECOLOR%%; - border: 1px solid %%PRIMARYDISABLECOLOR%%; - border-radius: 2px; - padding: 1px; - color: %%TEXTCOLOR%%; -}
\ No newline at end of file diff --git a/lumina-config/main.cpp b/lumina-config/main.cpp index 415a3c85..27af600d 100644 --- a/lumina-config/main.cpp +++ b/lumina-config/main.cpp @@ -9,6 +9,7 @@ #include "mainUI.h" #include <LuminaOS.h> +#include <LuminaThemes.h> int main(int argc, char ** argv) { @@ -19,6 +20,7 @@ int main(int argc, char ** argv) if( a.isRunning() ) return !(a.sendMessage("show")); #endif + LuminaThemeEngine theme(&a); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); @@ -31,6 +33,7 @@ int main(int argc, char ** argv) MainUI w; QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance()) ); + QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); int retCode = a.exec(); diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index df4b4d11..b9c83f42 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -118,6 +118,8 @@ void MainUI::setupIcons(){ ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") ); ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") ); ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") ); + ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); + ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") ); } @@ -198,6 +200,12 @@ void MainUI::setupConnections(){ connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) ); + connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->combo_session_icontheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); + } void MainUI::setupMenus(){ @@ -1365,6 +1373,51 @@ void MainUI::loadSessionSettings(){ ui->check_session_playloginaudio->setChecked( sessionsettings->value("PlayStartupAudio",true).toBool() ); ui->check_session_playlogoutaudio->setChecked( sessionsettings->value("PlayLogoutAudio",true).toBool() ); + //Now do the session theme options + ui->combo_session_themefile->clear(); + ui->combo_session_colorfile->clear(); + ui->combo_session_icontheme->clear(); + QStringList current = LTHEME::currentSettings(); + // - local theme templates + QStringList tmp = LTHEME::availableLocalThemes(); + tmp.sort(); + for(int i=0; i<tmp.length(); i++){ + ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); + if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(i); } + } + // - system theme templates + tmp = LTHEME::availableSystemThemes(); + tmp.sort(); + for(int i=0; i<tmp.length(); i++){ + ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); + if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(i); } + } + // - local color schemes + tmp = LTHEME::availableLocalColors(); + tmp.sort(); + for(int i=0; i<tmp.length(); i++){ + ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); + if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(i); } + } + // - system color schemes + tmp = LTHEME::availableSystemColors(); + tmp.sort(); + for(int i=0; i<tmp.length(); i++){ + ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); + if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(i); } + } + // - icon themes + tmp = LTHEME::availableSystemIcons(); + tmp.sort(); + for(int i=0; i<tmp.length(); i++){ + ui->combo_session_icontheme->addItem(tmp[i]); + if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); } + } + // - Font + ui->font_session_theme->setCurrentFont( QFont(current[3]) ); + // - Font Size + ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() ); + sessionstartchanged(); //make sure to update buttons } @@ -1407,6 +1460,14 @@ void MainUI::saveSessionSettings(){ sessionsettings->setValue("EnableNumlock", ui->check_session_numlock->isChecked()); sessionsettings->setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked()); sessionsettings->setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked()); + + //Now do the theme options + QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); + QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); + QString iconset = ui->combo_session_icontheme->currentText(); + QString font = ui->font_session_theme->currentFont().family(); + QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; + LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); } void MainUI::rmsessionstartitem(){ diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index d40438db..038651d7 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -21,6 +21,7 @@ // libLumina includes #include <LuminaXDG.h> +#include <LuminaThemes.h> // local includes #include "LPlugins.h" @@ -52,7 +53,6 @@ private: int panelnumber; //General purpose functions (not connected to buttons) - void setupIcons(); //called during initialization void setupMenus(); //called during initialization void setupConnections(); //called during intialization @@ -73,6 +73,9 @@ private: QStringList readFile(QString path); bool overwriteFile(QString path, QStringList contents); +public slots: + void setupIcons(); //called during initialization + private slots: void slotSingleInstance(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index 7dd97862..7f8f2ae8 100644 --- a/lumina-config/mainUI.ui +++ b/lumina-config/mainUI.ui @@ -87,14 +87,11 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="styleSheet"> - <string notr="true">QWidget#page_desktop,#page_panels,#page_menu,#page_shortcuts,#page_defaults,#page_session{background-color: rgba(255,255,255,150); }</string> - </property> <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> <property name="currentIndex"> - <number>2</number> + <number>5</number> </property> <widget class="QWidget" name="page_desktop"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -372,8 +369,8 @@ <rect> <x>0</x> <y>0</y> - <width>166</width> - <height>92</height> + <width>157</width> + <height>90</height> </rect> </property> <attribute name="label"> @@ -454,8 +451,8 @@ <rect> <x>0</x> <y>0</y> - <width>194</width> - <height>107</height> + <width>177</width> + <height>106</height> </rect> </property> <attribute name="label"> @@ -592,8 +589,8 @@ <rect> <x>0</x> <y>0</y> - <width>166</width> - <height>92</height> + <width>157</width> + <height>90</height> </rect> </property> <attribute name="label"> @@ -674,8 +671,8 @@ <rect> <x>0</x> <y>0</y> - <width>194</width> - <height>107</height> + <width>177</width> + <height>106</height> </rect> </property> <attribute name="label"> @@ -1107,8 +1104,115 @@ <string/> </property> <property name="currentIndex"> - <number>2</number> + <number>0</number> </property> + <widget class="QWidget" name="tab_theme"> + <attribute name="title"> + <string>Theme</string> + </attribute> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Font:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QFontComboBox" name="font_session_theme"> + <property name="editable"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Font Size:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spin_session_fontsize"> + <property name="suffix"> + <string> point</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Theme Template:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_12"> + <item> + <widget class="QComboBox" name="combo_session_themefile"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_newtheme"> + <property name="toolTip"> + <string>Create/Edit a theme template (Advanced)</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string>Color Scheme:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_19"> + <item> + <widget class="QComboBox" name="combo_session_colorfile"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_newcolor"> + <property name="toolTip"> + <string>Create/Edit a color scheme</string> + </property> + <property name="statusTip"> + <string/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="combo_session_icontheme"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Icon Pack:</string> + </property> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tab"> <attribute name="title"> <string>General Options</string> @@ -1279,9 +1383,6 @@ <layout class="QVBoxLayout" name="verticalLayout_12"> <item> <widget class="QScrollArea" name="scrollArea"> - <property name="styleSheet"> - <string notr="true">background: grey;</string> - </property> <property name="widgetResizable"> <bool>true</bool> </property> @@ -1290,8 +1391,8 @@ <rect> <x>0</x> <y>0</y> - <width>491</width> - <height>59</height> + <width>515</width> + <height>78</height> </rect> </property> <property name="sizePolicy"> @@ -1398,7 +1499,7 @@ <x>0</x> <y>0</y> <width>579</width> - <height>19</height> + <height>20</height> </rect> </property> </widget> 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 diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index 3984e109..fea56549 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -67,6 +67,9 @@ public: void OpenDirs(QStringList); //called from the main.cpp after initialization +public slots: + void setupIcons(); //used during initialization + private: Ui::MainUI *ui; //Internal non-ui widgets @@ -97,7 +100,6 @@ private: bool isUserWritable, keepFocus; //Simplification Functions - void setupIcons(); //used during initialization void setupConnections(); //used during initialization void loadSettings(); //used during initialization diff --git a/lumina-fm/main.cpp b/lumina-fm/main.cpp index 8d5a3f95..18c75223 100644 --- a/lumina-fm/main.cpp +++ b/lumina-fm/main.cpp @@ -9,7 +9,7 @@ #include "MainUI.h" #include <LuminaOS.h> -//#include <LuminaThemes.h> +#include <LuminaThemes.h> int main(int argc, char ** argv) { @@ -27,8 +27,7 @@ int main(int argc, char ** argv) QApplication a(argc, argv); #endif a.setApplicationName("Insight File Manager"); - //LuminaThemeEngine themes(&a); - //qDebug() << "StyleSheet:\n" << a.styleSheet(); + LuminaThemeEngine themes(&a); //Load current Locale QTranslator translator; QLocale mylocale; @@ -45,6 +44,7 @@ int main(int argc, char ** argv) MainUI w; QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) ); + QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.OpenDirs(in); w.show(); diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp index c0e7be0f..f3695085 100644 --- a/lumina-open/main.cpp +++ b/lumina-open/main.cpp @@ -29,6 +29,7 @@ #include <LuminaXDG.h> #include <LuminaUtils.h> #include <LuminaOS.h> +#include <LuminaThemes.h> void printUsageInfo(){ qDebug() << "lumina-open: Application launcher for the Lumina Desktop Environment"; @@ -102,6 +103,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS if(extension=="directory" && !showDLG){ return "lumina-fm"; } //No default set -- Start up the application selection dialog QApplication App(argc, argv); + LuminaThemeEngine theme(&App); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); @@ -303,6 +305,7 @@ int main(int argc, char **argv){ qDebug() << "[lumina-open] Application Error:" << retcode; //Setup the application QApplication App(argc, argv); + LuminaThemeEngine theme(&App); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); diff --git a/lumina-screenshot/MainUI.cpp b/lumina-screenshot/MainUI.cpp index cedaa7a5..5b67577b 100644 --- a/lumina-screenshot/MainUI.cpp +++ b/lumina-screenshot/MainUI.cpp @@ -16,11 +16,9 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ QWidget *spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ui->toolBar->insertWidget(ui->actionNew, spacer); - //Setup the icons - this->setWindowIcon( LXDG::findIcon("camera-web","") ); - ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); - ui->actionQuit->setIcon( LXDG::findIcon("application-exit","") ); - ui->actionNew->setIcon( LXDG::findIcon("camera-web","") ); + + setupIcons(); + //Setup the connections connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveScreenshot()) ); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(closeApplication()) ); @@ -33,6 +31,14 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ MainUI::~MainUI(){} +void MainUI::setupIcons(){ + //Setup the icons + this->setWindowIcon( LXDG::findIcon("camera-web","") ); + ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); + ui->actionQuit->setIcon( LXDG::findIcon("application-exit","") ); + ui->actionNew->setIcon( LXDG::findIcon("camera-web","") ); +} + //============== // PRIVATE SLOTS //============== diff --git a/lumina-screenshot/MainUI.h b/lumina-screenshot/MainUI.h index 5ebe20f6..889e42e2 100644 --- a/lumina-screenshot/MainUI.h +++ b/lumina-screenshot/MainUI.h @@ -29,6 +29,9 @@ public: MainUI(); ~MainUI(); +public slots: + void setupIcons(); + private: Ui::MainUI *ui; QPixmap cpic; //current picture diff --git a/lumina-screenshot/main.cpp b/lumina-screenshot/main.cpp index 0b564f71..b7112a4d 100644 --- a/lumina-screenshot/main.cpp +++ b/lumina-screenshot/main.cpp @@ -5,10 +5,12 @@ #include "MainUI.h" #include <LuminaOS.h> +#include <LuminaThemes.h> int main(int argc, char ** argv) { QApplication a(argc, argv); + LuminaThemeEngine theme(&a); a.setApplicationName("Take Screenshot"); QTranslator translator; QLocale mylocale; @@ -20,6 +22,7 @@ int main(int argc, char ** argv) qDebug() << "Locale:" << langCode; MainUI w; + QObject::connect(&theme,SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); return a.exec(); diff --git a/port-files/pkg-plist b/port-files/pkg-plist index 21ecd65f..615adc2b 100644 --- a/port-files/pkg-plist +++ b/port-files/pkg-plist @@ -24,7 +24,7 @@ share/Lumina-DE/stylesheet.qss share/Lumina-DE/Login.ogg share/Lumina-DE/Logout.ogg share/Lumina-DE/colors/SampleColors.qss.colors -share/Lumina-DE/themes/SampleTheme.qss.template +share/Lumina-DE/themes/Lumina-default.qss.template share/wallpapers/Lumina-DE/Lumina_Wispy_gold_1920x1080.jpg share/wallpapers/Lumina-DE/Lumina_Wispy_green_1920x1080.jpg share/wallpapers/Lumina-DE/Lumina_Wispy_purple_1920x1080.jpg |