diff options
author | Simon Rettberg | 2016-01-04 15:54:11 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-01-04 15:54:11 +0100 |
commit | c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5 (patch) | |
tree | 9a9ff83d1119014dda4aa3ead0e4ef3f228a6a30 | |
parent | Update images (diff) | |
download | vmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.tar.gz vmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.tar.xz vmchooser2-c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5.zip |
Icons in tabs, configurable default tab
-rw-r--r-- | src/dialog.cpp | 8 | ||||
-rw-r--r-- | src/sessiontreemodel.cpp | 68 | ||||
-rw-r--r-- | src/ui/dialog.ui | 6 |
3 files changed, 41 insertions, 41 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index 8572c67..4179afd 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -161,6 +161,7 @@ void Dialog::addItems(const QList<Session*>& entries, int tab) { } model_[tab]->updateView(); selectPreviousSession(); + on_filterEdit_textChanged(); } void Dialog::addStatusString(const int status) { @@ -353,9 +354,6 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { this->addStatusString(STR_NO_ITEMS); } - // give focus to treeView - ui->treeView->setFocus(); - // select last-session selectPreviousSession(); userInteracted_ = true; @@ -432,7 +430,9 @@ void Dialog::onTabButtonChanged(int tab) { } // give focus to treeView - ui->treeView->setFocus(); + if (!ui->filterEdit->hasFocus()) { + ui->treeView->setFocus(); + } // Update pressed status of buttons for (int i = 0; i < 3; ++i) { diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp index aaf47b9..cf4f2cf 100644 --- a/src/sessiontreemodel.cpp +++ b/src/sessiontreemodel.cpp @@ -135,46 +135,46 @@ void SessionTreeModel::addLabelItem(const QString& label) { } void SessionTreeModel::removeItem(const QString& name) { - for (int i = 0; i < root_->childCount(); ++i) { - SessionTreeItem* item = root_->child(i); - if (item->text() == name) { - root_->removeChild(item); - } - } + for (int i = 0; i < root_->childCount(); ++i) { + SessionTreeItem* item = root_->child(i); + if (item->text() == name) { + root_->removeChild(item); + } + } } QList<Session*> SessionTreeModel::lookForItem(const QString& label) { - QList<Session*> result; - - if (label.startsWith("\"")) { - QString searchTerm = label; - searchTerm.remove(0, 1); - if (label.endsWith("\"")) { - searchTerm.chop(1); - } - QList<QString> items; - items.append(searchTerm); - for (int i = 0; i < root_->childCount(); ++i) { - SessionTreeItem* item = root_->child(i); - if (item->session()->containsKeywords(items)) { - result.append(const_cast<Session*>(item->session())); - } - } - } else { - QList<QString> items = label.split(" ", QString::SkipEmptyParts); - for (int i = 0; i < root_->childCount(); ++i) { - SessionTreeItem* item = root_->child(i); - if (item->session()->containsKeywords(items)) { - result.append(const_cast<Session*>(item->session())); - } - } - } - - return result; + QList<Session*> result; + + if (label.startsWith("\"")) { + QString searchTerm = label; + searchTerm.remove(0, 1); + if (label.endsWith("\"")) { + searchTerm.chop(1); + } + QList<QString> items; + items.append(searchTerm); + for (int i = 0; i < root_->childCount(); ++i) { + SessionTreeItem* item = root_->child(i); + if (item->session() != NULL && item->session()->containsKeywords(items)) { + result.append(const_cast<Session*>(item->session())); + } + } + } else { + QList<QString> items = label.split(" ", QString::SkipEmptyParts); + for (int i = 0; i < root_->childCount(); ++i) { + SessionTreeItem* item = root_->child(i); + if (item->session() != NULL && item->session()->containsKeywords(items)) { + result.append(const_cast<Session*>(item->session())); + } + } + } + + return result; } void SessionTreeModel::updateView() { - emit layoutChanged(); + emit layoutChanged(); } diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui index 5be8154..0ac918b 100644 --- a/src/ui/dialog.ui +++ b/src/ui/dialog.ui @@ -133,7 +133,7 @@ margin-bottom:0px;}</string> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html></string> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html></string> </property> </widget> </item> @@ -165,7 +165,7 @@ p, li { white-space: pre-wrap; } <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Loading...</span></p></body></html></string> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Loading...</p></body></html></string> </property> </widget> </item> @@ -487,7 +487,7 @@ border:1px solid #999; <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVuSans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Click on an item on the left side for more infos.</span></p></body></html></string> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click on an item on the left side for more information</p></body></html></string> </property> </widget> </item> |