mirror of
https://github.com/FAUSheppy/speech-server-client-qt
synced 2025-12-06 08:51:35 +01:00
remember most recently selected path/file
This commit is contained in:
4
main.cpp
4
main.cpp
@@ -7,5 +7,9 @@ int main(int argc, char *argv[])
|
|||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
a.setApplicationName("Speech-To-Text");
|
||||||
|
a.setOrganizationName("Lantia IT");
|
||||||
|
a.setOrganizationDomain("lantia-it.de");
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,12 +148,24 @@ void MainWindow::handleInitialSettings(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::importFile(){
|
void MainWindow::importFile(){
|
||||||
|
|
||||||
|
QString startDir = QDir::currentPath();
|
||||||
|
if(mySettings->contains(SETTING_MOST_RECENT_PATH)){
|
||||||
|
startDir = mySettings->value(SETTING_MOST_RECENT_PATH).toString();
|
||||||
|
}
|
||||||
|
|
||||||
QString filename = QFileDialog::getOpenFileName(
|
QString filename = QFileDialog::getOpenFileName(
|
||||||
this,
|
this,
|
||||||
"Open Document",
|
"Open Document",
|
||||||
QDir::currentPath(),
|
startDir,
|
||||||
"All files (*.*) ;; Document files (*.doc *.rtf);; PNG files (*.png)");
|
"All files (*.*) ;; Document files (*.doc *.rtf);; PNG files (*.png)");
|
||||||
|
|
||||||
|
/* set most recent path */
|
||||||
|
QFileInfo* fi = new QFileInfo(filename);
|
||||||
|
QDir dirInfo = fi->absoluteDir();
|
||||||
|
QString dirPath = dirInfo.absolutePath();
|
||||||
|
mySettings->setValue(SETTING_MOST_RECENT_PATH, dirPath);
|
||||||
|
|
||||||
if(filename.isNull()){
|
if(filename.isNull()){
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -11,5 +11,6 @@
|
|||||||
#define SETTING_USER "user"
|
#define SETTING_USER "user"
|
||||||
#define SETTING_PASS "pass"
|
#define SETTING_PASS "pass"
|
||||||
#define SETTING_LINUX_EXPLORER "linux-explorer"
|
#define SETTING_LINUX_EXPLORER "linux-explorer"
|
||||||
|
#define SETTING_MOST_RECENT_PATH "most-recent-path"
|
||||||
|
|
||||||
#endif // SETTINGKEYS_H
|
#endif // SETTINGKEYS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user