From c6a0f624e7cb7c9ae35a49bdb550243fcd1fecd5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 4 Jan 2016 15:54:11 +0100 Subject: Icons in tabs, configurable default tab --- src/dialog.cpp | 8 +++--- src/sessiontreemodel.cpp | 68 ++++++++++++++++++++++++------------------------ 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& 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 SessionTreeModel::lookForItem(const QString& label) { - QList result; - - if (label.startsWith("\"")) { - QString searchTerm = label; - searchTerm.remove(0, 1); - if (label.endsWith("\"")) { - searchTerm.chop(1); - } - QList 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(item->session())); - } - } - } else { - QList 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(item->session())); - } - } - } - - return result; + QList result; + + if (label.startsWith("\"")) { + QString searchTerm = label; + searchTerm.remove(0, 1); + if (label.endsWith("\"")) { + searchTerm.chop(1); + } + QList 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(item->session())); + } + } + } else { + QList 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(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;} <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> +<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> @@ -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> +<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> @@ -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> +<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> -- cgit v1.2.3-55-g7522