Changeset bfcae6c


Ignore:
Timestamp:
05/16/14 11:17:08 (13 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
4d64bb8
Parents:
ec381ad
Message:

Update the lumina-config color-selecting option for the panel. Now the user should have a nice dialog that is easy to navigate instead of the RGB hack I had earlier.

Location:
lumina/lumina-config
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-config/mainUI.cpp

    r66e23d4 rbfcae6c  
    3939  connect(ui->radio_rotateBG, SIGNAL(toggled(bool)), SLOT(enableBGRotateTime(bool)) ); 
    4040  // - toolbar tab 
    41   connect(ui->spin_tb_R, SIGNAL(valueChanged(int)), this, SLOT(colorChanged()) ); 
    42   connect(ui->spin_tb_G, SIGNAL(valueChanged(int)), this, SLOT(colorChanged()) ); 
    43   connect(ui->spin_tb_B, SIGNAL(valueChanged(int)), this, SLOT(colorChanged()) ); 
    4441  connect(ppmenu, SIGNAL(triggered(QAction*)), this, SLOT(addPPlugin(QAction*)) ); 
    4542  connect(ui->tool_tb_leftplugin, SIGNAL(clicked()), this, SLOT(mvLPPlugin()) ); 
    4643  connect(ui->tool_tb_rightplugin, SIGNAL(clicked()), this, SLOT(mvRPPlugin()) ); 
    4744  connect(ui->tool_tb_rmplugin, SIGNAL(clicked()), this, SLOT(rmPPlugin()) ); 
     45  connect(ui->tool_tb_getcolor, SIGNAL(clicked()), this, SLOT(getNewColor()) ); 
    4846  // - menu tab 
    4947  connect(ui->tool_menu_findterminal, SIGNAL(clicked()), this, SLOT(findTerminalBinary()) ); 
     
    9290  ui->tool_tb_addpanel->setIcon( LXDG::findIcon("list-add", "") ); 
    9391  ui->tool_tb_rmpanel->setIcon( LXDG::findIcon("list-remove", "") ); 
     92  ui->tool_tb_getcolor->setIcon( LXDG::findIcon("fill-color","") ); 
    9493  // - Menu tab 
    9594  ui->tool_menu_add->setIcon( LXDG::findIcon("list-add","") ); 
     
    245244  else if(loc=="bottom"){ ui->combo_tb_location->setCurrentIndex(1); } 
    246245  // - background color 
    247   QString tbbg = settings->value(pprefix+"color", "rgb(255,250,250)").toString(); 
    248   tbbg = tbbg.section("(",1,1).section(")",0,0).simplified(); 
    249   ui->spin_tb_R->setValue(tbbg.section(",",0,0).toInt()); 
    250   ui->spin_tb_G->setValue(tbbg.section(",",1,1).toInt()); 
    251   ui->spin_tb_B->setValue(tbbg.section(",",2,2).toInt()); 
     246  panelcolor = settings->value(pprefix+"color", "rgb(255,250,250)").toString(); 
    252247  // - height 
    253248  ui->spin_tb_height->setValue( settings->value(pprefix+"height",22).toInt() ); 
     
    280275  settings->setValue(pprefix+"location",loc); 
    281276  // - background color 
    282   QString color = "rgb(%1,%2,%3)"; 
    283   color = color.arg(QString::number(ui->spin_tb_R->value()), QString::number(ui->spin_tb_G->value()), QString::number(ui->spin_tb_B->value()) ); 
    284   settings->setValue(pprefix+"color", color); 
     277  settings->setValue(pprefix+"color", panelcolor); 
    285278  // - height 
    286279  settings->setValue(pprefix+"height", ui->spin_tb_height->value()); 
     
    291284} 
    292285 
     286void MainUI::getNewColor(){ 
     287  //Convert the current color string into a QColor 
     288  QStringList col = panelcolor.section(")",0,0).section("(",1,1).split(","); 
     289  if(col.length()!=3){ col.clear(); col << "255" << "255" << "255"; } 
     290  QColor ccol = QColor::fromRgb(col[0].toInt(), col[1].toInt(), col[2].toInt()); 
     291  QColor ncol = QColorDialog::getColor(ccol, this, tr("Select Panel Color")); 
     292  //Now convert the new color into a usable string 
     293  panelcolor = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; 
     294  //Now update the sample widget background 
     295  colorChanged(); 
     296} 
     297 
    293298void MainUI::colorChanged(){ 
    294   //Get the RGB color 
    295   QString color = "rgb(%1,%2,%3)"; 
    296   color = color.arg(QString::number(ui->spin_tb_R->value()), QString::number(ui->spin_tb_G->value()), QString::number(ui->spin_tb_B->value()) ); 
    297   //Now change the color of the label for example 
    298   ui->label_tb_color->setStyleSheet("background: "+color+";"); 
     299  //Now change the color of the label for an example 
     300  ui->label_tb_colorsample->setStyleSheet("background: "+panelcolor+";"); 
    299301} 
    300302 
  • lumina/lumina-config/mainUI.h

    r66e23d4 rbfcae6c  
    1414#include <QFile> 
    1515#include <QMessageBox> 
     16#include <QColorDialog> 
     17#include <QColor> 
    1618 
    1719// libLumina includes 
     
    4042        LPlugins *PINFO; 
    4143        QMenu *ppmenu, *mpmenu; 
     44        QString panelcolor; 
    4245 
    4346        //General purpose functions (not connected to buttons) 
     
    6467        void loadPanelSettings(); 
    6568        void savePanelSettings(); 
     69        void getNewColor(); 
    6670        void colorChanged(); 
    6771        void addPPlugin(QAction*); 
  • lumina/lumina-config/mainUI.ui

    r66e23d4 rbfcae6c  
    7373      </property> 
    7474      <property name="currentIndex"> 
    75        <number>2</number> 
     75       <number>1</number> 
    7676      </property> 
    7777      <widget class="QWidget" name="tab_background"> 
     
    418418             <layout class="QHBoxLayout" name="horizontalLayout_2"> 
    419419              <item> 
    420                <widget class="QSpinBox" name="spin_tb_R"> 
    421                 <property name="styleSheet"> 
    422                  <string notr="true">QSpinBox{ background: rgba(255,0,0,180); }</string> 
    423                 </property> 
    424                 <property name="suffix"> 
    425                  <string/> 
    426                 </property> 
    427                 <property name="prefix"> 
    428                  <string/> 
    429                 </property> 
    430                 <property name="maximum"> 
    431                  <number>255</number> 
     420               <widget class="QLabel" name="label_tb_colorsample"> 
     421                <property name="sizePolicy"> 
     422                 <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> 
     423                  <horstretch>0</horstretch> 
     424                  <verstretch>0</verstretch> 
     425                 </sizepolicy> 
     426                </property> 
     427                <property name="text"> 
     428                 <string>Sample Panel Appearance</string> 
     429                </property> 
     430                <property name="alignment"> 
     431                 <set>Qt::AlignCenter</set> 
    432432                </property> 
    433433               </widget> 
    434434              </item> 
    435435              <item> 
    436                <widget class="QSpinBox" name="spin_tb_G"> 
    437                 <property name="styleSheet"> 
    438                  <string notr="true">background: rgba(0,255,0,180);</string> 
    439                 </property> 
    440                 <property name="prefix"> 
    441                  <string/> 
    442                 </property> 
    443                 <property name="maximum"> 
    444                  <number>255</number> 
     436               <widget class="QToolButton" name="tool_tb_getcolor"> 
     437                <property name="text"> 
     438                 <string>...</string> 
    445439                </property> 
    446440               </widget> 
    447               </item> 
    448               <item> 
    449                <widget class="QSpinBox" name="spin_tb_B"> 
    450                 <property name="styleSheet"> 
    451                  <string notr="true">background: rgba(0,0,255,180);</string> 
    452                 </property> 
    453                 <property name="prefix"> 
    454                  <string/> 
    455                 </property> 
    456                 <property name="maximum"> 
    457                  <number>255</number> 
    458                 </property> 
    459                </widget> 
    460               </item> 
    461               <item> 
    462                <spacer name="horizontalSpacer_6"> 
    463                 <property name="orientation"> 
    464                  <enum>Qt::Horizontal</enum> 
    465                 </property> 
    466                 <property name="sizeHint" stdset="0"> 
    467                  <size> 
    468                   <width>40</width> 
    469                   <height>20</height> 
    470                  </size> 
    471                 </property> 
    472                </spacer> 
    473441              </item> 
    474442             </layout> 
Note: See TracChangeset for help on using the changeset viewer.