Changeset 2939

Show
Ignore:
Timestamp:
04/26/06 17:17:11 (3 years ago)
Author:
madcat
Message:

New skin and other updates.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hydranode/hngui/Jamfile

    r2929 r2939  
    1010          mainlayout.ui  
    1111          transfercontent.ui searchcontent.ui librarycontent.ui 
    12           settingstabs.ui filedetailsdock.ui searchdetailsdock.ui 
     12          settingstabs.ui  
     13           # filedetailsdock.ui searchdetailsdock.ui 
    1314          pagetemplate.ui home_homeactions.ui home_homepage.ui catdialog.ui 
    1415          commentframe.ui 
  • hydranode/hngui/customheader.cpp

    r2931 r2939  
    6161                return; 
    6262        } 
     63        QPixmap img(imgDir() + "listheader.png"); 
     64        if (img.isNull()) { 
     65                QHeaderView::paintSection(p, rect, logicalIndex); 
     66                return; 
     67        } 
    6368 
     69        p->drawPixmap( 
     70                rect.x(), rect.y(), img.scaled(rect.width(), img.height(),  
     71                Qt::IgnoreAspectRatio) 
     72        ); 
     73 
     74/* 
    6475        p->setBrush(QColor(201, 238, 253, 183)); 
    65 //      if (geometry().contains(mapFromGlobal(QCursor::pos()))) { 
    66 //              p->setBrush(QColor(255, 0, 0, 183)); 
    67 //              p->setPen(QColor(0, 0, 0, 183)); 
    68 //      } else { 
    69                 p->setPen(QColor(201, 238, 253, 183)); 
    70 //      } 
     76        p->setPen(QColor(201, 238, 253, 183)); 
    7177 
    7278        p->drawRect(rect.x(), rect.y(), rect.width(), rect.height() - 1); 
    7379 
    74 //      if (rect.contains(mapFromGlobal(QCursor::pos()))) { 
    75                 p->setPen(QColor(0, 0, 0, 183)); 
    76                 p->drawLine(rect.bottomLeft(), rect.bottomRight()); 
    77                 p->drawLine(rect.topLeft(), rect.topRight()); 
    78                 p->setPen(QColor(0, 0, 0, 50)); 
    79 //              p->drawLine(rect.topLeft(), rect.bottomLeft()); 
    80 //      } 
    81  
     80        p->setPen(QColor(0, 0, 0, 183)); 
     81        p->drawLine(rect.bottomLeft(), rect.bottomRight()); 
     82        p->drawLine(rect.topLeft(), rect.topRight()); 
     83        p->setPen(QColor(0, 0, 0, 50)); 
     84*/ 
    8285        QString text( 
    8386                model()->headerData( 
     
    9093        p->setPen(Qt::black); 
    9194        p->drawText(xPos, yPos, text); 
     95 
     96        QPixmap sep(imgDir() + "listseparator.png"); 
     97        if (sep.isNull()) { 
     98                return; 
     99        } 
     100//      if (visualIndexAt(logicalIndex) > 0) { 
     101//              p->drawPixmap(rect.x(), 0, sep); 
     102//      } 
     103        if (visualIndexAt(logicalIndex) < count() - hiddenSectionCount()) { 
     104                p->drawPixmap(rect.x() + rect.width() - 1, 0, sep); 
     105        } 
    92106} 
    93107 
    94108QSize CustomHeader::sizeHint() const { 
    95109        QSize ret = QHeaderView::sizeHint(); 
    96         ret.setHeight(20); 
     110        ret.setHeight(18); 
    97111        return ret; 
    98112} 
  • hydranode/hngui/downloadlist.cpp

    r2932 r2939  
    587587void DownloadList::paintEvent(QPaintEvent *evt) { 
    588588        HTreeWidget::paintEvent(evt); 
    589         QPainter p(viewport()); 
    590         QPixmap btn(imgDir() + "opendetails.png"); 
    591         if (!btn.isNull()) { 
    592                 int posX = (window()->width() - btn.width()) / 2; 
    593                 int posY = window()->height() - btn.height(); 
    594                 p.drawPixmap( 
    595                         viewport()->mapFrom(window(), QPoint(posX, posY)), btn 
    596                 ); 
    597         } 
    598 //      QPainter p2(this); 
    599 //      QPixmap bar(imgDir() + "aclistseparator.png"); 
    600 //      if (!bar.isNull()) { 
    601 //              p2.drawPixmap(0, 0, bar.scaled(width(), bar.height())); 
     589//      QPainter p(viewport()); 
     590//      QPixmap btn(imgDir() + "opendetails.png"); 
     591//      if (!btn.isNull()) { 
     592//              int posX = (window()->width() - btn.width()) / 2; 
     593//              int posY = window()->height() - btn.height(); 
     594//              p.drawPixmap( 
     595//                      viewport()->mapFrom(window(), QPoint(posX, posY)), btn 
     596//              ); 
    602597//      } 
    603598} 
  • hydranode/hngui/home_homeactions.ui

    r2865 r2939  
    5858    </spacer> 
    5959   </item> 
    60    <item> 
    61     <widget class="QToolButton" name="toolButton_4" > 
    62      <property name="maximumSize" > 
    63       <size> 
    64        <width>20</width> 
    65        <height>20</height> 
    66       </size> 
    67      </property> 
    68      <property name="text" > 
    69       <string>...</string> 
    70      </property> 
    71      <property name="icon" > 
    72       <iconset resource="gui.qrc" >:/types/icons/unknown.png</iconset> 
    73      </property> 
    74      <property name="checkable" > 
    75       <bool>true</bool> 
    76      </property> 
    77      <property name="autoRaise" > 
    78       <bool>true</bool> 
    79      </property> 
    80     </widget> 
    81    </item> 
    8260  </layout> 
    8361 </widget> 
  • hydranode/hngui/hometabs.cpp

    r2931 r2939  
    5353 
    5454        m_ui->newsFeed->addFeed( 
     55                "Slashdot - Stuff that matters",  
     56                QUrl("http://rss.slashdot.org/Slashdot/slashdot"), 10 
     57        ); 
     58        m_ui->newsFeed->addFeed( 
    5559                "BBC World News",  
    5660                QUrl( 
     
    6670                "Tom's Hardware News",  
    6771                QUrl("http://www.pheedo.com/f/toms_hardware"), 10 
    68         ); 
    69         m_ui->newsFeed->addFeed( 
    70                 "Slashdot - News for Nerds",  
    71                 QUrl("http://rss.slashdot.org/Slashdot/slashdot"), 10 
    7272        ); 
    7373        m_ui->newsFeed->addFeed( 
     
    130130        p.setPen(palette().color(QPalette::Mid)); 
    131131        p.setBrush(palette().base()); 
    132         p.drawRect(5, 25, width() - 11, height() - 31); 
     132        p.drawRect( 
     133                FRAMELBORDER, ACBAR_HEIGHT,  
     134                width() - FRAMELBORDER - FRAMERBORDER - 1,  
     135                height() - ACBAR_HEIGHT - FRAMEBBORDER - 1 
     136        ); 
    133137 
    134138        QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 
    135139        if (!m_background.isNull() && conf.value("EnableBack").toBool()) { 
    136140                p.drawPixmap( 
    137                         width() - m_background.width() - 6
    138                         height() - m_background.height() - 6
     141                        width() - m_background.width() - FRAMELBORDER - 1
     142                        height() - m_background.height() - FRAMEBBORDER - 1
    139143                        m_background 
    140144                ); 
     
    173177        feeds["CNN World News"] = m.addAction("CNN World News"); 
    174178        feeds["Tom's Hardware News"] = m.addAction("Tom's Hardware News"); 
    175         feeds["Slashdot - News for Nerds"] = m.addAction( 
    176                 "Slashdot - News for Nerds" 
     179        feeds["Slashdot - Stuff that matters"] = m.addAction( 
     180                "Slashdot - Stuff that matters" 
    177181        ); 
    178182        feeds["Slyck - File Sharing News"] = m.addAction( 
     
    212216        p.setPen(QColor(153, 153, 153)); 
    213217        p.setBrush(QColor(218, 202, 191, 183)); 
    214         p.drawRect(0, -1, width(), height()); 
     218        p.drawRect(-1, -1, width() + 1, height()); 
    215219        return; 
    216220 
     
    239243        p.setPen(QColor(153, 153, 153)); 
    240244        p.setBrush(QColor(173, 215, 244, 183)); 
    241         p.drawRect(0, -1, width(), height()); 
     245        p.drawRect(-1, -1, width() + 1, height()); 
    242246        return; 
    243247 
  • hydranode/hngui/htreewidget.cpp

    r2931 r2939  
    3636                QPainter p(viewport()); 
    3737                QPoint pos; 
    38                 pos.setX(parentWidget()->width() - m_background.width() - 6); 
    39                 pos.setY(parentWidget()->height() - m_background.height() - 6); 
     38                pos.setX( 
     39                        parentWidget()->width() - m_background.width()  
     40                        - FRAMERBORDER - 1 
     41                ); 
     42                pos.setY( 
     43                        parentWidget()->height() - m_background.height()  
     44                        - FRAMERBORDER - 1 
     45                ); 
    4046                pos = viewport()->mapFrom(parentWidget(), pos); 
    4147                p.drawPixmap(pos, m_background); 
  • hydranode/hngui/librarycontent.ui

    r2864 r2939  
    2323    <number>0</number> 
    2424   </property> 
    25    <item row="1" column="0" colspan="3" > 
     25   <item row="1" column="2" > 
     26    <spacer> 
     27     <property name="orientation" > 
     28      <enum>Qt::Horizontal</enum> 
     29     </property> 
     30     <property name="sizeType" > 
     31      <enum>QSizePolicy::Fixed</enum> 
     32     </property> 
     33     <property name="sizeHint" > 
     34      <size> 
     35       <width>3</width> 
     36       <height>0</height> 
     37      </size> 
     38     </property> 
     39    </spacer> 
     40   </item> 
     41   <item row="0" column="0" colspan="3" > 
    2642    <widget class="QFrame" name="actionBar" > 
    2743     <property name="minimumSize" > 
    2844      <size> 
    2945       <width>16</width> 
    30        <height>25</height> 
     46       <height>22</height> 
    3147      </size> 
    3248     </property> 
     
    3450      <size> 
    3551       <width>16777215</width> 
    36        <height>25</height> 
     52       <height>22</height> 
    3753      </size> 
    3854     </property> 
     
    5066       <number>0</number> 
    5167      </property> 
    52       <item row="0" column="0" > 
    53        <widget class="QToolButton" name="typeSelect" > 
    54         <property name="minimumSize" > 
    55          <size> 
    56           <width>36</width> 
    57           <height>0</height> 
    58          </size> 
    59         </property> 
    60         <property name="maximumSize" > 
    61          <size> 
    62           <width>16777215</width> 
    63           <height>20</height> 
    64          </size> 
    65         </property> 
    66         <property name="text" > 
    67          <string>Type</string> 
    68         </property> 
    69         <property name="autoRaise" > 
    70          <bool>true</bool> 
    71         </property> 
    72        </widget> 
    73       </item> 
    7468      <item row="0" column="3" > 
    75        <widget class="QToolButton" name="dirButton" > 
    76         <property name="text" > 
    77          <string>Shared</string> 
    78         </property> 
    79         <property name="icon" > 
    80          <iconset resource="gui.qrc" >:/transfer/icons/clear16.png</iconset> 
    81         </property> 
    82         <property name="toolButtonStyle" > 
    83          <enum>Qt::ToolButtonTextBesideIcon</enum> 
    84         </property> 
    85         <property name="autoRaise" > 
    86          <bool>true</bool> 
    87         </property> 
    88        </widget> 
    89       </item> 
    90       <item row="0" column="8" > 
    91        <widget class="QToolButton" name="toolButton_4" > 
    92         <property name="maximumSize" > 
    93          <size> 
    94           <width>20</width> 
    95           <height>20</height> 
    96          </size> 
    97         </property> 
    98         <property name="text" > 
    99          <string>NeliButton</string> 
    100         </property> 
    101         <property name="icon" > 
    102          <iconset resource="gui.qrc" >:/types/icons/unknown.png</iconset> 
    103         </property> 
    104         <property name="checkable" > 
    105          <bool>true</bool> 
    106         </property> 
    107         <property name="autoRaise" > 
    108          <bool>true</bool> 
    109         </property> 
    110        </widget> 
    111       </item> 
    112       <item row="0" column="7" > 
    11369       <spacer> 
    11470        <property name="orientation" > 
     
    11672        </property> 
    11773        <property name="sizeType" > 
    118          <enum>QSizePolicy::Maximum</enum> 
     74         <enum>QSizePolicy::MinimumExpanding</enum> 
    11975        </property> 
    12076        <property name="sizeHint" > 
    12177         <size> 
    122           <width>25</width> 
     78          <width>0</width> 
    12379          <height>23</height> 
    12480         </size> 
     
    12682       </spacer> 
    12783      </item> 
     84      <item row="0" column="2" > 
     85       <widget class="QToolButton" name="removeButton" > 
     86        <property name="text" > 
     87         <string>Remove</string> 
     88        </property> 
     89        <property name="icon" > 
     90         <iconset resource="gui.qrc" >:/transfer/icons/clear16.png</iconset> 
     91        </property> 
     92        <property name="toolButtonStyle" > 
     93         <enum>Qt::ToolButtonTextBesideIcon</enum> 
     94        </property> 
     95        <property name="autoRaise" > 
     96         <bool>true</bool> 
     97        </property> 
     98       </widget> 
     99      </item> 
    128100      <item row="0" column="1" > 
     101       <widget class="QToolButton" name="addButton" > 
     102        <property name="text" > 
     103         <string>Add</string> 
     104        </property> 
     105        <property name="icon" > 
     106         <iconset resource="gui.qrc" >:/transfer/icons/clear16.png</iconset> 
     107        </property> 
     108        <property name="toolButtonStyle" > 
     109         <enum>Qt::ToolButtonTextBesideIcon</enum> 
     110        </property> 
     111        <property name="autoRaise" > 
     112         <bool>true</bool> 
     113        </property> 
     114       </widget> 
     115      </item> 
     116      <item row="0" column="0" > 
     117       <widget class="QToolButton" name="dirButton" > 
     118        <property name="text" > 
     119         <string>Filter</string> 
     120        </property> 
     121        <property name="icon" > 
     122         <iconset resource="gui.qrc" >:/transfer/icons/clear16.png</iconset> 
     123        </property> 
     124        <property name="toolButtonStyle" > 
     125         <enum>Qt::ToolButtonTextBesideIcon</enum> 
     126        </property> 
     127        <property name="autoRaise" > 
     128         <bool>true</bool> 
     129        </property> 
     130       </widget> 
     131      </item> 
     132      <item row="0" column="4" > 
     133       <widget class="QToolButton" name="typeSelect" > 
     134        <property name="minimumSize" > 
     135         <size> 
     136          <width>36</width> 
     137          <height>0</height> 
     138         </size> 
     139        </property> 
     140        <property name="maximumSize" > 
     141         <size> 
     142          <width>16777215</width> 
     143          <height>20</height> 
     144         </size> 
     145        </property> 
     146        <property name="text" > 
     147         <string>Type</string> 
     148        </property> 
     149        <property name="autoRaise" > 
     150         <bool>true</bool> 
     151        </property> 
     152       </widget> 
     153      </item> 
     154      <item row="0" column="5" > 
    129155       <widget class="QLineEdit" name="filterText" > 
    130156        <property name="maximumSize" > 
     
    136162       </widget> 
    137163      </item> 
    138       <item row="0" column="4" > 
    139        <spacer> 
    140         <property name="orientation" > 
    141          <enum>Qt::Horizontal</enum> 
    142         </property> 
    143         <property name="sizeType" > 
    144          <enum>QSizePolicy::MinimumExpanding</enum> 
    145         </property> 
    146         <property name="sizeHint" > 
    147          <size> 
    148           <width>0</width> 
    149           <height>23</height> 
    150          </size> 
    151         </property> 
    152        </spacer> 
    153       </item> 
    154       <item row="0" column="2" > 
     164      <item row="0" column="6" > 
    155165       <widget class="QToolButton" name="filterButton" > 
    156166        <property name="text" > 
     
    169179   </item> 
    170180   <item row="2" column="1" > 
     181    <spacer> 
     182     <property name="orientation" > 
     183      <enum>Qt::Vertical</enum> 
     184     </property> 
     185     <property name="sizeType" > 
     186      <enum>QSizePolicy::Fixed</enum> 
     187     </property> 
     188     <property name="sizeHint" > 
     189      <size> 
     190       <width>0</width> 
     191       <height>8</height> 
     192      </size> 
     193     </property> 
     194    </spacer> 
     195   </item> 
     196   <item row="1" column="0" > 
     197    <spacer> 
     198     <property name="orientation" > 
     199      <enum>Qt::Horizontal</enum> 
     200     </property> 
     201     <property name="sizeType" > 
     202      <enum>QSizePolicy::Fixed</enum> 
     203     </property> 
     204     <property name="sizeHint" > 
     205      <size> 
     206       <width>3</width> 
     207       <height>0</height> 
     208      </size> 
     209     </property> 
     210    </spacer> 
     211   </item> 
     212   <item row="1" column="1" > 
    171213    <widget class="LibraryList" name="sharedList" > 
    172214     <property name="sizePolicy" > 
     
    200242     </property> 
    201243    </widget> 
    202    </item> 
    203    <item row="2" column="0" > 
    204     <spacer> 
    205      <property name="orientation" > 
    206       <enum>Qt::Horizontal</enum> 
    207      </property> 
    208      <property name="sizeType" > 
    209       <enum>QSizePolicy::Fixed</enum> 
    210      </property> 
    211      <property name="sizeHint" > 
    212       <size> 
    213        <width>5</width> 
    214        <height>0</height> 
    215       </size> 
    216      </property> 
    217     </spacer> 
    218    </item> 
    219    <item row="2" column="2" > 
    220     <spacer> 
    221      <property name="orientation" > 
    222       <enum>Qt::Horizontal</enum> 
    223      </property> 
    224      <property name="sizeType" > 
    225       <enum>QSizePolicy::Fixed</enum> 
    226      </property> 
    227      <property name="sizeHint" > 
    228       <size> 
    229        <width>5</width> 
    230        <height>0</height> 
    231       </size> 
    232      </property> 
    233     </spacer> 
    234    </item> 
    235    <item row="3" column="1" > 
    236     <spacer> 
    237      <property name="orientation" > 
    238       <enum>Qt::Vertical</enum> 
    239      </property> 
    240      <property name="sizeType" > 
    241       <enum>QSizePolicy::Fixed</enum> 
    242      </property> 
    243      <property name="sizeHint" > 
    244       <size> 
    245        <width>0</width> 
    246        <height>5</height> 
    247       </size> 
    248      </property> 
    249     </spacer> 
    250244   </item> 
    251245  </layout> 
  • hydranode/hngui/librarylist.h

    r2925 r2939  
    3636        QString filterText() const { return m_filterText; } 
    3737        void checkAssignCat(LibraryListItem *it); 
     38        static Engine::SharedFilesList* getList() { return s_list; } 
    3839protected: 
    3940        void contextMenuEvent(QContextMenuEvent *e); 
  • hydranode/hngui/librarytabs.cpp

    r2931 r2939  
    2626#include <QHeaderView> 
    2727#include <QMenu> 
     28#include <QFileDialog> 
    2829 
    2930LibraryPage::LibraryPage(QWidget *parent) : QWidget(parent) { 
     
    3637        connect(m_ui->dirButton, SIGNAL(clicked()), SLOT(showDirMenu())); 
    3738        connect(m_ui->typeSelect, SIGNAL(clicked()), SLOT(showTypeMenu())); 
     39        connect(m_ui->addButton, SIGNAL(clicked()), SLOT(addShared())); 
     40        connect(m_ui->removeButton, SIGNAL(clicked()), SLOT(remShared())); 
    3841 
    3942        QPalette palette = m_ui->filterText->palette(); 
     
    7982} 
    8083 
     84#if 0 
     85class DirMenu : public QMenu { 
     86public: 
     87        DirMenu(QWidget *parent = 0); 
     88protected: 
     89        void customContextMenuRequested(const QPoint &pos); 
     90}; 
     91 
     92DirMenu::DirMenu(QWidget *parent) : QMenu(parent) {} 
     93 
     94void DirMenu::customContextMenuRequested(const QPoint &pos) { 
     95        QAction *ac = actionAt(pos); 
     96        if (ac && ac->text() != "All Files" && ac->text() != "Add folder...") { 
     97                QMenu menu(this); 
     98                QAction *remAc = menu.addAction("Remove"); 
     99                if (menu.exec(pos) == remAc) { 
     100                        QString dirName = ac->text(); 
     101#ifdef Q_OS_WIN32 
     102                        dirName = dirName.replace("/", "\\"); 
     103#endif 
     104                        LibraryList::getList()->remShared( 
     105                                dirName.toStdString() 
     106                        ); 
     107                } 
     108        } 
     109} 
     110#endif 
     111 
    81112void LibraryPage::showDirMenu() { 
    82113        QMenu menu(this); 
     
    99130        } 
    100131 
    101         menu.addSeparator(); 
    102132        if (fCol == -1) { 
    103133                menu.addAction(QIcon(":/transfer/icons/clear16"), "All Files"); 
     
    106136        } 
    107137 
     138//      menu.addSeparator(); 
     139//      QAction *addAc = menu.addAction( 
     140//              QIcon(":/types/icons/pluss16"), "Add folder..." 
     141//              "Add folder..." 
     142//      ); 
    108143 
    109144        QPoint pos(0, m_ui->dirButton->height()); 
     
    112147        QAction *ret = menu.exec(pos); 
    113148 
     149//      if (ret && ret == addAc) { 
     150//              QString dirName = QFileDialog::getExistingDirectory( 
     151//                      window(), "Choose directory to be shared", 
     152//                      "", QFileDialog::ShowDirsOnly 
     153//              ); 
     154//              if (dirName.size()) { 
     155//#ifdef Q_OS_WIN32 
     156//                      dirName = dirName.replace("/", "\\"); 
     157//#endif 
     158//                      LibraryList::getList()->addShared( 
     159//                              dirName.toStdString() 
     160//                      ); 
     161//              } 
     162//      } else  
    114163        if (ret && ret->text() == "All Files") { 
    115164                m_ui->sharedList->filterByText(""); 
     
    120169        m_ui->dirButton->setChecked(false); 
    121170        m_ui->dirButton->setCheckable(false); 
     171} 
     172 
     173void LibraryPage::addShared() { 
     174        QString dirName = QFileDialog::getExistingDirectory( 
     175                window(), "Choose directory to be shared", 
     176                "", QFileDialog::ShowDirsOnly 
     177        ); 
     178        if (dirName.size()) { 
     179//#ifdef Q_OS_WIN32 
     180//              dirName = dirName.replace("/", "\\"); 
     181//#endif 
     182                LibraryList::getList()->addShared( 
     183                        dirName.toStdString() 
     184                ); 
     185        } 
     186} 
     187 
     188void LibraryPage::remShared() { 
     189        m_ui->removeButton->setCheckable(true); 
     190        m_ui->removeButton->setChecked(true); 
     191 
     192        QMenu menu(this); 
     193        int count = SettingsPage::instance().value("SharedDirs/Count").toInt(); 
     194        for (int i = 1; i <= count; ++i) { 
     195                QString dirName = SettingsPage::instance().value( 
     196                        QString("SharedDirs/Dir_%1").arg(i) 
     197                ); 
     198//#ifdef Q_OS_WIN32 
     199//              dirName = dirName.replace("/", "\\"); 
     200//#endif 
     201                /* QAction *ac =*/ menu.addAction(dirName); 
     202//              if (fCol == 4 && fText == dirName) { 
     203//                      ac->setIcon(QIcon(":/transfer/icons/clear16")); 
     204//              } 
     205        } 
     206        QPoint pos(0, m_ui->removeButton->height()); 
     207        pos = m_ui->removeButton->mapToGlobal(pos); 
     208 
     209        QAction *ret = menu.exec(pos); 
     210        if (ret) { 
     211                LibraryList::getList()->remShared(ret->text().toStdString()); 
     212        } 
     213        m_ui->removeButton->setCheckable(false); 
     214        m_ui->removeButton->setChecked(false); 
    122215} 
    123216 
  • hydranode/hngui/librarytabs.h

    r2883 r2939  
    4040        void showDirMenu(); 
    4141        void showTypeMenu(); 
     42        void addShared(); 
     43        void remShared(); 
    4244 
    4345        void updateButtons(); 
  • hydranode/hngui/main.cpp

    r2936 r2939  
    8888        m_rb = QPixmap(imgDir() + "framerborder.png"); 
    8989        m_bb = QPixmap(imgDir() + "framebborder.png"); 
    90         m_kaar = QPixmap(imgDir() + "kaar.png"); 
     90        m_kaar     = QPixmap(imgDir() + "kaar.png"); 
     91        m_kaarOrig = QPixmap(imgDir() + "kaar.png"); 
     92        m_leftEar  = QPixmap(imgDir() + "leftear.png"); 
     93        m_rightEar = QPixmap(imgDir() + "rightear.png"); 
    9194} 
    9295 
     
    150153 
    151154        QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 
    152         if (conf.contains("WindowPos")) { 
    153                 move(conf.value("WindowPos").toPoint()); 
    154         } 
    155155#ifdef Q_WS_X11 
    156156        QSize sz(690, 540); 
     
    158158        QSize sz(630, 460); 
    159159#endif 
    160         if (conf.contains("WindowWidth") && conf.contains("WindowHeight")) { 
    161                 sz.setWidth(conf.value("WindowWidth").toInt()); 
    162                 sz.setHeight(conf.value("WindowHeight").toInt()); 
    163         } 
    164         resize(sz); 
     160        if (conf.value("Maximized").toBool()) { 
     161                showMaximized(); 
     162        } else { 
     163                if (conf.contains("WindowWidth")) { 
     164                        sz.setWidth(conf.value("WindowWidth").toInt()); 
     165                } 
     166                if (conf.contains("WindowHeight")) { 
     167                        sz.setHeight(conf.value("WindowHeight").toInt()); 
     168                } 
     169                resize(sz); 
     170                if (conf.contains("WindowPos")) { 
     171                        move(conf.value("WindowPos").toPoint()); 
     172                } 
     173        } 
    165174 
    166175        if (!conf.value("ShowTitle").toBool()) { 
     
    191200        ); 
    192201 
    193         connect(m_ui->right1, SIGNAL(clicked()), SLOT(close())); 
     202        connect(m_ui->right1, SIGNAL(clicked()), SLOT(doClose())); 
    194203        connect(m_ui->right2, SIGNAL(clicked()), SLOT(maxRestore())); 
    195         connect(m_ui->right3, SIGNAL(clicked()), SLOT(showMinimized())); 
     204        connect(m_ui->right3, SIGNAL(clicked()), SLOT(doShowMinimized())); 
    196205        connect(m_ui->left1, SIGNAL(clicked()), SLOT(toggleTitleBar())); 
    197206//      connect(m_ui->left1, SIGNAL(clicked()), SLOT(toggleTitleBar())); 
     
    210219        m_ui->right3->installEventFilter(this); 
    211220 
     221        // needed to properly update mask 
     222        if (!m_showTitle) { 
     223                paintEvent(0); 
     224        } 
     225 
    212226        setMouseTracking(true); 
    213227} 
    214228 
    215229void MainWindow::toggleTitleBar() { 
     230        if (isMaximized()) { 
     231                return; 
     232        } 
    216233#ifdef Q_OS_WIN32 
    217234        QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 
     
    459476        } 
    460477        QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 
    461         conf.setValue("WindowPos", frameGeometry().topLeft()); 
    462         conf.setValue("WindowWidth", width()); 
    463         conf.setValue("WindowHeight", height()); 
     478        if (isMaximized()) { 
     479                conf.setValue("Maximized", true); 
     480        } else { 
     481                conf.setValue("WindowPos", frameGeometry().topLeft()); 
     482                conf.setValue("WindowWidth", width()); 
     483                conf.setValue("WindowHeight", height()); 
     484                conf.setValue("Maximized", false); 
     485        } 
    464486        conf.setValue("ShowTitle", m_showTitle); 
    465487} 
     
    482504} 
    483505 
     506QRegion MainWindow::getHeaderMask() const { 
     507//              QRegion reg( 
     508//                      QPixmap::fromImage( 
     509//                              m_kaar.toImage().createAlphaMask( 
     510//                                      Qt::AutoColor | Qt::DiffuseDither  
     511//                                      | Qt::DiffuseAlphaDither 
     512//                              ), Qt::AutoColor | Qt::DiffuseDither  
     513//                              | Qt::DiffuseAlphaDither 
     514//                      ) 
     515//              ); 
     516        return QRegion( 
     517                QPixmap::fromImage( 
     518                        m_kaar.toImage().createAlphaMask( 
     519                                Qt::AutoColor | Qt::DiffuseDither  
     520                                | Qt::DiffuseAlphaDither 
     521                        ), Qt::AutoColor | Qt::DiffuseDither  
     522                        | Qt::DiffuseAlphaDither 
     523                ) 
     524        ); 
     525 
     526} 
     527 
     528void MainWindow::updateMask() { 
     529        if (!m_kaar.isNull()) { 
     530                QRegion reg = getHeaderMask(); 
     531                QRegion frame( 
     532                        0, m_kaar.height(), width(), height() - m_kaar.height() 
     533                ); 
     534                setMask(reg.unite(frame)); 
     535        } 
     536} 
     537 
     538// null parameter here is done on startup to force first header scaling 
    484539void MainWindow::paintEvent(QPaintEvent *e) { 
    485         QMainWindow::paintEvent(e); 
     540        if (e) { 
     541                QMainWindow::paintEvent(e); 
     542        } 
     543 
    486544        QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 
    487545        if (!conf.value("EnableBars").toBool()) { 
     
    491549        if (m_kaar.isNull()) { 
    492550                return; 
    493         } 
     551        } else if (!e || m_kaar.width() != geometry().width()) { 
     552                // generate the header image 
     553                m_kaar = m_kaarOrig.scaled( 
     554                        geometry().width(), m_kaar.height(), 
     555                        Qt::IgnoreAspectRatio, Qt::SmoothTransformation 
     556                ); 
     557 
     558                QPainter p2(&m_kaar); 
     559                // when titlebar is disabled, the ears backgrounds are partially 
     560                // transparent, however that creates 'dots' when running on 
     561                // black background, since there's no support for true alpha 
     562                // blending. Hence, we must draw the background OUTSIDE the 
     563                // kaar with white color. 
     564//              p2.setBrush(Qt::white); 
     565//              p2.drawRects(QRegion(0, 0, width(), m_kaar.height()).subtract(mask()).rects()); 
     566 
     567                p2.drawPixmap(0, 7, m_leftEar); 
     568                p2.drawPixmap( 
     569                        m_kaar.width() - m_rightEar.width(), 7, m_rightEar 
     570                ); 
     571        } 
     572 
    494573        QPainter p(this); 
    495574        p.setBackground(QColor(0, 0, 0, 0)); 
    496575        p.setRenderHint(QPainter::Antialiasing); 
    497576        p.setRenderHint(QPainter::SmoothPixmapTransform); 
    498         if (m_kaar.width() != geometry().width()) { 
    499                 m_kaar = m_kaar.scaled( 
    500                         geometry().width(), m_kaar.height(), 
    501                         Qt::IgnoreAspectRatio, Qt::SmoothTransformation 
    502                 ); 
     577        if (m_showTitle) { 
     578                QPixmap back(imgDir() + "headerback.png"); 
     579                if (!back.isNull()) { 
     580                        int pos = 0; 
     581                        while (pos < geometry().width()) { 
     582                                p.drawPixmap(pos, 0, back); 
     583                                pos += back.width(); 
     584                        } 
     585                } else { 
     586                        p.setBrush(QColor(95, 110, 132)); 
     587                        p.drawRect(0, 0, m_kaar.width(), m_kaar.height()); 
     588                } 
    503589