From 5b6ccf67fd4c98436fc3eae413470811cea3a285 Mon Sep 17 00:00:00 2001 From: Bill Winslow Date: Mon, 28 Jul 2014 16:52:05 -0500 Subject: [PATCH] incremental, commiting in order to push --- widget/form/settingsform.cpp | 15 +++++++++++---- widget/form/settingsform.h | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/widget/form/settingsform.cpp b/widget/form/settingsform.cpp index 877685a8c..573d80101 100644 --- a/widget/form/settingsform.cpp +++ b/widget/form/settingsform.cpp @@ -93,14 +93,17 @@ SettingsForm::~SettingsForm() { } -void SettingsForm::populateProfiles() +QList SettingsForm::searchProfiles() { + QList out; QDir dir(Settings::getSettingsDirPath()); dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); dir.setNameFilters(QStringList("*.tox")); - for(QFileInfo file : dir.entryInfoList()) { - profiles.addItem(file.completeBaseName()); + for(QFileInfo file : dir.entryInfoList()) + { + out += file.completeBaseName(); } + return out; } QString SettingsForm::getSelectedSavePath() @@ -115,7 +118,11 @@ void SettingsForm::setFriendAddress(const QString& friendAddress) void SettingsForm::show(Ui::Widget &ui) { - populateProfiles(); + profiles.clear(); + for (QString profile : searchProfiles()) + { + profiles.addItem(profile); + } ui.mainContent->layout()->addWidget(main); ui.mainHead->layout()->addWidget(head); main->show(); diff --git a/widget/form/settingsform.h b/widget/form/settingsform.h index cb5ad1e12..a14ed9142 100644 --- a/widget/form/settingsform.h +++ b/widget/form/settingsform.h @@ -44,6 +44,7 @@ public: ~SettingsForm(); void show(Ui::Widget& ui); + static QList searchProfiles(); public slots: void setFriendAddress(const QString& friendAddress); @@ -70,7 +71,6 @@ private: QCheckBox enableIPv6, useTranslations, makeToxPortable; QVBoxLayout layout, headLayout; QWidget *main, *head, *hboxcont1, *hboxcont2; - void populateProfiles(); QString getSelectedSavePath(); public: