From f9704767ed8bc325f9224c69b2dd18f564ee5cc0 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 24 Nov 2018 08:18:12 +0100 Subject: Improve MovieInfoPage Replace QPushButtons with a QToolbar and appropriate unicode symbols. While at at, return from Helper::fuzzyCheck when the search string is empty. Prevents false positives. --- helper.cpp | 3 +++ movieinfopage.cpp | 16 ++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/helper.cpp b/helper.cpp index 48ce15c..214e950 100644 --- a/helper.cpp +++ b/helper.cpp @@ -391,6 +391,9 @@ namespace Helper { QStringList fuzzyCheck(const QString &subtitle){ QStringList retval; + if(subtitle.isEmpty()){ + return retval; + } QSqlDatabase db = QSqlDatabase::database("treedb"); db.open(); QSqlQuery fuzzyQ(db); diff --git a/movieinfopage.cpp b/movieinfopage.cpp index 425a252..6726587 100644 --- a/movieinfopage.cpp +++ b/movieinfopage.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include "movieinfopage.h" #include "wizardtreemodel.h" @@ -80,12 +82,14 @@ void MovieInfoPage::setupGui(){ mSubtitle = new QLineEdit; movieTitleLayout->addWidget(new QLabel(tr("Movie subtitle")), 1, 0); movieTitleLayout->addWidget(mSubtitle, 1, 1, 1, 1); - QPushButton *lowerCaseB = new QPushButton(QIcon(":/steel_collar.png"), tr("Lower case")); - connect(lowerCaseB, &QPushButton::clicked, this, &MovieInfoPage::toLower); - movieTitleLayout->addWidget(lowerCaseB, 1, 2, 1, 1); - QPushButton *checkB = new QPushButton(QIcon(":/spreadingpants.png"), tr("Fuzzy check...")); - connect(checkB, &QPushButton::clicked, this, &MovieInfoPage::fuzzyCheck); - movieTitleLayout->addWidget(checkB, 1, 3, 1, 1); + QToolBar *checkTB = new QToolBar; + QAction *lowerCaseA = new QAction(Helper::icon(Qt::transparent, qApp->palette().color(QPalette::Text), QChar(0x2b07), true, false), tr("Lower Case"), this); + connect(lowerCaseA, &QAction::triggered, this, &MovieInfoPage::toLower); + checkTB->addAction(lowerCaseA); + QAction *fuzzyCheckA = new QAction(Helper::icon(Qt::transparent, qApp->palette().color(QPalette::Text), QChar(0x2975), true, false), tr("Fuzzy Check"), this); + connect(fuzzyCheckA, &QAction::triggered, this, &MovieInfoPage::fuzzyCheck); + checkTB->addAction(fuzzyCheckA); + movieTitleLayout->addWidget(checkTB, 1, 2, 1, 1); mSeriesCompleter = new QCompleter(this); mSeriesCompleterModel = new QStringListModel(this); mSeriesCompleter->setModel(mSeriesCompleterModel); -- cgit v1.2.3-70-g09d2