Changeset 2965
- Timestamp:
- 04/27/06 20:21:03 (3 years ago)
- Files:
-
- hydranode/hngui/backgrounds/commentsback.png (added)
- hydranode/hngui/backgrounds/commentsheader.png (added)
- hydranode/hngui/backgrounds/plugins (added)
- hydranode/hngui/backgrounds/plugins/donkeyserverbar.png (added)
- hydranode/hngui/commentframe.ui (modified) (2 diffs)
- hydranode/hngui/plugins/donkeypage.cpp (modified) (11 diffs)
- hydranode/hngui/plugins/donkeypage.h (modified) (3 diffs)
- hydranode/hngui/plugins/donkeypage_ui.ui (modified) (2 diffs)
- hydranode/hngui/settingstabs.ui (modified) (1 diff)
- hydranode/hngui/transfertabs.cpp (modified) (5 diffs)
- hydranode/hngui/transfertabs.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hydranode/hngui/commentframe.ui
r2930 r2965 24 24 </property> 25 25 <item row="0" column="0" > 26 <widget class="QFrame" name=" frame" >26 <widget class="QFrame" name="commentHeaderF" > 27 27 <property name="maximumSize" > 28 28 <size> … … 56 56 <item row="0" column="1" > 57 57 <widget class="QLabel" name="commentHeader" > 58 <property name="minimumSize" > 59 <size> 60 <width>100</width> 61 <height>0</height> 62 </size> 63 </property> 58 64 <property name="text" > 59 65 <string>Known file names and comments</string> hydranode/hngui/plugins/donkeypage.cpp
r2959 r2965 26 26 #include <limits> 27 27 #include <QPainter> 28 #include <boost/lexical_cast.hpp> 28 29 29 30 // DonkeyStatusBar class … … 31 32 32 33 void DonkeyStatusBar::paintEvent(QPaintEvent *evt) { 33 QFrame::paintEvent(evt); 34 QPainter p(this); 35 p.setPen(Qt::white); 36 p.setBrush(Qt::white); 37 p.drawRect(0, 0, width(), height()); 34 // QFrame::paintEvent(evt); 35 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 36 if (conf.value("EnableBars").toBool()) { 37 QPainter p(this); 38 QPixmap img(imgDir() + "plugins/donkeyserverbar.png"); 39 if (!img.isNull()) { 40 p.drawPixmap( 41 0, 0, img.scaled( 42 width(), height(), 43 Qt::IgnoreAspectRatio, 44 Qt::SmoothTransformation 45 ) 46 ); 47 } else { 48 logDebug("failed to load image donkeyserverbar.png"); 49 } 50 } else { 51 logDebug("Skin is disabled."); 52 } 38 53 } 39 54 … … 47 62 h->setObjectName("ed2k-serverlist"); 48 63 setHeader(h); 64 h->setFocusPolicy(Qt::NoFocus); 49 65 setBackground(QPixmap(":/backgrounds/backgrounds/default.png")); 50 66 } … … 127 143 // DonkeyPage class 128 144 DonkeyPage::DonkeyPage(QWidget *parent, Engine::Modules *p) 129 : QWidget(parent), m_currentServer() {145 : QWidget(parent), m_currentServer(), m_curServerId() { 130 146 m_ui = new Ui::DonkeyPage; 131 147 m_ui->setupUi(this); … … 152 168 p->removedObject.connect( 153 169 boost::bind(&DonkeyPage::delObject, this, _1) 170 ); 171 connect( 172 m_ui->serverList, 173 SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), 174 SLOT(connectToServer(QTreeWidgetItem*, int)) 154 175 ); 155 176 } … … 191 212 } 192 213 m_currentServer = cur; 214 m_curServerId = cur->m_data->getId(); 193 215 QString statusText(status + " to " + cur->text(0)); 194 216 statusText += " (" +formatNumber(cur->text(3).toUInt()); … … 196 218 statusText += formatNumber(cur->text(4).toUInt()); 197 219 statusText += " files)"; 198 if (status != "Connecting" ) {220 if (status != "Connecting" && status != "Logging in") { 199 221 statusText += " with "; 200 222 if (id.toUInt() <= 0x00ffffff) { … … 209 231 logDebug("CurServer: " + curServer); 210 232 logDebug("ID: " + id); 211 m_ui->statusText->setText( 212 "No status information available." 213 ); 233 QString statusText(status + " to "); 234 statusText += "<i>unknown server</i> "; 235 if (status != "Connecting" && status != "Logging in") { 236 statusText += " with "; 237 if (id.toUInt() <= 0x00ffffff) { 238 statusText += "Low Id"; 239 } else { 240 statusText += "High Id"; 241 } 242 } 243 m_ui->statusText->setText(statusText); 244 m_curServerId = curServer.toUInt(); 245 m_currentServer = 0; 214 246 } 215 247 return; … … 230 262 ); 231 263 updateNetworkInfo(); 264 if (m_currentServer && obj == m_currentServer->m_data) { 265 updateObject(m_serverList); 266 } 232 267 } 233 268 234 269 void DonkeyPage::addObject(Engine::ObjectPtr obj) { 235 logDebug("Adding object...");236 270 if (obj->getParent() && obj->getParent()->getName() == "serverlist") { 237 logDebug(" -> adding [add-real]");238 271 ServerListItem *it = new ServerListItem(m_ui->serverList); 272 it->m_data = obj; 239 273 for (int j = 3; j < m_ui->serverList->columnCount(); ++j) { 240 274 it->setTextAlignment(j, Qt::AlignRight); … … 249 283 } 250 284 m_list[obj->getId()] = it; 285 if (!m_currentServer && obj->getId() == m_curServerId) { 286 updateObject(m_serverList); 287 } 251 288 } 252 289 } 253 290 254 291 void DonkeyPage::delObject(Engine::ObjectPtr obj) { 255 logDebug("Removing object...");256 292 QMap<quint32, ServerListItem*>::iterator it =m_list.find(obj->getId()); 257 293 if (it != m_list.end()) { 258 logDebug(" -> removing [del-real]");259 294 if (m_currentServer == it.value()) { 260 295 m_currentServer = 0; … … 287 322 m_ui->fileCount->setText("Files: " + formatNumber(files)); 288 323 } 324 325 void DonkeyPage::connectToServer(QTreeWidgetItem *it, int) { 326 ServerListItem *server = dynamic_cast<ServerListItem*>(it); 327 if (!server) { 328 return; 329 } 330 std::map<std::string, std::string> args; 331 args["id"] = boost::lexical_cast<std::string>(server->m_data->getId()); 332 m_serverList->doOper("connectId", args); 333 } hydranode/hngui/plugins/donkeypage.h
r2959 r2965 49 49 ServerListItem(QTreeWidget *parent); 50 50 bool operator<(const QTreeWidgetItem &o) const; 51 Engine::ObjectPtr m_data; 51 52 }; 52 53 … … 55 56 public: 56 57 DonkeyPage(QWidget *parent, Engine::Modules *p); 58 public Q_SLOTS: 59 void connectToServer(QTreeWidgetItem *it, int col); 57 60 private: 58 61 void gotServers(Engine::ObjectPtr obj); … … 69 72 Engine::ObjectPtr m_serverList; 70 73 ServerListItem *m_currentServer; 74 quint32 m_curServerId; 71 75 }; 72 76 hydranode/hngui/plugins/donkeypage_ui.ui
r2959 r2965 10 10 <y>0</y> 11 11 <width>515</width> 12 <height>42 8</height>12 <height>422</height> 13 13 </rect> 14 14 </property> … … 138 138 </sizepolicy> 139 139 </property> 140 <property name="minimumSize" > 141 <size> 142 <width>100</width> 143 <height>0</height> 144 </size> 145 </property> 140 146 <property name="text" > 141 147 <string>No status information available.</string> hydranode/hngui/settingstabs.ui
r2939 r2965 40 40 <size> 41 41 <width>16</width> 42 <height>3 88</height>42 <height>355</height> 43 43 </size> 44 44 </property> hydranode/hngui/transfertabs.cpp
r2955 r2965 38 38 // CommentList class 39 39 // ----------------- 40 CommentList::CommentList(QWidget *parent) : HTreeWidget(parent) {} 40 CommentList::CommentList(QWidget *parent) : HTreeWidget(parent) { 41 m_commentB = QPixmap(imgDir() + "commentsback.png"); 42 m_commentBOrig = m_commentB; 43 } 41 44 42 45 void CommentList::paintEvent(QPaintEvent *evt) { 43 46 HTreeWidget::paintEvent(evt); 47 if (m_commentB.width() != width() || m_commentB.height() != height()) { 48 m_commentB = m_commentBOrig.scaled( 49 width(), height(), Qt::IgnoreAspectRatio, 50 Qt::SmoothTransformation 51 ); 52 } 53 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 54 if (conf.value("EnableBars").toBool()) { 55 QPainter p(viewport()); 56 p.drawPixmap(0, 0, m_commentB); 57 } 44 58 // QPainter p(viewport()); 45 59 // QPixmap btn(imgDir() + "opendetails.png"); … … 172 186 m_commentFrame->commentList->installEventFilter(this); 173 187 m_commentFrame->commentList->viewport()->installEventFilter(this); 174 m_ ui->commentFrame->installEventFilter(this);188 m_commentFrame->commentHeaderF->installEventFilter(this); 175 189 window()->installEventFilter(this); 176 190 updateButtons(); … … 194 208 m_actionBack = QPixmap(imgDir() + "actionback.png"); 195 209 // m_detailsBack = QPixmap(imgDir() + "detailsback.png"); 210 m_commentH = QPixmap(imgDir() + "commentsheader.png"); 211 m_commentHOrig = m_commentH; 196 212 m_actionBackOrig = m_actionBack; 197 213 // m_detailsBackOrig = m_detailsBack; … … 433 449 QSettings conf(confDir() + "gui.ini", QSettings::IniFormat); 434 450 if (obj == m_ui->actionBar && !m_actionBack.isNull()) { 435 QPainter p(m_ui->actionBar);436 451 if (conf.value("EnableBars").toBool()){ 452 QPainter p(m_ui->actionBar); 437 453 int w = m_ui->actionBar->width(); 438 454 int h = m_ui->actionBar->height(); … … 447 463 } 448 464 p.drawPixmap(0, 0, m_actionBack); 465 } 466 } else if (obj == m_commentFrame->commentHeaderF) { 467 if (!m_commentH.isNull()&&conf.value("EnableBars").toBool()){ 468 QPainter p(m_commentFrame->commentHeaderF); 469 int w = m_commentFrame->commentHeaderF->width(); 470 int h = m_commentFrame->commentHeaderF->height(); 471 if ( 472 m_commentH.width() != w || 473 m_commentH.height() != h 474 ) { 475 m_commentH = m_commentHOrig.scaled( 476 w, h, Qt::IgnoreAspectRatio, 477 Qt::SmoothTransformation 478 ); 479 } 480 p.drawPixmap(0, 0, m_commentH); 449 481 } 450 482 // } else if (obj == m_ui->detailsBar) { hydranode/hngui/transfertabs.h
r2939 r2965 43 43 protected: 44 44 void paintEvent(QPaintEvent *evt); 45 private: 46 QPixmap m_commentB, m_commentBOrig; 45 47 }; 46 48 … … 99 101 QPixmap m_actionBack, m_actionBackOrig; 100 102 // QPixmap m_detailsBack, m_detailsBackOrig; 103 QPixmap m_commentH, m_commentHOrig; 101 104 DownloadListItem *m_currentActive; 102 105 boost::signals::scoped_connection m_currentConnection;
