diff options
Diffstat (limited to 'lumina-desktop')
6 files changed, 218 insertions, 24 deletions
diff --git a/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h index 68540292..4d7206ee 100644 --- a/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h +++ b/lumina-desktop/desktop-plugins/applauncher/OutlineToolButton.h @@ -71,11 +71,11 @@ protected: QColor textC = opt.palette.text().color().toHsl(); //need the lightness value in a moment QColor outC = textC; //qDebug() << "Font Color Values:" << textC << textC.lightness() << textC.lightnessF(); - if(textC.lightnessF() > 0.5){ outC.setHsl(textC.hue(), textC.hslSaturation(), 0, 110); } - else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 110); } + if(textC.lightnessF() > 0.5){ outC.setHsl(textC.hue(), textC.hslSaturation(), 0, 90); } + else{outC.setHsl(textC.hue(), textC.hslSaturation(), 255, 90); } //qDebug() << "Outline Color Values:" << outC; //Now get the size of the outline border (need to scale for high-res monitors) - qreal OWidth = opt.fontMetrics.width("o")/3.0; + qreal OWidth = opt.fontMetrics.width("o")/3.5; //qDebug() << "Outline Width:" << OWidth; //Now generate a QPainterPath for the text QPainterPath path; @@ -85,8 +85,11 @@ protected: } path.setFillRule(Qt::WindingFill); //Now paint the text + QRadialGradient RG(box.center(), box.width()/1.1); //width is always going to be greater than height + RG.setColorAt(0, outC); + RG.setColorAt(1, Qt::transparent); p.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); //need antialiasing for this to work well (sub-pixel painting) - p.strokePath(path, QPen(QBrush(outC),OWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) ); //This will be the outline - 1pixel thick, semi-transparent + p.strokePath(path, QPen(QBrush(RG),OWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) ); //This will be the outline - 1pixel thick, semi-transparent p.fillPath(path, QBrush(textC)); //this will be the inside/text color } diff --git a/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp b/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp index 2e14c4e5..8754e534 100644 --- a/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp +++ b/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp @@ -42,6 +42,16 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob name->setText( itemPath.section("/",-1)); text = itemPath.section("/",-1); } + }else if(type.startsWith("chcat::::")){ + //Category given + actButton->setVisible(false); + iconPath = LXDG::DesktopCatToIcon(type.section("::::",1,50)); + if(goback){ iconPath = "go-previous"; type = "chcat::::"; itemPath = "<B>("+itemPath+")</B>"; } + icon->setPixmap( LXDG::findIcon(iconPath,"applications-other").pixmap(64,64) ); + name->setText(itemPath); + text = itemPath; + icon->setWhatsThis(type); + linkPath = type; }else{ actButton->setVisible(false); if(itemPath.endsWith("/")){ itemPath.chop(1); } @@ -75,6 +85,7 @@ ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool gob setupContextMenu(); } +// - Application constructor ItemWidget::ItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){ createWidget(); isDirectory = false; @@ -115,15 +126,10 @@ void ItemWidget::createWidget(){ contextMenu = new QMenu(); connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); connect(contextMenu, SIGNAL(aboutToHide()), this, SLOT(actionMenuClosed()) ); - /*button = new QToolButton(this); - button->setIconSize( QSize(14,14) ); - button->setAutoRaise(true);*/ actButton = new QToolButton(this); actButton->setPopupMode(QToolButton::InstantPopup); - //actButton->setFixedSize( QSize(17,34) ); actButton->setArrowType(Qt::DownArrow); icon = new QLabel(this); - //icon->setFixedSize( QSize(34,34) ); name = new QLabel(this); name->setWordWrap(true); //Add them to the layout diff --git a/lumina-desktop/panel-plugins/systemstart/ItemWidget.h b/lumina-desktop/panel-plugins/systemstart/ItemWidget.h index acb908ec..0f24cec4 100644 --- a/lumina-desktop/panel-plugins/systemstart/ItemWidget.h +++ b/lumina-desktop/panel-plugins/systemstart/ItemWidget.h @@ -28,8 +28,14 @@ class ItemWidget : public QFrame{ Q_OBJECT public: + //Overloaded Constructors for various uses + // - Favorites (path/type) ItemWidget(QWidget *parent=0, QString itemPath="", QString type="unknown", bool goback=false); + // - Generic Apps ItemWidget(QWidget *parent=0, XDGDesktop item= XDGDesktop()); + // - Categories + //ItemWidget(QWidget *parent=0, QString cat=""); + ~ItemWidget(); bool gooditem; @@ -69,7 +75,7 @@ private slots: protected: void mouseReleaseEvent(QMouseEvent *event){ if(menuopen){ resetmenuflag(); } //skip this event if a submenu was open - else if(event->button() == Qt::RightButton){ + else if(event->button() == Qt::RightButton && !icon->whatsThis().startsWith("chcat::::") ){ menuopen = true; setupContextMenu(); contextMenu->popup(event->globalPos()); diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index a18478e6..3c418ac5 100644 --- a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -6,6 +6,7 @@ //=========================================== #include "StartMenu.h" #include "ui_StartMenu.h" +//#include <QtConcurrent> #include <LuminaOS.h> #include "../../LSession.h" @@ -18,6 +19,12 @@ StartMenu::StartMenu(QWidget *parent) : QWidget(parent), ui(new Ui::StartMenu){ this->setMouseTracking(true); sysapps = LSession::handle()->applicationMenu()->currentAppHash(); connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateApps()) ); + //Need to load the last used setting of the application list + QString state = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/systemstart/showcategories", "partial").toString(); + if(state=="partial"){ui->check_apps_showcats->setCheckState(Qt::PartiallyChecked); } + else if(state=="true"){ ui->check_apps_showcats->setCheckState(Qt::Checked); } + else{ ui->check_apps_showcats->setCheckState(Qt::Unchecked); } + connect(ui->check_apps_showcats, SIGNAL(stateChanged(int)), this, SLOT(catViewChanged()) ); UpdateAll(); QTimer::singleShot(10, this,SLOT(UpdateApps())); QTimer::singleShot(10, this, SLOT(UpdateFavs())); @@ -180,6 +187,10 @@ void StartMenu::SortScrollArea(QScrollArea *area){ // PRIVATE SLOTS // ======================== void StartMenu::LaunchItem(QString path, bool fix){ + if(path.startsWith("chcat::::")){ + ChangeCategory(path.section("::::",1,50)); + return; + } qDebug() << "Launching Item:" << path << fix; if(!path.isEmpty()){ qDebug() << "Launch Application:" << path; @@ -189,21 +200,85 @@ void StartMenu::LaunchItem(QString path, bool fix){ } } +void StartMenu::ChangeCategory(QString cat){ + //This only happens on user interaction - make sure to run the update routine in a separate thread + CCat = cat; + UpdateApps(); + //QtConcurrent::run(this, &StartMenu::UpdateApps); +} + //Listing Update routines void StartMenu::UpdateApps(){ ClearScrollArea(ui->scroll_apps); //Now assemble the apps list (note: this normally happens in the background - not when it is visible/open) - QStringList cats = sysapps->keys(); - cats.sort(); - cats.removeAll("All"); - //QStringList QL = LSession::handle()->sessionSettings()->value("QuickLaunchApps",QStringList()).toStringList(); - for(int c=0; c<cats.length(); c++){ - QList<XDGDesktop> apps = sysapps->value(cats[c]); - if(apps.isEmpty()){ continue; } - //Add the category label to the scroll - QLabel *catlabel = new QLabel("<b>"+cats[c]+"</b>",ui->scroll_apps->widget()); - catlabel->setAlignment(Qt::AlignCenter); - ui->scroll_apps->widget()->layout()->addWidget(catlabel); + //qDebug() << "Update Apps:" << CCat << ui->check_apps_showcats->checkState(); + if(ui->check_apps_showcats->checkState() == Qt::PartiallyChecked){ + //qDebug() << " - Partially Checked"; + //Show a single page of apps, but still divided up by categories + CCat.clear(); + QStringList cats = sysapps->keys(); + cats.sort(); + cats.removeAll("All"); + for(int c=0; c<cats.length(); c++){ + QList<XDGDesktop> apps = sysapps->value(cats[c]); + if(apps.isEmpty()){ continue; } + //Add the category label to the scroll + QLabel *catlabel = new QLabel("<b>"+cats[c]+"</b>",ui->scroll_apps->widget()); + catlabel->setAlignment(Qt::AlignCenter); + ui->scroll_apps->widget()->layout()->addWidget(catlabel); + //Now add all the apps for this category + for(int i=0; i<apps.length(); i++){ + ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); + if(!it->gooditem){ continue; } //invalid for some reason + ui->scroll_apps->widget()->layout()->addWidget(it); + connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); + connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); + connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); + connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); + } + } + + }else if(ui->check_apps_showcats->checkState() == Qt::Checked){ + //qDebug() << " - Checked"; + //Only show categories to start with - and have the user click-into a cat to see apps + if(CCat.isEmpty()){ + //No cat selected yet - show cats only + QStringList cats = sysapps->keys(); + cats.sort(); + cats.removeAll("All"); //This is not a "real" category + for(int c=0; c<cats.length(); c++){ + ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), cats[c], "chcat::::"+cats[c] ); + if(!it->gooditem){ continue; } //invalid for some reason + ui->scroll_apps->widget()->layout()->addWidget(it); + //connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); + //connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); + connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); + //connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); + } + }else{ + //Show the "go back" button + ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), CCat, "chcat::::"+CCat, true); + //if(!it->gooditem){ continue; } //invalid for some reason + ui->scroll_apps->widget()->layout()->addWidget(it); + connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); + //Show apps for this cat + QList<XDGDesktop> apps = sysapps->value(CCat); + for(int i=0; i<apps.length(); i++){ + ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); + if(!it->gooditem){ continue; } //invalid for some reason + ui->scroll_apps->widget()->layout()->addWidget(it); + connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) ); + connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) ); + connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) ); + connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) ); + } + } + + }else{ + //qDebug() << " - Not Checked"; + //No categories at all - just alphabetize all the apps + QList<XDGDesktop> apps = sysapps->value("All"); + CCat.clear(); //Now add all the apps for this category for(int i=0; i<apps.length(); i++){ ItemWidget *it = new ItemWidget(ui->scroll_apps->widget(), apps[i] ); @@ -216,6 +291,7 @@ void StartMenu::UpdateApps(){ } } + } void StartMenu::UpdateFavs(){ @@ -313,6 +389,23 @@ void StartMenu::on_stackedWidget_currentChanged(int val){ } +void StartMenu::catViewChanged(){ + QString state; + switch(ui->check_apps_showcats->checkState()){ + case Qt::Checked: + state = "true"; + break; + case Qt::PartiallyChecked: + state = "partial"; + break; + default: + state = "false"; + } + LSession::handle()->DesktopPluginSettings()->setValue("panelPlugs/systemstart/showcategories", state); + //Now kick off the reload of the apps list + UpdateApps(); + //QtConcurrent::run(this, &StartMenu::UpdateApps); //this was a direct user change - keep it thread safe +} //Page Change Buttons void StartMenu::on_tool_goto_apps_clicked(){ ui->stackedWidget->setCurrentWidget(ui->page_apps); diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.h b/lumina-desktop/panel-plugins/systemstart/StartMenu.h index 8e2b2a3c..7a85df70 100644 --- a/lumina-desktop/panel-plugins/systemstart/StartMenu.h +++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.h @@ -34,6 +34,7 @@ private: Ui::StartMenu *ui; QHash<QString, QList<XDGDesktop> > *sysapps; QStringList favs; + QString CCat; //current category //Simple utility functions void ClearScrollArea(QScrollArea *area); @@ -43,11 +44,13 @@ private slots: void LaunchItem(QString path, bool fix = true); //Application/Favorite Listings + void ChangeCategory(QString cat); void UpdateApps(); void UpdateFavs(); // Page update routines void on_stackedWidget_currentChanged(int); //page changed + void catViewChanged(); //application categorization view mode changed //Page Change Buttons void on_tool_goto_apps_clicked(); diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.ui b/lumina-desktop/panel-plugins/systemstart/StartMenu.ui index f1abbc97..7156b4f3 100644 --- a/lumina-desktop/panel-plugins/systemstart/StartMenu.ui +++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.ui @@ -143,7 +143,7 @@ <x>0</x> <y>0</y> <width>178</width> - <height>193</height> + <height>177</height> </rect> </property> </widget> @@ -164,6 +164,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Browse Files</string> </property> @@ -189,6 +192,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Browse Applications</string> </property> @@ -221,6 +227,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Control Panel</string> </property> @@ -246,6 +255,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Quick Settings</string> </property> @@ -283,6 +295,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="styleSheet"> <string notr="true">QToolButton::menu-arrow{ image: rightarrow-icon; }</string> </property> @@ -311,6 +326,9 @@ </item> <item> <widget class="QToolButton" name="tool_lock"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string notr="true">lock</string> </property> @@ -354,6 +372,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Manage Applications</string> </property> @@ -372,6 +393,29 @@ </widget> </item> <item> + <widget class="Line" name="line_15"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="check_apps_showcats"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="text"> + <string>Show Categories</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="tristate"> + <bool>true</bool> + </property> + </widget> + </item> + <item> <widget class="Line" name="line_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -394,8 +438,8 @@ <rect> <x>0</x> <y>0</y> - <width>98</width> - <height>28</height> + <width>178</width> + <height>284</height> </rect> </property> </widget> @@ -437,6 +481,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Configure Desktop</string> </property> @@ -456,6 +503,9 @@ </item> <item> <widget class="QToolButton" name="tool_launch_deskinfo"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string notr="true">info</string> </property> @@ -504,6 +554,9 @@ <layout class="QHBoxLayout" name="horizontalLayout_5"> <item> <widget class="QToolButton" name="tool_launch_mixer"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string notr="true"/> </property> @@ -520,6 +573,9 @@ </item> <item> <widget class="QSlider" name="slider_volume"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="maximum"> <number>100</number> </property> @@ -597,6 +653,9 @@ </item> <item> <widget class="QSlider" name="slider_bright"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="minimum"> <number>10</number> </property> @@ -655,6 +714,9 @@ <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> <widget class="QToolButton" name="tool_set_prevwkspace"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string notr="true">prev</string> </property> @@ -678,6 +740,9 @@ </item> <item> <widget class="QToolButton" name="tool_set_nextwkspace"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string notr="true">next</string> </property> @@ -737,6 +802,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> </widget> </item> </layout> @@ -826,6 +894,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Suspend System</string> </property> @@ -888,6 +959,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Restart System</string> </property> @@ -913,6 +987,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Power Off System</string> </property> @@ -958,6 +1035,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Sign Out User</string> </property> @@ -994,6 +1074,9 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="text"> <string>Back</string> </property> |