Changeset a584991


Ignore:
Timestamp:
07/18/14 12:05:59 (10 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
4d19595
Parents:
b5bed61
Message:

Setup the desktop panels to now allow full transparency with the current window background. Also hard code a simple 1 pixel grey background with rounded corners for a cleaner edge for the panels.

Location:
lumina/lumina-desktop
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-desktop/LDesktop.cpp

    rb74ce79 ra584991  
    5050  QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); 
    5151  QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); 
    52   QTimer::singleShot(1,this, SLOT(UpdatePanels()) ); 
     52  QTimer::singleShot(10,this, SLOT(UpdatePanels()) ); 
    5353 
    5454} 
     
    9696  QTimer::singleShot(1,this, SLOT(UpdateBackground()) ); 
    9797  QTimer::singleShot(1,this, SLOT(UpdateDesktop()) ); 
    98   QTimer::singleShot(1,this, SLOT(UpdatePanels()) ); 
     98  QTimer::singleShot(10,this, SLOT(UpdatePanels()) ); 
    9999} 
    100100 
     
    293293      qDebug() << " -- Create panel "<< i; 
    294294      //New panel 
    295       PANELS << new LPanel(settings, desktopnumber, i); 
     295      PANELS << new LPanel(settings, desktopnumber, i, bgWindow); 
    296296    } 
    297297  } 
  • lumina/lumina-desktop/LPanel.cpp

    rc78ef7c ra584991  
    77#include "LPanel.h" 
    88 
    9 LPanel::LPanel(QSettings *file, int scr, int num) : QWidget(){ 
     9LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ 
    1010  //Take care of inputs 
    1111  qDebug() << " - Creating Panel:" << scr << num; 
     12  bgWindow = parent; //save for later 
     13  //Setup the widget overlay for the entire panel to provide transparency effects 
     14  panelArea = new QWidget(this); 
     15  QBoxLayout *tmp = new QBoxLayout(QBoxLayout::LeftToRight,this); 
     16        tmp->setContentsMargins(0,0,0,0); 
     17        this->setLayout(tmp); 
     18        tmp->addWidget(panelArea); 
    1219  settings = file; 
    1320  screennum = scr; 
     
    2128  this->setContentsMargins(0,0,0,0); 
    2229  this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 
    23   this->setWindowFlags( Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); 
     30  this->setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); 
    2431  this->setFocusPolicy(Qt::NoFocus); 
    2532  this->setWindowTitle(""); 
     
    2734  this->setAttribute(Qt::WA_AlwaysShowToolTips); 
    2835  this->setObjectName("LuminaPanelWidget"); 
     36  panelArea->setObjectName("LuminaPanelPluginWidget"); 
    2937  //LX11::SetAsPanel(this->winId()); //set proper type of window for a panel since Qt can't do it 
    3038  LX11::SetAsSticky(this->winId()); 
     
    3341    layout->setSpacing(1); 
    3442    //layout->setSizeConstraint(QLayout::SetFixedSize); 
    35   this->setLayout(layout); 
     43  panelArea->setLayout(layout); 
    3644  QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread 
    3745  connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes 
     
    96104  //Now update the appearance of the toolbar 
    97105  QString color = settings->value(PPREFIX+"color", "qlineargradient(spread:pad, x1:0.291182, y1:0, x2:0.693, y2:1, stop:0 rgb(255, 253, 250), stop:1 rgb(210, 210, 210))").toString(); 
    98   QString style = "QWidget#LuminaPanelWidget{ background: %1; }"; 
     106  QString style = "QWidget#LuminaPanelPluginWidget{ background: %1; border-radius: 5px; border: 1px solid grey; }"; 
    99107  style = style.arg(color); 
    100   this->setStyleSheet(style); 
     108  panelArea->setStyleSheet(style); 
     109  //Set the panelBrush properly instead ***TODO*** 
     110   
    101111  //Then go through the plugins and create them as necessary 
    102112  QStringList plugins = settings->value(PPREFIX+"pluginlist", QStringList()).toStringList(); 
     
    138148      //New Plugin 
    139149      qDebug() << " -- New Plugin:" << plugins[i]; 
    140       LPPlugin *plug = NewPP::createPlugin(plugins[i], this, horizontal); 
     150      LPPlugin *plug = NewPP::createPlugin(plugins[i], panelArea, horizontal); 
    141151      if(plug != 0){  
    142152        PLUGINS.insert(i, plug); 
     
    155165    delete PLUGINS.takeAt(i); //delete the actual widget 
    156166  } 
     167  this->update(); 
    157168  this->show(); //make sure the panel is visible now 
    158169} 
     
    174185 
    175186//=========== 
    176 // PRIVATE SLOTS 
     187// PROTECTED 
    177188//=========== 
     189void LPanel::paintEvent(QPaintEvent *event){ 
     190  QPainter *painter = new QPainter(this); 
     191  //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow 
     192  QRect rec = event->rect(); //already in global coords? (translating to bgWindow coords crashes Lumina) 
     193  //painter->setBackground( QBrush( QPixmap::grabWidget(bgWindow, rec)) ); //DOES NOT WORK!! 
     194  painter->drawPixmap(event->rect(), QPixmap::grabWidget(bgWindow, rec) ); 
     195  QWidget::paintEvent(event); //now pass the event along to the normal painting event 
     196} 
    178197 
  • lumina/lumina-desktop/LPanel.h

    rf912f51 ra584991  
    1919#include <QMoveEvent> 
    2020#include <QDesktopWidget> 
     21#include <QPainter> 
     22#include <QPaintEvent> 
    2123 
    2224#include "panel-plugins/NewPP.h" 
     
    3234        QString PPREFIX; //internal prefix for all settings 
    3335        QDesktopWidget *screen; 
     36        QWidget *bgWindow, *panelArea; 
    3437        bool defaultpanel, horizontal; 
    3538        int screennum; 
     
    3740 
    3841public: 
    39         LPanel(QSettings *file, int scr = 0, int num =0); //settings file, screen number, panel number 
     42        LPanel(QSettings *file, int scr = 0, int num =0, QWidget *parent=0); //settings file, screen number, panel number 
    4043        ~LPanel(); 
    4144 
     
    4952        void UpdateTheme(); //Theme Changed externally 
    5053 
     54protected: 
     55        void paintEvent(QPaintEvent *event); 
    5156}; 
    5257 
  • lumina/lumina-desktop/images/sample-colorschemes.ui

    r4d64bb8 ra584991  
    6565   <property name="geometry"> 
    6666    <rect> 
    67      <x>110</x> 
     67     <x>250</x> 
    6868     <y>170</y> 
    6969     <width>111</width> 
     
    8484    <rect> 
    8585     <x>10</x> 
    86      <y>100</y> 
     86     <y>50</y> 
    8787     <width>221</width> 
    8888     <height>51</height> 
     
    9696   </property> 
    9797  </widget> 
     98  <widget class="QLabel" name="label_6"> 
     99   <property name="geometry"> 
     100    <rect> 
     101     <x>10</x> 
     102     <y>220</y> 
     103     <width>381</width> 
     104     <height>41</height> 
     105    </rect> 
     106   </property> 
     107   <property name="styleSheet"> 
     108    <string notr="true">QLabel{ background: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(178, 45, 39, 255), stop:0.471591 rgba(221, 173, 68, 255), stop:0.528409 rgba(215, 202, 124, 255), stop:1 rgba(189, 17, 17, 255)); border-radius: 5px; border: 1px solid rgb(233, 218, 5);}</string> 
     109   </property> 
     110   <property name="text"> 
     111    <string>TextLabel</string> 
     112   </property> 
     113  </widget> 
    98114 </widget> 
    99115 <resources/> 
Note: See TracChangeset for help on using the changeset viewer.