aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-12-07 13:55:23 -0500
committerKen Moore <ken@ixsystems.com>2017-12-07 13:55:23 -0500
commitf925f25bd8f52c925db974a269d7dfd943f58669 (patch)
treee0b813e5c1324093cdb0b88576749ea200d8bc2b /src-qt5
parentMake sure the new traynotification-simple stylesheet is used. (diff)
downloadlumina-f925f25bd8f52c925db974a269d7dfd943f58669.tar.gz
lumina-f925f25bd8f52c925db974a269d7dfd943f58669.tar.bz2
lumina-f925f25bd8f52c925db974a269d7dfd943f58669.zip
Fix up a couple more things:
1. Add option to load global styles from luminaDesktop.conf 2. Fix up the default icon/menu size of the start menu and item icons. 3. Fix up a signal/slot mis-connect in the start menu.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/LDesktopUtils.cpp1
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.cpp42
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.h3
-rw-r--r--src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf1
-rw-r--r--src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf3
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp22
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp9
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp2
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h2
9 files changed, 67 insertions, 18 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp
index 3154cfb2..5595532a 100644
--- a/src-qt5/core/libLumina/LDesktopUtils.cpp
+++ b/src-qt5/core/libLumina/LDesktopUtils.cpp
@@ -399,6 +399,7 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){
if(var.contains(".")){ var.replace(".","_"); }
//Now parse the variable and put the value in the proper file
if(var=="theme_themefile"){ themesettings[0] = val; }
+ else if(var=="theme_styles"){ LTHEME::setCurrentStyles( val.split(",",QString::SkipEmptyParts) ); }
else if(var=="theme_colorfile"){ themesettings[1] = val; }
else if(var=="theme_iconset"){ themesettings[2] = val; }
else if(var=="theme_font"){ themesettings[3] = val; }
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp
index 857e604b..03524941 100644
--- a/src-qt5/core/libLumina/LuminaThemes.cpp
+++ b/src-qt5/core/libLumina/LuminaThemes.cpp
@@ -34,6 +34,17 @@ QStringList LTHEME::availableSystemThemes(){
return list;
}
+QStringList LTHEME::availableSystemStyles(){
+ //returns: [name::::path] for each item
+ QDir dir(LOS::LuminaShare()+"../lthemeengine/qss");
+ QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name);
+ for(int i=0; i<list.length(); i++){
+ //Format the output entry [<name>::::<fullpath>]
+ list[i] = list[i].section(".qss",0,0)+"::::"+dir.absoluteFilePath(list[i]);
+ }
+ return list;
+}
+
QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each item
QDir dir( QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/desktop_qss");
QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name);
@@ -44,6 +55,16 @@ QStringList LTHEME::availableLocalThemes(){ //returns: [name::::path] for each i
return list;
}
+QStringList LTHEME::availableLocalStyles(){ //returns: [name::::path] for each item
+ QDir dir( QString(getenv("XDG_CONFIG_HOME"))+"/lthemeengine/qss");
+ QStringList list = dir.entryList(QStringList() <<"*.qss", QDir::Files, QDir::Name);
+ for(int i=0; i<list.length(); i++){
+ //Format the output entry [<name>::::<fullpath>]
+ list[i] = list[i].section(".qss",0,0)+"::::"+dir.absoluteFilePath(list[i]);
+ }
+ return list;
+}
+
QStringList LTHEME::availableSystemColors(){ //returns: [name::::path] for each item
//returns: [name::::path] for each item
QDir dir(LOS::LuminaShare()+"../lthemeengine/colors");
@@ -244,6 +265,23 @@ bool LTHEME::setCursorTheme(QString cursorname){
return LUtils::writeFile(QDir::homePath()+"/.icons/default/index.theme", info, true);
}
+bool LTHEME::setCurrentStyles(QStringList paths){
+ //Verify that the paths are all absolute paths, otherwise scan/replace with absolute paths
+ QStringList avail = LTHEME::availableSystemStyles();
+ for(int i=0; i<paths.length(); i++){
+ paths[i] = paths[i].simplified();
+ if(paths[i].startsWith("/")){ continue; } //already an absolute path
+ for(int j=0; j<avail.length(); j++){
+ if(avail[j].startsWith(paths[i].section("/",-1).section(".qss",0,0)+"::::") ){ paths[i] = avail[j].section("::::",1,-1); break; }
+ }
+ }
+ //ordered by priority: lowest -> highest
+ QSettings engineset("lthemeengine","lthemeengine");
+ engineset.setValue("Interface/stylesheets",paths);
+ engineset.sync();
+ return true;
+}
+
//Return the complete stylesheet for a given theme/colors
QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize){
QString stylesheet = LUtils::readFile(themepath).join("\n");
@@ -340,10 +378,10 @@ void LTHEME::LoadCustomEnvSettings(){
setenv(info[i].section("=",0,0).toLocal8Bit(), info[i].section("=",1,100).simplified().toLocal8Bit(), 1);
}
}
-
+
}
-bool LTHEME::setCustomEnvSetting(QString var, QString val){
+bool LTHEME::setCustomEnvSetting(QString var, QString val){
//variable/value pair (use an empty val to clear it)
QStringList info = LTHEME::CustomEnvSettings(true); //user only
bool changed = false;
diff --git a/src-qt5/core/libLumina/LuminaThemes.h b/src-qt5/core/libLumina/LuminaThemes.h
index ca79e0bd..133bd04d 100644
--- a/src-qt5/core/libLumina/LuminaThemes.h
+++ b/src-qt5/core/libLumina/LuminaThemes.h
@@ -25,7 +25,9 @@ class LTHEME{
public:
//Read the Themes/Colors/Icons that are available on the system
static QStringList availableSystemThemes();//returns: [name::::path] for each item
+ static QStringList availableSystemStyles();//returns: [name::::path] for each item
static QStringList availableLocalThemes(); //returns: [name::::path] for each item
+ static QStringList availableLocalStyles(); //returns: [name::::path] for each item
static QStringList availableSystemColors(); //returns: [name::::path] for each item
static QStringList availableLocalColors(); //returns: [name::::path] for each item
static QStringList availableSystemIcons(); //returns: [name] for each item
@@ -42,6 +44,7 @@ public:
//Change the current Theme/Colors/Icons
static bool setCurrentSettings(QString themepath, QString colorpath, QString iconname, QString font, QString fontsize);
static bool setCursorTheme(QString cursorname);
+ static bool setCurrentStyles(QStringList paths); //ordered by priority: lowest -> highest
//Return the complete stylesheet for a given theme/colors
static QString assembleStyleSheet(QString themepath, QString colorpath, QString font, QString fontsize);
diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
index 180730bf..543f9eaa 100644
--- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
+++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf
@@ -53,6 +53,7 @@ mime_default_application/x-tar_ifexists=lumina-archiver.desktop
#THEME SETTINGS
theme_themefile=DarkGlass #Name of the theme to use (disable for Lumina-Default)
+theme_styles=scrollbar-simple, tooltip-simple, sliders-simple, traynotification-simple
theme_colorfile=darker #Name of the color spec file to use for theming
theme_iconset=material-design-dark #Name of the icon theme to use
theme_font=Noto Sans #Name of the font family to use
diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
index e4229038..0e6101c1 100644
--- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
+++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
@@ -50,7 +50,8 @@ mime_default_unknown/*=lumina-textedit.desktop
mime_default_application/x-shellscript=lumina-textedit.desktop
#THEME SETTINGS
-theme_themefile=DarkGlass #Name of the theme to use (disable for Lumina-Default)
+theme_themefile=DarkGlass #Name of the theme to use
+theme_styles=scrollbar-simple, tooltip-simple, sliders-simple, traynotification-simple
theme_colorfile=darker #Name of the color spec file to use for theming
theme_iconset=material-design-dark #Name of the icon theme to use
theme_font=Arial #Name of the font family to use
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
index f4382ffc..545000f4 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
@@ -70,12 +70,12 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob
iconPath = itemPath;
//icon->setPixmap( QIcon(itemPath).pixmap(64,64) );
}else{
- if( LUtils::isValidBinary(itemPath) ){
+ if( LUtils::isValidBinary(itemPath) ){
if(ICONS->exists(type)){ iconPath = type; }
else{ iconPath = "application-x-executable"; }
}else{ iconPath = LXDG::findAppMimeForFile(itemPath.section("/",-1)).replace("/","-"); }
}
- name->setText( itemPath.section("/",-1) ); //this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) );
+ name->setText( itemPath.section("/",-1) ); //this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) );
text = itemPath.section("/",-1) ;
}
ICONS->loadIcon(icon, iconPath);
@@ -133,11 +133,11 @@ ItemWidget::~ItemWidget(){
//actButton->deleteLater();
contextMenu->clear();
//contextMenu->deleteLater();
- if(actButton->menu()!=0){
+ if(actButton->menu()!=0){
for(int i=0; i<actButton->menu()->actions().length(); i++){
actButton->menu()->actions().at(i)->deleteLater();
}
- actButton->menu()->deleteLater();
+ actButton->menu()->deleteLater();
}
//actButton->deleteLater();
//icon->deleteLater();
@@ -156,7 +156,7 @@ void ItemWidget::createWidget(){
menuopen = false;
menureset = new QTimer(this);
menureset->setSingleShot(true);
- menureset->setInterval(1000); //1 second
+ menureset->setInterval(1000); //1 second
this->setContentsMargins(0,0,0,0);
contextMenu = new QMenu(this);
connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) );
@@ -220,7 +220,7 @@ void ItemWidget::setupActions(XDGDesktop *app){
else{ ICONS->loadIcon(act, app->icon); }
act->setToolTip(app->actions[i].ID);
act->setWhatsThis(app->actions[i].ID);
- actButton->menu()->addAction(act);
+ actButton->menu()->addAction(act);
}
connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) );
connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) );
@@ -230,9 +230,11 @@ void ItemWidget::setupActions(XDGDesktop *app){
void ItemWidget::updateItems(){
//update the text/icon to match sizes
- int H = (2.5*name->fontMetrics().height() ) -4; //make sure the height is large enough for two lines
+ int H = (2.2*name->fontMetrics().height() ) -4; //make sure the height is large enough for two lines
icon->setFixedSize(QSize(H, H));
+ icon->setAlignment(Qt::AlignCenter);
actButton->setFixedSize( QSize( H/2, H) );
+ H = (1.8*name->fontMetrics().height() ) -4;
QStringList newname = text.split("<br>");
for(int i=0; i<newname.length(); i++){ newname[i] = name->fontMetrics().elidedText(newname[i], Qt::ElideRight, name->width()); }
name->setText( newname.join("<br>") );
@@ -271,9 +273,9 @@ void ItemWidget::RemoveFavorite(){
void ItemWidget::AddFavorite(){
if( LDesktopUtils::addFavorite(icon->whatsThis()) ){
linkPath = icon->whatsThis();
- emit NewShortcut();
+ emit NewShortcut();
}
-
+
}
void ItemWidget::RemoveQL(){
qDebug() << "Remove QuickLaunch Button:" << icon->whatsThis();
@@ -282,7 +284,7 @@ void ItemWidget::RemoveQL(){
void ItemWidget::AddQL(){
qDebug() << "Add QuickLaunch Button:" << icon->whatsThis();
- emit toggleQuickLaunch(icon->whatsThis(), true);
+ emit toggleQuickLaunch(icon->whatsThis(), true);
}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
index 562122ae..d8014f4c 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -25,9 +25,11 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon
startmenu = new StartMenu(this);
connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList)));
- //QRect screenSize = QApplication::desktop()->availableGeometry(this);
- QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(0, 0)).toSize();
- if(!saved.isNull()){ startmenu->setFixedSize(saved); } //re-load the previously saved value
+
+ QRect screenSize = QApplication::desktop()->availableGeometry(this);
+ QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize",QSize(this->fontMetrics().width("x")*30 ,screenSize.height()/1.8)).toSize();
+ //qDebug() << "Got Start Menu Saved Size:" << saved;
+ if(!saved.isNull() && saved.isValid()){ startmenu->setFixedSize(saved); } //re-load the previously saved value
menu->setContents(startmenu);
button->setMenu(menu);
@@ -122,6 +124,7 @@ void LStartButtonPlugin::openMenu(){
menu->setContents(startmenu);
if(old!=0){ old->deleteLater(); }*/
//--------
+ //qDebug() << "Menu Size:" << startmenu->size();
startmenu->UpdateMenu();
button->showMenu();
}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
index 272bf0fa..ee3e0f80 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
@@ -597,7 +597,7 @@ void StartMenu::on_tool_restart_clicked(){
LSession::handle()->StartReboot(true);
}
-void StartMenu::on_tool_restart_update_clicked(){
+void StartMenu::on_tool_restart_updates_clicked(){
emit CloseMenu();
QCoreApplication::processEvents();
//bool skipupdates = false;
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h
index 41bc3ec4..0a90311d 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.h
@@ -73,7 +73,7 @@ private slots:
void on_tool_lock_clicked();
void on_tool_logout_clicked();
void on_tool_restart_clicked();
- void on_tool_restart_update_clicked();
+ void on_tool_restart_updates_clicked();
void on_tool_shutdown_clicked();
void on_tool_suspend_clicked();
bgstack15