diff options
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.cpp | 47 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.h | 9 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/userbutton/UserWidget.ui | 750 |
3 files changed, 426 insertions, 380 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index 1571760b..f7a932ad 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -9,23 +9,24 @@ #include "../../LSession.h" #include "../../AppMenu.h" -UserWidget::UserWidget(QWidget* parent) : QWidget(parent), ui(new Ui::UserWidget){ +UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWidget){ ui->setupUi(this); - this->setContentsMargins(0,0,0,0); + if(parent!=0){ parent->setMouseTracking(true); } + this->setMouseTracking(true); sysapps = LSession::applicationMenu()->currentAppHash(); //get the raw info //Setup the Icons // - favorites tab - ui->tabWidget->setTabIcon(0, LXDG::findIcon("favorites","") ); - ui->tabWidget->setTabText(0,""); + this->setTabIcon(0, rotateIcon(LXDG::findIcon("favorites","")) ); + this->setTabText(0,""); // - apps tab - ui->tabWidget->setTabIcon(1, LXDG::findIcon("system-run","") ); - ui->tabWidget->setTabText(1,""); + this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); + this->setTabText(1,""); // - home tab - ui->tabWidget->setTabIcon(2, LXDG::findIcon("user-home","") ); - ui->tabWidget->setTabText(2,""); + this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); + this->setTabText(2,""); // - config tab - ui->tabWidget->setTabIcon(3, LXDG::findIcon("preferences-system","") ); - ui->tabWidget->setTabText(3,""); + this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); + this->setTabText(3,""); ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") ); ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); @@ -75,7 +76,7 @@ UserWidget::UserWidget(QWidget* parent) : QWidget(parent), ui(new Ui::UserWidget }else{ ui->tool_qtconfig->setVisible(false); } - lastUpdate = QDateTime::currentDateTime().addSecs(-30); //make sure it refreshes + lastUpdate = QDateTime(); //make sure it refreshes QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization } @@ -97,19 +98,28 @@ void UserWidget::ClearScrollArea(QScrollArea *area){ area->widget()->setLayout(layout); } +QIcon UserWidget::rotateIcon(QIcon ico){ + //Rotate the given icon to appear vertical in the tab widget + QPixmap pix = ico.pixmap(32,32); + QTransform tran; + tran.rotate(+90); //For tabs on the left/West + pix = pix.transformed(tran); + ico = QIcon(pix); + return ico; +} + //============ // PRIVATE SLOTS //============ void UserWidget::UpdateMenu(){ - if(QDateTime::currentDateTime() > lastUpdate.addSecs(30)){ - //Only re-arrange/reload things if not rapidly re-run - ui->tabWidget->setCurrentWidget(ui->tab_fav); + this->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); ui->tool_fav_files->setChecked(false); cfav = 0; //favorite apps updateFavItems(); updateHome(); + if(lastUpdate < LSession::applicationMenu()->lastHashUpdate || lastUpdate.isNull()){ updateAppCategories(); updateApps(); } @@ -222,3 +232,12 @@ void UserWidget::updateHome(){ } static_cast<QBoxLayout*>(ui->scroll_home->widget()->layout())->addStretch(); } + +void UserWidget::mouseMoveEvent( QMouseEvent *event){ + QTabBar *wid = tabBar(); + qDebug() << "Mouse Move Event:"; + if(wid && wid->tabAt(event->pos()) != -1){ + qDebug() << " - Mouse over tab"; + this->setCurrentIndex( wid->tabAt(event->pos()) ); + } +}
\ No newline at end of file diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h index 132969ad..a2cedb03 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -16,6 +16,9 @@ #include <QVBoxLayout> #include <QScrollArea> #include <QDateTime> +#include <QTransform> +#include <QMouseEvent> +#include <QTabWidget> #include <LuminaXDG.h> #include <LuminaOS.h> @@ -30,7 +33,7 @@ namespace Ui{ class UserWidget; }; -class UserWidget : public QWidget{ +class UserWidget : public QTabWidget{ Q_OBJECT public: UserWidget(QWidget *parent=0); @@ -45,6 +48,7 @@ private: QDateTime lastUpdate; int cfav; //current favorite category void ClearScrollArea(QScrollArea *area); + QIcon rotateIcon(QIcon); private slots: void LaunchItem(QString cmd); @@ -77,6 +81,9 @@ private slots: LaunchItem(SSAVER); } +protected: + void mouseMoveEvent( QMouseEvent *event); + signals: void CloseMenu(); diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui index 30625735..5e62ffd1 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui @@ -1,384 +1,404 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>UserWidget</class> - <widget class="QWidget" name="UserWidget"> + <widget class="QTabWidget" name="UserWidget"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>237</width> - <height>300</height> + <width>292</width> + <height>289</height> </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string>UserWidget</string> </property> - <property name="styleSheet"> - <string notr="true">QWidget#UserWidget{background: transparent; } -QWidget#tab_apps,#tab_fav,#tab_home,#tab_config{background: rgba(192,192,182,100); }</string> + <property name="tabPosition"> + <enum>QTabWidget::West</enum> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_fav"> - <attribute name="title"> - <string notr="true">Favorites</string> - </attribute> - <attribute name="toolTip"> - <string>Favorites</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QToolButton" name="tool_fav_apps"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Favorite Applications</string> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_fav_dirs"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Favorite Directories</string> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_fav_files"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="toolTip"> - <string>Favorite FIles</string> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QScrollArea" name="scroll_fav"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>205</width> - <height>210</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab_fav"> + <attribute name="title"> + <string>Favorites</string> + </attribute> + <attribute name="toolTip"> + <string>Favorites</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>2</number> + </property> + <property name="margin"> + <number>1</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QToolButton" name="tool_fav_apps"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="cursor"> + <cursorShape>ArrowCursor</cursorShape> + </property> + <property name="toolTip"> + <string>Favorite Applications</string> + </property> + <property name="text"> + <string>Applications</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_fav_dirs"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="toolTip"> + <string>Favorite Directories</string> + </property> + <property name="text"> + <string>Places</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_fav_files"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="toolTip"> + <string>Favorite FIles</string> + </property> + <property name="text"> + <string>Files</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollArea" name="scroll_fav"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>262</width> + <height>245</height> + </rect> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_apps"> + <attribute name="title"> + <string>Apps</string> + </attribute> + <attribute name="toolTip"> + <string>System Applications</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QComboBox" name="combo_app_cats"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + <property name="maxVisibleItems"> + <number>12</number> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QToolButton" name="tool_app_store"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollArea" name="scroll_apps"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>252</width> + <height>231</height> + </rect> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_home"> + <attribute name="title"> + <string>Home</string> + </attribute> + <attribute name="toolTip"> + <string>Home Directory</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QScrollArea" name="scroll_home"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_3"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>252</width> + <height>269</height> + </rect> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_config"> + <attribute name="title"> + <string>Config</string> + </attribute> + <attribute name="toolTip"> + <string>Desktop Preferences</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QToolButton" name="tool_controlpanel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Control Panel</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> </widget> - <widget class="QWidget" name="tab_apps"> - <attribute name="title"> - <string notr="true">Apps</string> - </attribute> - <attribute name="toolTip"> - <string>System Applications</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QComboBox" name="combo_app_cats"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>30</height> - </size> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QToolButton" name="tool_app_store"> - <property name="minimumSize"> - <size> - <width>30</width> - <height>30</height> - </size> - </property> - <property name="text"> - <string/> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QScrollArea" name="scroll_apps"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>96</width> - <height>26</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> + </item> + <item> + <widget class="QToolButton" name="tool_desktopsettings"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Desktop Appearance/Plugins</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> </widget> - <widget class="QWidget" name="tab_home"> - <attribute name="title"> - <string notr="true">Home</string> - </attribute> - <attribute name="toolTip"> - <string>Home</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QScrollArea" name="scroll_home"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_3"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>96</width> - <height>26</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> + </item> + <item> + <widget class="QToolButton" name="tool_qtconfig"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Application Appearance</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> </widget> - <widget class="QWidget" name="tab_config"> - <attribute name="title"> - <string notr="true">Config</string> - </attribute> - <attribute name="toolTip"> - <string>Desktop Preferences</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <widget class="QToolButton" name="tool_controlpanel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Control Panel</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_desktopsettings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Desktop Appearance/Plugins</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_qtconfig"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Application Appearance</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_config_screensaver"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Screensaver Settings</string> - </property> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>141</height> - </size> - </property> - </spacer> - </item> - </layout> + </item> + <item> + <widget class="QToolButton" name="tool_config_screensaver"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Screensaver Settings</string> + </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> </widget> - </widget> - </item> - </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>243</width> + <height>162</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> <resources/> <connections/> |