aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-09-29 17:02:16 -0400
committerKen Moore <ken@pcbsd.org>2014-09-29 17:02:16 -0400
commit707241a359e6b739d21fc9e1b1112cbf04487dbd (patch)
tree6728b2253b6ddc93c17f18cac9791e46d7c2cf9d /lumina-desktop/panel-plugins
parentUpdate the user buttons some more: (diff)
downloadlumina-707241a359e6b739d21fc9e1b1112cbf04487dbd.tar.gz
lumina-707241a359e6b739d21fc9e1b1112cbf04487dbd.tar.bz2
lumina-707241a359e6b739d21fc9e1b1112cbf04487dbd.zip
Finish cleaning up the new directory browser in the userbutton.
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp19
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.h4
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp24
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h1
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.ui56
5 files changed, 51 insertions, 53 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
index a9cf3b25..d1e35522 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -6,7 +6,7 @@
//===========================================
#include "UserItemWidget.h"
-UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir) : QFrame(parent){
+UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir, bool goback) : QFrame(parent){
createWidget();
//Now fill it appropriately
if(itemPath.endsWith(".desktop")){
@@ -21,8 +21,13 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir) :
}
}else if(isDir){
if(itemPath.endsWith("/")){ itemPath.chop(1); }
- icon->setPixmap( LXDG::findIcon("folder","").pixmap(30,30) );
- name->setText( itemPath.section("/",-1) );
+ if(goback){
+ icon->setPixmap( LXDG::findIcon("go-previous","").pixmap(30,30) );
+ name->setText( tr("Go Back") );
+ }else{
+ icon->setPixmap( LXDG::findIcon("folder","").pixmap(30,30) );
+ name->setText( itemPath.section("/",-1) );
+ }
}else{
if(itemPath.endsWith("/")){ itemPath.chop(1); }
icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1).section(".",-1)).pixmap(30,30) );
@@ -34,7 +39,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir) :
isDirectory = isDir; //save this for later
isShortcut = itemPath.contains("/home/") && (itemPath.contains("/Desktop/") || itemPath.contains("/.lumina/favorites/") );
//Now setup the button appropriately
- setupButton();
+ setupButton(goback);
}
UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){
@@ -77,8 +82,10 @@ void UserItemWidget::createWidget(){
this->setStyleSheet("UserItemWidget{ background: transparent; border-radius: 5px;} UserItemWidget::hover{ background: rgba(255,255,255,200); border-radius: 5px; }");
}
-void UserItemWidget::setupButton(){
- if( !isDirectory && isShortcut ){
+void UserItemWidget::setupButton(bool disable){
+ if(disable){
+ button->setVisible(false);
+ }else if( !isDirectory && isShortcut ){
//This is a current desktop shortcut -- allow the user to remove it
button->setWhatsThis("remove");
if(!linkPath.isEmpty()){
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h
index 79baffbb..1f428ac4 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h
@@ -25,7 +25,7 @@
class UserItemWidget : public QFrame{
Q_OBJECT
public:
- UserItemWidget(QWidget *parent=0, QString itemPath="", bool isDir=false);
+ UserItemWidget(QWidget *parent=0, QString itemPath="", bool isDir=false, bool goback=false);
UserItemWidget(QWidget *parent=0, XDGDesktop item= XDGDesktop());
~UserItemWidget();
@@ -36,7 +36,7 @@ private:
QString linkPath;
void createWidget();
- void setupButton();
+ void setupButton(bool disable = false);
private slots:
void buttonClicked();
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index 6f2d6526..e581e1c2 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -33,7 +33,6 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") );
ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") );
ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") );
- ui->tool_home_goup->setIcon( LXDG::findIcon("go-previous","") );
ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") );
//Connect the signals/slots
@@ -44,7 +43,6 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
connect(ui->tool_fav_dirs, SIGNAL(clicked()), this, SLOT(FavChanged()) );
connect(ui->combo_app_cats, SIGNAL(currentIndexChanged(int)), this, SLOT(updateApps()) );
connect(ui->tool_home_gohome, SIGNAL(clicked()), this, SLOT(slotGoHome()) );
- connect(ui->tool_home_goup, SIGNAL(clicked()), this, SLOT(slotGoUp()) );
connect(ui->tool_home_browse, SIGNAL(clicked()), this, SLOT(slotOpenDir()) );
//Setup the special buttons
@@ -237,20 +235,26 @@ void UserWidget::updateApps(){
void UserWidget::updateHome(){
ClearScrollArea(ui->scroll_home);
QDir homedir(ui->label_home_dir->whatsThis());
+ QStringList items;
if(QDir::homePath() == homedir.absolutePath()){
ui->label_home_dir->setText(tr("Home"));
ui->tool_home_gohome->setVisible(false);
- ui->tool_home_goup->setVisible(false);
}else{
- ui->label_home_dir->setText(homedir.dirName());
ui->tool_home_gohome->setVisible(true);
- ui->tool_home_goup->setVisible(true);
+ ui->label_home_dir->setText( this->fontMetrics().elidedText(homedir.dirName(), Qt::ElideRight, ui->label_home_dir->width()));
+ //Now make sure to put a "go back" button at the top of the list
+ QString dir = ui->label_home_dir->whatsThis();
+ if(dir.endsWith("/")){ dir.chop(1); }
+ dir.chop( dir.section("/",-1).length() );
+ items << dir;
}
ui->label_home_dir->setToolTip(ui->label_home_dir->whatsThis());
- QStringList items = homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ items << homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
for(int i=0; i<items.length(); i++){
//qDebug() << "New Home subdir:" << homedir.absoluteFilePath(items[i]);
- UserItemWidget *it = new UserItemWidget(ui->scroll_home->widget(), homedir.absoluteFilePath(items[i]), true);
+ UserItemWidget *it;
+ if(items[i].startsWith("/")){ it = new UserItemWidget(ui->scroll_home->widget(), items[i], true, true); }
+ else{ it = new UserItemWidget(ui->scroll_home->widget(), homedir.absoluteFilePath(items[i]), true, false); }
ui->scroll_home->widget()->layout()->addWidget(it);
connect(it, SIGNAL(RunItem(QString)), this, SLOT(slotGoToDir(QString)) );
connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
@@ -268,12 +272,6 @@ void UserWidget::slotGoHome(){
slotGoToDir(QDir::homePath());
}
-void UserWidget::slotGoUp(){
- QString dir = ui->label_home_dir->whatsThis();
- dir.chop( dir.section("/",-1).length() );
- slotGoToDir(dir);
-}
-
void UserWidget::slotOpenDir(){
LaunchItem(ui->label_home_dir->whatsThis());
}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
index 232b5e8b..da149c42 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
@@ -65,7 +65,6 @@ private slots:
void updateHome();
void slotGoToDir(QString dir);
void slotGoHome();
- void slotGoUp();
void slotOpenDir();
//Slots for the special buttons
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
index cecb43f4..764feddf 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
@@ -161,8 +161,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>96</width>
- <height>26</height>
+ <width>262</width>
+ <height>245</height>
</rect>
</property>
</widget>
@@ -258,8 +258,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>96</width>
- <height>26</height>
+ <width>262</width>
+ <height>245</height>
</rect>
</property>
</widget>
@@ -287,31 +287,6 @@
<number>1</number>
</property>
<item>
- <widget class="QToolButton" name="tool_home_goup">
- <property name="minimumSize">
- <size>
- <width>30</width>
- <height>30</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Go back</string>
- </property>
- <property name="text">
- <string notr="true">up</string>
- </property>
- <property name="iconSize">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
<widget class="QToolButton" name="tool_home_gohome">
<property name="minimumSize">
<size>
@@ -346,26 +321,45 @@
</property>
<property name="font">
<font>
+ <pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
<property name="text">
<string notr="true">&lt;current dir&gt;</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
- <number>5</number>
+ <number>0</number>
+ </property>
+ <property name="indent">
+ <number>0</number>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tool_home_browse">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize">
<size>
- <width>30</width>
+ <width>90</width>
<height>30</height>
</size>
</property>
bgstack15