From 382406869d7e8180d9131b5886a9d06ffbc65320 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 4 Dec 2017 10:17:53 -0500 Subject: Fix up the battery notification system. --- src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/core/lumina-desktop/panel-plugins') diff --git a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp index 7a6b0e7c..69ea5faa 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/battery/LBattery.cpp @@ -77,6 +77,7 @@ void LBattery::updateBattery(bool force){ label->setPixmap( LXDG::findIcon("battery-unknown", "battery-missing").pixmap(label->size()) ); break; } + } if(iconvalue("PlayBatteryLowAudio",true).toBool(); @@ -97,7 +98,6 @@ void LBattery::updateBattery(bool force){ else{ tt = QString( tr("%1 % (%2 Remaining)") ).arg(QString::number(charge), getRemainingTime() ); } label->setToolTip(tt); } -} QString LBattery::getRemainingTime(){ int secs = LOS::batterySecondsLeft(); -- cgit From f925f25bd8f52c925db974a269d7dfd943f58669 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 7 Dec 2017 13:55:23 -0500 Subject: 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. --- .../panel-plugins/systemstart/ItemWidget.cpp | 22 ++++++++++++---------- .../panel-plugins/systemstart/LStartButton.cpp | 9 ++++++--- .../panel-plugins/systemstart/StartMenu.cpp | 2 +- .../panel-plugins/systemstart/StartMenu.h | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src-qt5/core/lumina-desktop/panel-plugins') 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; imenu()->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("
"); for(int i=0; ifontMetrics().elidedText(newname[i], Qt::ElideRight, name->width()); } name->setText( newname.join("
") ); @@ -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(); -- cgit