Changeset 59fa950


Ignore:
Timestamp:
07/08/14 15:43:11 (14 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, releng/10.2, stable/10
Children:
c82371ac
Parents:
130bc0e
Message:

Now the desktop plugins look and function a lot better. I might need to add a "snap to grid" ability later though...

Location:
lumina/lumina-desktop
Files:
2 edited

Legend:

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

    r130bc0e r59fa950  
    4545        //Make sure the desktop area is transparent to show the background 
    4646        bgDesktop->setBackground( QBrush(Qt::NoBrush) ); 
    47         //bgDesktop->setVisible(false); 
    4847   
    4948  //Start the update processes 
     
    8180  LDPluginContainer *win = new LDPluginContainer(plug, desktoplocked); 
    8281  if(desktoplocked){ bgDesktop->addSubWindow(win, Qt::FramelessWindowHint); } 
    83   else{ bgDesktop->addSubWindow(win, Qt::WindowTitleHint); } 
     82  else{ bgDesktop->addSubWindow(win, Qt::CustomizeWindowHint); } 
    8483  win->loadInitialPosition(); 
    8584  win->show(); 
  • lumina/lumina-desktop/desktop-plugins/LDPluginContainer.h

    r130bc0e r59fa950  
    2424private: 
    2525        QSettings *settings; 
    26         bool locked; 
     26        bool locked, setup; 
    2727         
    2828public: 
    2929        LDPluginContainer(LDPlugin *plugin = 0, bool islocked = true) : QMdiSubWindow(){ 
    30           this->setWidget(plugin); 
    3130          locked = islocked; 
     31          setup=true; 
     32          if(locked){ this->setWindowFlags(Qt::FramelessWindowHint); } 
     33          else{ this->setWindowFlags(Qt::CustomizeWindowHint); } 
    3234          settings = plugin->settings; //save this pointer for access later 
    3335          this->setContentsMargins(0,0,0,0); 
    34           QRect set(settings->value("location/x",0).toInt(), settings->value("location/y",0).toInt(), settings->value("location/width",plugin->sizeHint().width()).toInt(), settings->value("location/height",plugin->sizeHint().height()).toInt()); 
    35           qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height(); 
    3636          if(!locked){ 
    37             this->setWindowTitle(tr("Drag to move")); 
     37            this->setWindowTitle(plugin->type()); 
     38            this->setWidget( new QWidget() ); 
    3839            //this->setStyleSheet("QMdiSubWindow{ padding: 0px; background: lightgrey; border: 2px solid grey; border-radius: 1px;} QMdiSubWindow::title{ background-color: lightgrey; height: 10px;  border: none; font: bold 8;}"); 
    39             QRect ipt = this->widget()->geometry(); 
    40             this->setGeometry( set.x()-ipt.x(), set.y()-ipt.y(), set.width()+(this->frameGeometry().width()-ipt.width()), set.height()+(this->frameGeometry().height()-ipt.height()) ); 
    4140          }else{ 
    4241            this->setStyleSheet("LDPluginContainer{ padding: 0px; background: transparent; border: none;}"); 
    43             this->setGeometry( settings->value("location/x",0).toInt(), settings->value("location/y",0).toInt(), settings->value("location/width",plugin->sizeHint().width()).toInt(), settings->value("location/height",plugin->sizeHint().height()).toInt()); 
     42            this->setWidget(plugin); 
    4443          } 
    4544        } 
     
    4948 
    5049        void loadInitialPosition(){ 
    51           //qDebug() << "Initial Plugin Location:" << settings->value("location/x",0).toInt() << settings->value("location/y",0).toInt() << settings->value("location/width",this->widget()->sizeHint().width()).toInt() << settings->value("location/height",this->widget()->sizeHint().height()).toInt(); 
    52           if(!locked){ 
    53             this->setGeometry( settings->value("location/x",0).toInt()-2, settings->value("location/y",0).toInt()-12, settings->value("location/width",this->widget()->sizeHint().width()).toInt()+4, settings->value("location/height",this->widget()->sizeHint().height()+14).toInt()); 
    54           }else{ 
    55             this->setGeometry( settings->value("location/x",0).toInt(), settings->value("location/y",0).toInt(), settings->value("location/width",this->widget()->sizeHint().width()).toInt(), settings->value("location/height",this->widget()->sizeHint().height()).toInt()); 
    56           } 
     50          QRect set(settings->value("location/x",0).toInt(), settings->value("location/y",0).toInt(), settings->value("location/width",this->widget()->sizeHint().width()).toInt(), settings->value("location/height",this->widget()->sizeHint().height()).toInt()); 
     51          qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height(); 
     52            if(set.height() < 10){ set.setHeight(10); } //to prevent foot-shooting 
     53            if(set.width() < 10){ set.setWidth(10); } //to prevent foot-shooting 
     54            this->setGeometry(set); 
     55          setup=false; //done with setup 
    5756        } 
    5857         
     
    6059        void moveEvent(QMoveEvent *event){ 
    6160          //Save this location to the settings 
    62           if(!locked){ 
     61          if(!locked && !setup){ 
    6362            //qDebug() << "DP Move:" << event->pos().x() << event->pos().y(); 
    64             settings->setValue("location/x", event->pos().x()+2); 
    65             settings->setValue("location/y", event->pos().y()+12); 
     63            settings->setValue("location/x", event->pos().x()); 
     64            settings->setValue("location/y", event->pos().y()); 
    6665            settings->sync(); 
    6766          } 
     67          event->ignore(); 
    6868        } 
    6969        void resizeEvent(QResizeEvent *event){ 
    7070          //Save this size info to the settings 
    71           if(!locked){ 
     71          if(!locked && !setup){ 
    7272            //qDebug() << "DP Resize:" << event->size().width() << event->size().height(); 
    73             settings->setValue("location/width", event->size().width()-4); 
    74             settings->setValue("location/height", event->size().height()-14); 
     73            settings->setValue("location/width", event->size().width()); 
     74            settings->setValue("location/height", event->size().height()); 
    7575            settings->sync(); 
    7676          } 
     77          event->ignore(); 
    7778        } 
    7879         
Note: See TracChangeset for help on using the changeset viewer.