summaryrefslogtreecommitdiff
path: root/ui/qt/about_dialog.cpp
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-10-31 12:37:14 +0100
committerDario Lombardo <lomato@gmail.com>2016-11-02 13:11:50 +0000
commit461650544bdc1380ba9ca60e57ed7fdb547cdfc9 (patch)
tree710c48d205af4873f816afdbdf1ab8ed3b8b8b50 /ui/qt/about_dialog.cpp
parent85c1a45c38efa4b2ab85da4853b7f439c499c632 (diff)
downloadwireshark-461650544bdc1380ba9ca60e57ed7fdb547cdfc9.tar.gz
Qt: add "search authors" feature.
Add a search field in the authors tab. The list of authors has became huge and it's very hard to find someone in it. Having a fast way to search yourself or your friends would be fun. Change-Id: I0c6a5e8d5893d6f7b5a3258e63bdc91969f53d31 Reviewed-on: https://code.wireshark.org/review/18594 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'ui/qt/about_dialog.cpp')
-rw-r--r--ui/qt/about_dialog.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp
index 20eb49701a..e29bc0c221 100644
--- a/ui/qt/about_dialog.cpp
+++ b/ui/qt/about_dialog.cpp
@@ -148,7 +148,6 @@ AboutDialog::AboutDialog(QWidget *parent) :
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
- QFile f_authors;
QFile f_license;
const char *constpath;
QString message;
@@ -189,17 +188,9 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->label_logo->setPixmap(QPixmap(":/about/wssplash_dev.png"));
#endif
-
/* Authors */
-
- f_authors.setFileName(get_datafile_path("AUTHORS-SHORT"));
- f_authors.open(QFile::ReadOnly | QFile::Text);
- QTextStream ReadFile_authors(&f_authors);
- ReadFile_authors.setCodec("UTF-8");
-
ui->pte_Authors->setFont(wsApp->monospaceFont());
- ui->pte_Authors->insertPlainText(ReadFile_authors.readAll());
- ui->pte_Authors->moveCursor(QTextCursor::Start);
+ this->addAuthors(NULL);
/* Folders */
@@ -350,6 +341,32 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->pte_License->setFont(wsApp->monospaceFont());
ui->pte_License->insertPlainText(ReadFile_license.readAll());
ui->pte_License->moveCursor(QTextCursor::Start);
+
+ connect(ui->searchAuthors, SIGNAL(textChanged(const QString &)), this, SLOT(updateAuthors(const QString &)));
+}
+
+void AboutDialog::addAuthors(const QString& filter)
+{
+ QFile f_authors;
+
+ f_authors.setFileName(get_datafile_path("AUTHORS-SHORT"));
+ f_authors.open(QFile::ReadOnly | QFile::Text);
+ QTextStream ReadFile_authors(&f_authors);
+ ReadFile_authors.setCodec("UTF-8");
+
+ ui->pte_Authors->clear();
+ ui->pte_Authors->moveCursor(QTextCursor::Start);
+ while (!ReadFile_authors.atEnd()) {
+ QString line = ReadFile_authors.readLine();
+ if (line.contains(filter, Qt::CaseInsensitive))
+ ui->pte_Authors->appendPlainText(line);
+ }
+ ui->pte_Authors->moveCursor(QTextCursor::Start);
+}
+
+void AboutDialog::updateAuthors(const QString& filter)
+{
+ this->addAuthors(filter);
}
AboutDialog::~AboutDialog()