1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

incremental, commiting in order to push

This commit is contained in:
Bill Winslow 2014-07-28 16:52:05 -05:00
parent 08ab94bf5a
commit 5b6ccf67fd
2 changed files with 12 additions and 5 deletions

View File

@ -93,14 +93,17 @@ SettingsForm::~SettingsForm()
{ {
} }
void SettingsForm::populateProfiles() QList<QString> SettingsForm::searchProfiles()
{ {
QList<QString> out;
QDir dir(Settings::getSettingsDirPath()); QDir dir(Settings::getSettingsDirPath());
dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); dir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
dir.setNameFilters(QStringList("*.tox")); dir.setNameFilters(QStringList("*.tox"));
for(QFileInfo file : dir.entryInfoList()) { for(QFileInfo file : dir.entryInfoList())
profiles.addItem(file.completeBaseName()); {
out += file.completeBaseName();
} }
return out;
} }
QString SettingsForm::getSelectedSavePath() QString SettingsForm::getSelectedSavePath()
@ -115,7 +118,11 @@ void SettingsForm::setFriendAddress(const QString& friendAddress)
void SettingsForm::show(Ui::Widget &ui) void SettingsForm::show(Ui::Widget &ui)
{ {
populateProfiles(); profiles.clear();
for (QString profile : searchProfiles())
{
profiles.addItem(profile);
}
ui.mainContent->layout()->addWidget(main); ui.mainContent->layout()->addWidget(main);
ui.mainHead->layout()->addWidget(head); ui.mainHead->layout()->addWidget(head);
main->show(); main->show();

View File

@ -44,6 +44,7 @@ public:
~SettingsForm(); ~SettingsForm();
void show(Ui::Widget& ui); void show(Ui::Widget& ui);
static QList<QString> searchProfiles();
public slots: public slots:
void setFriendAddress(const QString& friendAddress); void setFriendAddress(const QString& friendAddress);
@ -70,7 +71,6 @@ private:
QCheckBox enableIPv6, useTranslations, makeToxPortable; QCheckBox enableIPv6, useTranslations, makeToxPortable;
QVBoxLayout layout, headLayout; QVBoxLayout layout, headLayout;
QWidget *main, *head, *hboxcont1, *hboxcont2; QWidget *main, *head, *hboxcont1, *hboxcont2;
void populateProfiles();
QString getSelectedSavePath(); QString getSelectedSavePath();
public: public: