diff options
-rw-r--r-- | lumina-config/mainUI.cpp | 16 | ||||
-rw-r--r-- | lumina-config/mainUI.h | 1 | ||||
-rw-r--r-- | lumina-config/mainUI.ui | 38 | ||||
-rw-r--r-- | lumina-desktop/LPanel.cpp | 61 | ||||
-rw-r--r-- | lumina-desktop/LPanel.h | 5 |
5 files changed, 100 insertions, 21 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 937cfcb5..3655b4a8 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -154,8 +154,10 @@ void MainUI::setupConnections(){ connect(ui->toolBox_panel2, SIGNAL(currentChanged(int)), this, SLOT(adjustpanel1()) ); connect(ui->combo_panel1_loc, SIGNAL(currentIndexChanged(int)), this, SLOT(adjustpanel2()) ); connect(ui->combo_panel2_loc, SIGNAL(currentIndexChanged(int)), this, SLOT(adjustpanel1()) ); - connect(ui->spin_panel1_size, SIGNAL(valueChanged(int)), this, SLOT(adjustpanel2()) ); - connect(ui->spin_panel2_size, SIGNAL(valueChanged(int)), this, SLOT(adjustpanel1()) ); + connect(ui->spin_panel1_size, SIGNAL(valueChanged(int)), this, SLOT(panelValChanged()) ); + connect(ui->spin_panel2_size, SIGNAL(valueChanged(int)), this, SLOT(panelValChanged()) ); + connect(ui->check_panel1_hidepanel, SIGNAL(clicked()), this, SLOT(panelValChanged()) ); + connect(ui->check_panel2_hidepanel, SIGNAL(clicked()), this, SLOT(panelValChanged()) ); connect(ui->tool_panel1_addplugin, SIGNAL(clicked()), this, SLOT(addpanel1plugin()) ); connect(ui->tool_panel1_rmplugin, SIGNAL(clicked()), this, SLOT(rmpanel1plugin()) ); connect(ui->tool_panel1_upplug, SIGNAL(clicked()), this, SLOT(uppanel1plugin()) ); @@ -446,6 +448,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ QString PPrefix = "panel"+QString::number(cdesk)+".0/"; ui->toolBox_panel1->setVisible(true); ui->spin_panel1_size->setValue( settings->value( PPrefix+"height",30).toInt() ); + ui->check_panel1_hidepanel->setChecked( settings->value(PPrefix+"hidepanel", false).toBool() ); QString loc = settings->value(PPrefix+"location","top").toString().toLower(); if(loc=="top"){ ui->combo_panel1_loc->setCurrentIndex(0); } else if(loc=="bottom"){ ui->combo_panel1_loc->setCurrentIndex(1); } @@ -471,6 +474,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ //Panel 1 defaults ui->toolBox_panel1->setVisible(false); //not initially visible ui->spin_panel1_size->setValue(30); + ui->check_panel1_hidepanel->setChecked( false ); ui->combo_panel1_loc->setCurrentIndex(0); //Top ui->list_panel1_plugins->clear(); ui->label_panel1_sample->setWhatsThis("rgba(255,255,255,160)"); @@ -481,6 +485,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ ui->toolBox_panel2->setVisible(true); QString PPrefix = "panel"+QString::number(cdesk)+".1/"; ui->spin_panel2_size->setValue( settings->value( PPrefix+"height",30).toInt() ); + ui->check_panel2_hidepanel->setChecked( settings->value(PPrefix+"hidepanel", false).toBool() ); QString loc = settings->value(PPrefix+"location","top").toString().toLower(); if(loc=="top"){ ui->combo_panel2_loc->setCurrentIndex(0); } else if(loc=="bottom"){ ui->combo_panel2_loc->setCurrentIndex(1); } @@ -505,6 +510,7 @@ void MainUI::loadCurrentSettings(bool screenonly){ //Panel 2 defaults ui->toolBox_panel2->setVisible(false); //not initially visible ui->spin_panel2_size->setValue(30); + ui->check_panel2_hidepanel->setChecked( false ); ui->combo_panel2_loc->setCurrentIndex(1); //Bottom ui->list_panel2_plugins->clear(); ui->label_panel2_sample->setWhatsThis("rgba(255,255,255,160)"); @@ -589,6 +595,7 @@ void MainUI::saveCurrentSettings(bool screenonly){ QString PPrefix = "panel"+QString::number(currentDesktop())+".0/"; settings->setValue(PPrefix+"color", ui->label_panel1_sample->whatsThis()); settings->setValue(PPrefix+"height", ui->spin_panel1_size->value()); + settings->setValue(PPrefix+"hidepanel", ui->check_panel1_hidepanel->isChecked()); int loc = ui->combo_panel1_loc->currentIndex(); if(loc==0){ settings->setValue(PPrefix+"location", "top"); } else if(loc==1){ settings->setValue(PPrefix+"location", "bottom"); } @@ -609,6 +616,7 @@ void MainUI::saveCurrentSettings(bool screenonly){ QString PPrefix = "panel"+QString::number(currentDesktop())+".1/"; settings->setValue(PPrefix+"color", ui->label_panel2_sample->whatsThis()); settings->setValue(PPrefix+"height", ui->spin_panel2_size->value()); + settings->setValue(PPrefix+"hidepanel", ui->check_panel2_hidepanel->isChecked()); int loc = ui->combo_panel2_loc->currentIndex(); if(loc==0){ settings->setValue(PPrefix+"location", "top"); } else if(loc==1){ settings->setValue(PPrefix+"location", "bottom"); } @@ -762,6 +770,10 @@ void MainUI::deskplugadded(){ //============= // PANELS PAGE //============= +void MainUI::panelValChanged(){ + if(!loading){ ui->push_save->setEnabled(true); modpan = true; } +} + void MainUI::addpanel1(){ ui->toolBox_panel1->setVisible(true); checkpanels(); diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index 0031a45f..12df6fde 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -100,6 +100,7 @@ private slots: //Panels Page + void panelValChanged(); void addpanel1(); void addpanel2(); void rmpanel1(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index 7f8f2ae8..9489523a 100644 --- a/lumina-config/mainUI.ui +++ b/lumina-config/mainUI.ui @@ -91,7 +91,7 @@ <enum>QFrame::StyledPanel</enum> </property> <property name="currentIndex"> - <number>5</number> + <number>1</number> </property> <widget class="QWidget" name="page_desktop"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -369,8 +369,8 @@ <rect> <x>0</x> <y>0</y> - <width>157</width> - <height>90</height> + <width>265</width> + <height>168</height> </rect> </property> <attribute name="label"> @@ -444,6 +444,13 @@ </item> </layout> </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="check_panel2_hidepanel"> + <property name="text"> + <string>Auto-hide Panel </string> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="page_panel2_plugins"> @@ -451,8 +458,8 @@ <rect> <x>0</x> <y>0</y> - <width>177</width> - <height>106</height> + <width>191</width> + <height>107</height> </rect> </property> <attribute name="label"> @@ -589,8 +596,8 @@ <rect> <x>0</x> <y>0</y> - <width>157</width> - <height>90</height> + <width>266</width> + <height>168</height> </rect> </property> <attribute name="label"> @@ -664,6 +671,13 @@ </item> </layout> </item> + <item row="3" column="1"> + <widget class="QCheckBox" name="check_panel1_hidepanel"> + <property name="text"> + <string>Auto-hide Panel </string> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="page_panel1_plugins"> @@ -671,8 +685,8 @@ <rect> <x>0</x> <y>0</y> - <width>177</width> - <height>106</height> + <width>191</width> + <height>107</height> </rect> </property> <attribute name="label"> @@ -1391,8 +1405,8 @@ <rect> <x>0</x> <y>0</y> - <width>515</width> - <height>78</height> + <width>129</width> + <height>16</height> </rect> </property> <property name="sizePolicy"> @@ -1499,7 +1513,7 @@ <x>0</x> <y>0</y> <width>579</width> - <height>20</height> + <height>21</height> </rect> </property> </widget> diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp index 4aa0acae..905e3b31 100644 --- a/lumina-desktop/LPanel.cpp +++ b/lumina-desktop/LPanel.cpp @@ -26,6 +26,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ //if(settings->value("defaultpanel",QString::number(screen->primaryScreen())+".0").toString()==QString::number(screennum)+"."+QString::number(num) ){ defaultpanel=true;} //else{defaultpanel=false; } horizontal=true; //use this by default initially + hidden = false; //use this by default //Setup the panel qDebug() << " -- Setup Panel"; this->setContentsMargins(0,0,0,0); @@ -60,6 +61,7 @@ void LPanel::UpdatePanel(){ settings->sync(); //make sure to catch external settings changes //First set the geometry of the panel and send the EWMH message to reserve that space qDebug() << "Update Panel"; + hidden = settings->value(PPREFIX+"hidepanel",false).toBool(); //default to true for the moment QString loc = settings->value(PPREFIX+"location","").toString(); if(loc.isEmpty() && defaultpanel){ loc="top"; } if(loc=="top" || loc=="bottom"){ @@ -82,29 +84,53 @@ void LPanel::UpdatePanel(){ this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry(xloc,0,xwid, ht ); - LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), ht, "top"); + if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), ht, "top"); } + else{ + LX11::ReservePanelLocation(this->winId(), xloc, 0, this->width(), 2, "top"); + hidepoint = QPoint(xloc, 2-ht); + showpoint = QPoint(xloc, 0); + this->move(hidepoint); //Could bleed over onto the screen above + } }else if(loc=="bottom"){ //bottom of screen QSize sz = QSize(xwid, ht); this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry(xloc,xhi-ht,xwid, ht ); - LX11::ReservePanelLocation(this->winId(), xloc, xhi-ht, this->width(), ht, "bottom"); + if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc, xhi-ht, this->width(), ht, "bottom"); } + else{ + LX11::ReservePanelLocation(this->winId(), xloc, xhi-2, this->width(), 2, "bottom"); + hidepoint = QPoint(xloc, xhi-2); + showpoint = QPoint(xloc, xhi-ht); + this->move(hidepoint); //Could bleed over onto the screen below + } }else if(loc=="left"){ //left side of screen QSize sz = QSize(ht, xhi); this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry(xloc,0, ht, xhi); - LX11::ReservePanelLocation(this->winId(), xloc, 0, ht, xhi, "left"); + if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc, 0, ht, xhi, "left"); } + else{ + LX11::ReservePanelLocation(this->winId(), xloc, 0, 2, xhi, "left"); + hidepoint = QPoint(xloc-ht+2, 0); + showpoint = QPoint(xloc, 0); + this->move(hidepoint); //Could bleed over onto the screen left + } }else{ //right side of screen QSize sz = QSize(ht, xhi); this->setMinimumSize(sz); this->setMaximumSize(sz); this->setGeometry(xloc+xwid-ht,0,ht, xhi); - LX11::ReservePanelLocation(this->winId(), xloc+xwid-ht, 0, ht, xhi, "right"); + if(!hidden){ LX11::ReservePanelLocation(this->winId(), xloc+xwid-ht, 0, ht, xhi, "right"); } + else{ + LX11::ReservePanelLocation(this->winId(), xloc+xwid-2, 0, 2, xhi, "right"); + hidepoint = QPoint(xloc+xwid-2, 0); + showpoint = QPoint(xloc+xwid-ht, 0); + this->move(hidepoint); //Could bleed over onto the screen right + } } //Now update the appearance of the toolbar QString color = settings->value(PPREFIX+"color", "rgba(255,255,255,160)").toString(); - QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 5px; border: 1px solid transparent; }"; + QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 3px; border: 1px solid %1; }"; style = style.arg(color); panelArea->setStyleSheet(style); @@ -154,6 +180,7 @@ void LPanel::UpdatePanel(){ i--; //make sure we don't miss the next item with the re-order } } + LSession::processEvents(); } //Now remove any extra plugins from the end for(int i=plugins.length(); i<PLUGINS.length(); i++){ @@ -164,6 +191,7 @@ void LPanel::UpdatePanel(){ } layout->takeAt(i); //remove from the layout delete PLUGINS.takeAt(i); //delete the actual widget + LSession::processEvents(); } this->update(); this->show(); //make sure the panel is visible now @@ -171,6 +199,7 @@ void LPanel::UpdatePanel(){ for(int i=0; i<PLUGINS.length(); i++){ QTimer::singleShot(0,PLUGINS[i], SLOT(OrientationChange())); } + LSession::processEvents(); } void LPanel::UpdateLocale(){ @@ -197,7 +226,9 @@ void LPanel::paintEvent(QPaintEvent *event){ QRect rec(event->rect().x(), event->rect().y(), event->rect().width(), event->rect().height()); //already in global coords? (translating to bgWindow coords crashes Lumina) //Need to translate that rectangle to the background image coordinates //qDebug() << "Rec:" << rec.x() << rec.y(); - rec.moveTo( this->mapToGlobal(rec.topLeft()) ); //Need to change to global coords for the main window + //Need to change to global coords for the main window + if(hidden && (this->pos()==hidepoint) ){ rec.moveTo( this->mapToGlobal(rec.topLeft()-hidepoint+showpoint) ); } + else{ rec.moveTo( this->mapToGlobal(rec.topLeft()) ); } //qDebug() << "Global Rec:" << rec.x() << rec.y() << screennum; rec.moveTo( rec.x()-screen->screenGeometry(screennum).x(), rec.y() ); //qDebug() << "Adjusted Global Rec:" << rec.x() << rec.y(); @@ -205,3 +236,21 @@ void LPanel::paintEvent(QPaintEvent *event){ QWidget::paintEvent(event); //now pass the event along to the normal painting event } +void LPanel::enterEvent(QEvent *event){ + qDebug() << "Panel Enter Event:"; + if(hidden){ + //Move the panel out so it is fully available + this->move(showpoint); + } + event->accept(); //just to quiet the compile warning +} + +void LPanel::leaveEvent(QEvent *event){ + qDebug() << "Panel Leave Event:"; + if(hidden){ + //Move the panel back to it's "hiding" spot + this->move(hidepoint); + } + event->accept(); //just to quiet the compile warning +} + diff --git a/lumina-desktop/LPanel.h b/lumina-desktop/LPanel.h index 4ffbf6d5..29911127 100644 --- a/lumina-desktop/LPanel.h +++ b/lumina-desktop/LPanel.h @@ -35,7 +35,8 @@ private: QString PPREFIX; //internal prefix for all settings QDesktopWidget *screen; QWidget *bgWindow, *panelArea; - bool defaultpanel, horizontal; + QPoint hidepoint, showpoint; //for hidden panels: locations when hidden/visible + bool defaultpanel, horizontal, hidden; int screennum; QList<LPPlugin*> PLUGINS; @@ -54,6 +55,8 @@ public slots: protected: void paintEvent(QPaintEvent *event); + void enterEvent(QEvent *event); + void leaveEvent(QEvent *event); }; #endif |