diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-07-11 12:06:54 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-07-11 12:06:54 +0200 |
commit | b87a7d0a25821e439e06a439eb4518395afbf7ed (patch) | |
tree | 6ee27a9e4ee605aba1d17a23af76157d43cedee8 /facetracknoir | |
parent | c2ff0cd3851efdd789ab1840e8da7f50429840d4 (diff) |
main ui: change profile cbx content when dir switch
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 17 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.h | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index 893e79cd..00a7b95e 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -104,7 +104,7 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent) : pProtocolDialog(NULL), pFilterDialog(NULL), kbd_quit(QKeySequence("Ctrl+Q"), this), - looping(false) + looping(0) { ui.setupUi(this); setFixedSize(size()); @@ -256,10 +256,8 @@ void FaceTrackNoIR::open() { QSettings settings("opentrack"); settings.setValue ("SettingsFile", QFileInfo(fileName).absoluteFilePath()); } - looping = true; fill_profile_cbx(); loadSettings(); - looping = false; } } @@ -286,7 +284,7 @@ void FaceTrackNoIR::save() { void FaceTrackNoIR::saveAs() { - looping = true; + looping++; QSettings settings("opentrack"); QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); @@ -311,7 +309,7 @@ void FaceTrackNoIR::saveAs() save(); } - looping = false; + looping--; fill_profile_cbx(); } @@ -584,6 +582,7 @@ void FaceTrackNoIR::fill_profile_cbx() { if (looping) return; + looping++; QSettings settings("opentrack"); QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); qDebug() << "Config file now" << currentFile; @@ -594,12 +593,10 @@ void FaceTrackNoIR::fill_profile_cbx() filters << "*.ini"; auto iniFileList = settingsDir.entryList( filters, QDir::Files, QDir::Name ); ui.iconcomboProfile->clear(); - for ( int i = 0; i < iniFileList.size(); i++) { + for ( int i = 0; i < iniFileList.size(); i++) ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), iniFileList.at(i)); - if (iniFileList.at(i) == pathInfo.fileName()) { - ui.iconcomboProfile->setCurrentIndex( i ); - } - } + ui.iconcomboProfile->setCurrentText(pathInfo.fileName()); + looping--; } void FaceTrackNoIR::profileSelected(int index) diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index 50a6e0ec..192b00b6 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -139,7 +139,7 @@ private: void bind_keyboard_shortcut(QxtGlobalShortcut&, key_opts& k); #endif void fill_profile_cbx(); - bool looping; + int looping; private slots: void open(); |