Changeset 2939
- Timestamp:
- 04/26/06 17:17:11 (3 years ago)
- Files:
-
- hydranode/hngui/Jamfile (modified) (1 diff)
- hydranode/hngui/backgrounds/actionback.png (modified) (previous)
- hydranode/hngui/backgrounds/framebborder.png (modified) (previous)
- hydranode/hngui/backgrounds/framelborder.png (modified) (previous)
- hydranode/hngui/backgrounds/framerborder.png (modified) (previous)
- hydranode/hngui/backgrounds/headerback.png (added)
- hydranode/hngui/backgrounds/kaar.png (modified) (previous)
- hydranode/hngui/backgrounds/left1.png (deleted)
- hydranode/hngui/backgrounds/left2.png (deleted)
- hydranode/hngui/backgrounds/left3.png (deleted)
- hydranode/hngui/backgrounds/leftear.png (added)
- hydranode/hngui/backgrounds/listheader.png (added)
- hydranode/hngui/backgrounds/listseparator.png (added)
- hydranode/hngui/backgrounds/right1.png (deleted)
- hydranode/hngui/backgrounds/right2.png (deleted)
- hydranode/hngui/backgrounds/right3.png (deleted)
- hydranode/hngui/backgrounds/rightear.png (added)
- hydranode/hngui/customheader.cpp (modified) (2 diffs)
- hydranode/hngui/downloadlist.cpp (modified) (1 diff)
- hydranode/hngui/home_homeactions.ui (modified) (1 diff)
- hydranode/hngui/hometabs.cpp (modified) (6 diffs)
- hydranode/hngui/htreewidget.cpp (modified) (1 diff)
- hydranode/hngui/icons/hydranode.ico (modified) (previous)
- hydranode/hngui/librarycontent.ui (modified) (8 diffs)
- hydranode/hngui/librarylist.h (modified) (1 diff)
- hydranode/hngui/librarytabs.cpp (modified) (7 diffs)
- hydranode/hngui/librarytabs.h (modified) (1 diff)
- hydranode/hngui/main.cpp (modified) (15 diffs)
- hydranode/hngui/main.h (modified) (4 diffs)
- hydranode/hngui/mainlayout.ui (modified) (6 diffs)
- hydranode/hngui/pagetemplate.ui (modified) (6 diffs)
- hydranode/hngui/searchcontent.ui (modified) (6 diffs)
- hydranode/hngui/searchlist.cpp (modified) (1 diff)
- hydranode/hngui/searchtabs.cpp (modified) (10 diffs)
- hydranode/hngui/searchtabs.h (modified) (2 diffs)
- hydranode/hngui/settingstabs.ui (modified) (6 diffs)
- hydranode/hngui/transfercontent.ui (modified) (10 diffs)
- hydranode/hngui/transfertabs.cpp (modified) (17 diffs)
- hydranode/hngui/transfertabs.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hydranode/hngui/Jamfile
r2929 r2939 10 10 mainlayout.ui 11 11 transfercontent.ui searchcontent.ui librarycontent.ui 12 settingstabs.ui filedetailsdock.ui searchdetailsdock.ui 12 settingstabs.ui 13 # filedetailsdock.ui searchdetailsdock.ui 13 14 pagetemplate.ui home_homeactions.ui home_homepage.ui catdialog.ui 14 15 commentframe.ui hydranode/hngui/customheader.cpp
r2931 r2939 61 61 return; 62 62 } 63 QPixmap img(imgDir() + "listheader.png"); 64 if (img.isNull()) { 65 QHeaderView::paintSection(p, rect, logicalIndex); 66 return; 67 } 63 68 69 p->drawPixmap( 70 rect.x(), rect.y(), img.scaled(rect.width(), img.height(), 71 Qt::IgnoreAspectRatio) 72 ); 73 74 /* 64 75 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)); 71 77 72 78 p->drawRect(rect.x(), rect.y(), rect.width(), rect.height() - 1); 73 79 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 */ 82 85 QString text( 83 86 model()->headerData( … … 90 93 p->setPen(Qt::black); 91 94 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 } 92 106 } 93 107 94 108 QSize CustomHeader::sizeHint() const { 95 109 QSize ret = QHeaderView::sizeHint(); 96 ret.setHeight( 20);110 ret.setHeight(18); 97 111 return ret; 98 112 } hydranode/hngui/downloadlist.cpp
r2932 r2939 587 587 void DownloadList::paintEvent(QPaintEvent *evt) { 588 588 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 // ); 602 597 // } 603 598 } hydranode/hngui/home_homeactions.ui
r2865 r2939 58 58 </spacer> 59 59 </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>82 60 </layout> 83 61 </widget> hydranode/hngui/hometabs.cpp
r2931 r2939 53 53 54 54 m_ui->newsFeed->addFeed( 55 "Slashdot - Stuff that matters", 56 QUrl("http://rss.slashdot.org/Slashdot/slashdot"), 10 57 ); 58 m_ui->newsFeed->addFeed( 55 59 "BBC World News", 56 60 QUrl( … … 66 70 "Tom's Hardware News", 67 71 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"), 1072 72 ); 73 73 m_ui->newsFeed->addFeed( … … 130 130 p.setPen(palette().color(QPalette::Mid)); 131 131 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 ); 133 137 134 138 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 135 139 if (!m_background.isNull() && conf.value("EnableBack").toBool()) { 136 140 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, 139 143 m_background 140 144 ); … … 173 177 feeds["CNN World News"] = m.addAction("CNN World News"); 174 178 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" 177 181 ); 178 182 feeds["Slyck - File Sharing News"] = m.addAction( … … 212 216 p.setPen(QColor(153, 153, 153)); 213 217 p.setBrush(QColor(218, 202, 191, 183)); 214 p.drawRect( 0, -1, width(), height());218 p.drawRect(-1, -1, width() + 1, height()); 215 219 return; 216 220 … … 239 243 p.setPen(QColor(153, 153, 153)); 240 244 p.setBrush(QColor(173, 215, 244, 183)); 241 p.drawRect( 0, -1, width(), height());245 p.drawRect(-1, -1, width() + 1, height()); 242 246 return; 243 247 hydranode/hngui/htreewidget.cpp
r2931 r2939 36 36 QPainter p(viewport()); 37 37 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 ); 40 46 pos = viewport()->mapFrom(parentWidget(), pos); 41 47 p.drawPixmap(pos, m_background); hydranode/hngui/librarycontent.ui
r2864 r2939 23 23 <number>0</number> 24 24 </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" > 26 42 <widget class="QFrame" name="actionBar" > 27 43 <property name="minimumSize" > 28 44 <size> 29 45 <width>16</width> 30 <height>2 5</height>46 <height>22</height> 31 47 </size> 32 48 </property> … … 34 50 <size> 35 51 <width>16777215</width> 36 <height>2 5</height>52 <height>22</height> 37 53 </size> 38 54 </property> … … 50 66 <number>0</number> 51 67 </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>74 68 <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" >113 69 <spacer> 114 70 <property name="orientation" > … … 116 72 </property> 117 73 <property name="sizeType" > 118 <enum>QSizePolicy::M aximum</enum>74 <enum>QSizePolicy::MinimumExpanding</enum> 119 75 </property> 120 76 <property name="sizeHint" > 121 77 <size> 122 <width> 25</width>78 <width>0</width> 123 79 <height>23</height> 124 80 </size> … … 126 82 </spacer> 127 83 </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> 128 100 <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" > 129 155 <widget class="QLineEdit" name="filterText" > 130 156 <property name="maximumSize" > … … 136 162 </widget> 137 163 </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" > 155 165 <widget class="QToolButton" name="filterButton" > 156 166 <property name="text" > … … 169 179 </item> 170 180 <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" > 171 213 <widget class="LibraryList" name="sharedList" > 172 214 <property name="sizePolicy" > … … 200 242 </property> 201 243 </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>250 244 </item> 251 245 </layout> hydranode/hngui/librarylist.h
r2925 r2939 36 36 QString filterText() const { return m_filterText; } 37 37 void checkAssignCat(LibraryListItem *it); 38 static Engine::SharedFilesList* getList() { return s_list; } 38 39 protected: 39 40 void contextMenuEvent(QContextMenuEvent *e); hydranode/hngui/librarytabs.cpp
r2931 r2939 26 26 #include <QHeaderView> 27 27 #include <QMenu> 28 #include <QFileDialog> 28 29 29 30 LibraryPage::LibraryPage(QWidget *parent) : QWidget(parent) { … … 36 37 connect(m_ui->dirButton, SIGNAL(clicked()), SLOT(showDirMenu())); 37 38 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())); 38 41 39 42 QPalette palette = m_ui->filterText->palette(); … … 79 82 } 80 83 84 #if 0 85 class DirMenu : public QMenu { 86 public: 87 DirMenu(QWidget *parent = 0); 88 protected: 89 void customContextMenuRequested(const QPoint &pos); 90 }; 91 92 DirMenu::DirMenu(QWidget *parent) : QMenu(parent) {} 93 94 void 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 81 112 void LibraryPage::showDirMenu() { 82 113 QMenu menu(this); … … 99 130 } 100 131 101 menu.addSeparator();102 132 if (fCol == -1) { 103 133 menu.addAction(QIcon(":/transfer/icons/clear16"), "All Files"); … … 106 136 } 107 137 138 // menu.addSeparator(); 139 // QAction *addAc = menu.addAction( 140 // QIcon(":/types/icons/pluss16"), "Add folder..." 141 // "Add folder..." 142 // ); 108 143 109 144 QPoint pos(0, m_ui->dirButton->height()); … … 112 147 QAction *ret = menu.exec(pos); 113 148 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 114 163 if (ret && ret->text() == "All Files") { 115 164 m_ui->sharedList->filterByText(""); … … 120 169 m_ui->dirButton->setChecked(false); 121 170 m_ui->dirButton->setCheckable(false); 171 } 172 173 void 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 188 void 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); 122 215 } 123 216 hydranode/hngui/librarytabs.h
r2883 r2939 40 40 void showDirMenu(); 41 41 void showTypeMenu(); 42 void addShared(); 43 void remShared(); 42 44 43 45 void updateButtons(); hydranode/hngui/main.cpp
r2936 r2939 88 88 m_rb = QPixmap(imgDir() + "framerborder.png"); 89 89 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"); 91 94 } 92 95 … … 150 153 151 154 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 152 if (conf.contains("WindowPos")) {153 move(conf.value("WindowPos").toPoint());154 }155 155 #ifdef Q_WS_X11 156 156 QSize sz(690, 540); … … 158 158 QSize sz(630, 460); 159 159 #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 } 165 174 166 175 if (!conf.value("ShowTitle").toBool()) { … … 191 200 ); 192 201 193 connect(m_ui->right1, SIGNAL(clicked()), SLOT( close()));202 connect(m_ui->right1, SIGNAL(clicked()), SLOT(doClose())); 194 203 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())); 196 205 connect(m_ui->left1, SIGNAL(clicked()), SLOT(toggleTitleBar())); 197 206 // connect(m_ui->left1, SIGNAL(clicked()), SLOT(toggleTitleBar())); … … 210 219 m_ui->right3->installEventFilter(this); 211 220 221 // needed to properly update mask 222 if (!m_showTitle) { 223 paintEvent(0); 224 } 225 212 226 setMouseTracking(true); 213 227 } 214 228 215 229 void MainWindow::toggleTitleBar() { 230 if (isMaximized()) { 231 return; 232 } 216 233 #ifdef Q_OS_WIN32 217 234 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); … … 459 476 } 460 477 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 } 464 486 conf.setValue("ShowTitle", m_showTitle); 465 487 } … … 482 504 } 483 505 506 QRegion 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 528 void 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 484 539 void MainWindow::paintEvent(QPaintEvent *e) { 485 QMainWindow::paintEvent(e); 540 if (e) { 541 QMainWindow::paintEvent(e); 542 } 543 486 544 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 487 545 if (!conf.value("EnableBars").toBool()) { … … 491 549 if (m_kaar.isNull()) { 492 550 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 494 573 QPainter p(this); 495 574 p.setBackground(QColor(0, 0, 0, 0)); 496 575 p.setRenderHint(QPainter::Antialiasing); 497 576 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 } 503 589
