GUI: Reverted 'GUI while opening FileDialog now remembers last path used'
This commit is contained in:
parent
6fdb24b7e7
commit
e4b8512bc7
|
@ -59,7 +59,7 @@
|
||||||
#define SETTINGS_STD_POSIX "Platform Posix"
|
#define SETTINGS_STD_POSIX "Platform Posix"
|
||||||
|
|
||||||
// Other settings
|
// Other settings
|
||||||
#define SETTINGS_LAST_USED_PATH "Last used path"
|
#define SETTINGS_CHECK_PATH "Check path"
|
||||||
#define SETTINGS_CHECK_FORCE "Check force"
|
#define SETTINGS_CHECK_FORCE "Check force"
|
||||||
#define SETTINGS_CHECK_THREADS "Check threads"
|
#define SETTINGS_CHECK_THREADS "Check threads"
|
||||||
#define SETTINGS_SHOW_FULL_PATH "Show full path"
|
#define SETTINGS_SHOW_FULL_PATH "Show full path"
|
||||||
|
@ -82,6 +82,7 @@
|
||||||
#define PROGRESS_MAX 1024.0
|
#define PROGRESS_MAX 1024.0
|
||||||
|
|
||||||
#define SETTINGS_CHECKED_PLATFORM "Checked platform"
|
#define SETTINGS_CHECKED_PLATFORM "Checked platform"
|
||||||
|
#define SETTINGS_LAST_PROJECT_PATH "Last project path"
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -332,11 +332,12 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
mUI.mResults->CheckingStarted(fileNames.count());
|
mUI.mResults->CheckingStarted(fileNames.count());
|
||||||
|
|
||||||
mThread->SetFiles(fileNames);
|
mThread->SetFiles(fileNames);
|
||||||
|
QDir inf(mCurrentDirectory);
|
||||||
|
const QString checkPath = inf.canonicalPath();
|
||||||
|
mSettings->setValue(SETTINGS_CHECK_PATH, checkPath);
|
||||||
|
|
||||||
CheckLockDownUI(); // lock UI while checking
|
CheckLockDownUI(); // lock UI while checking
|
||||||
|
|
||||||
QDir inf(mCurrentDirectory);
|
|
||||||
const QString checkPath = inf.canonicalPath();
|
|
||||||
mUI.mResults->SetCheckDirectory(checkPath);
|
mUI.mResults->SetCheckDirectory(checkPath);
|
||||||
Settings checkSettings = GetCppcheckSettings();
|
Settings checkSettings = GetCppcheckSettings();
|
||||||
|
|
||||||
|
@ -392,7 +393,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
if (mode == QFileDialog::ExistingFiles) {
|
if (mode == QFileDialog::ExistingFiles) {
|
||||||
selected = QFileDialog::getOpenFileNames(this,
|
selected = QFileDialog::getOpenFileNames(this,
|
||||||
tr("Select files to check"),
|
tr("Select files to check"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString());
|
mSettings->value(SETTINGS_CHECK_PATH, "").toString());
|
||||||
if (selected.isEmpty())
|
if (selected.isEmpty())
|
||||||
mCurrentDirectory.clear();
|
mCurrentDirectory.clear();
|
||||||
else {
|
else {
|
||||||
|
@ -403,7 +404,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
} else if (mode == QFileDialog::DirectoryOnly) {
|
} else if (mode == QFileDialog::DirectoryOnly) {
|
||||||
QString dir = QFileDialog::getExistingDirectory(this,
|
QString dir = QFileDialog::getExistingDirectory(this,
|
||||||
tr("Select directory to check"),
|
tr("Select directory to check"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString());
|
mSettings->value(SETTINGS_CHECK_PATH, "").toString());
|
||||||
if (!dir.isEmpty()) {
|
if (!dir.isEmpty()) {
|
||||||
qDebug() << "Setting current directory to: " << dir;
|
qDebug() << "Setting current directory to: " << dir;
|
||||||
mCurrentDirectory = dir;
|
mCurrentDirectory = dir;
|
||||||
|
@ -413,8 +414,6 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mSettings->setValue(SETTINGS_LAST_USED_PATH, selected);
|
|
||||||
|
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +671,7 @@ void MainWindow::OpenResults()
|
||||||
const QString filter(tr("XML files (*.xml)"));
|
const QString filter(tr("XML files (*.xml)"));
|
||||||
QString selectedFile = QFileDialog::getOpenFileName(this,
|
QString selectedFile = QFileDialog::getOpenFileName(this,
|
||||||
tr("Open the report file"),
|
tr("Open the report file"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString(),
|
QString(),
|
||||||
filter,
|
filter,
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
|
|
||||||
|
@ -686,7 +685,6 @@ void MainWindow::LoadResults(const QString selectedFile)
|
||||||
if (!selectedFile.isEmpty()) {
|
if (!selectedFile.isEmpty()) {
|
||||||
mUI.mResults->Clear(true);
|
mUI.mResults->Clear(true);
|
||||||
mUI.mResults->ReadErrorsXml(selectedFile);
|
mUI.mResults->ReadErrorsXml(selectedFile);
|
||||||
mSettings->setValue(SETTINGS_LAST_USED_PATH, selectedFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,7 +816,7 @@ void MainWindow::Save()
|
||||||
const QString filter(tr("XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
|
const QString filter(tr("XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
|
||||||
QString selectedFile = QFileDialog::getSaveFileName(this,
|
QString selectedFile = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save the report file"),
|
tr("Save the report file"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString(),
|
QString(),
|
||||||
filter,
|
filter,
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
|
|
||||||
|
@ -850,7 +848,6 @@ void MainWindow::Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
mUI.mResults->Save(selectedFile, type);
|
mUI.mResults->Save(selectedFile, type);
|
||||||
mSettings->setValue(SETTINGS_LAST_USED_PATH, selectedFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,16 +932,17 @@ void MainWindow::OpenOnlineHelp()
|
||||||
|
|
||||||
void MainWindow::OpenProjectFile()
|
void MainWindow::OpenProjectFile()
|
||||||
{
|
{
|
||||||
|
const QString lastPath = mSettings->value(SETTINGS_LAST_PROJECT_PATH, QString()).toString();
|
||||||
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
||||||
const QString filepath = QFileDialog::getOpenFileName(this,
|
const QString filepath = QFileDialog::getOpenFileName(this,
|
||||||
tr("Select Project File"),
|
tr("Select Project File"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString(),
|
lastPath,
|
||||||
filter);
|
filter);
|
||||||
|
|
||||||
if (!filepath.isEmpty()) {
|
if (!filepath.isEmpty()) {
|
||||||
const QFileInfo fi(filepath);
|
const QFileInfo fi(filepath);
|
||||||
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
||||||
mSettings->setValue(SETTINGS_LAST_USED_PATH, fi.path());
|
mSettings->setValue(SETTINGS_LAST_PROJECT_PATH, fi.path());
|
||||||
LoadProjectFile(filepath);
|
LoadProjectFile(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1021,14 +1019,12 @@ void MainWindow::NewProjectFile()
|
||||||
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
const QString filter = tr("Project files (*.cppcheck);;All files(*.*)");
|
||||||
QString filepath = QFileDialog::getSaveFileName(this,
|
QString filepath = QFileDialog::getSaveFileName(this,
|
||||||
tr("Select Project Filename"),
|
tr("Select Project Filename"),
|
||||||
mSettings->value(SETTINGS_LAST_USED_PATH, "").toString(),
|
QString(),
|
||||||
filter);
|
filter);
|
||||||
|
|
||||||
if (filepath.isEmpty())
|
if (filepath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mSettings->setValue(SETTINGS_LAST_USED_PATH, filepath);
|
|
||||||
|
|
||||||
EnableProjectActions(true);
|
EnableProjectActions(true);
|
||||||
QFileInfo inf(filepath);
|
QFileInfo inf(filepath);
|
||||||
const QString filename = inf.fileName();
|
const QString filename = inf.fileName();
|
||||||
|
|
|
@ -694,12 +694,10 @@ QString ResultsTree::AskFileDir(const QString &file)
|
||||||
msgbox.setIcon(QMessageBox::Warning);
|
msgbox.setIcon(QMessageBox::Warning);
|
||||||
msgbox.exec();
|
msgbox.exec();
|
||||||
|
|
||||||
QSettings settings;
|
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"),
|
QString dir = QFileDialog::getExistingDirectory(this, tr("Select Directory"),
|
||||||
settings.value(SETTINGS_LAST_USED_PATH, "").toString(),
|
"",
|
||||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
mCheckPath = dir;
|
mCheckPath = dir;
|
||||||
settings.setValue(SETTINGS_LAST_USED_PATH, dir);
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,14 +308,12 @@ bool SettingsDialog::ShowErrorId() const
|
||||||
|
|
||||||
void SettingsDialog::AddIncludePath()
|
void SettingsDialog::AddIncludePath()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
|
||||||
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
||||||
tr("Select include directory"),
|
tr("Select include directory"),
|
||||||
settings.value(SETTINGS_LAST_USED_PATH, "").toString());
|
QString());
|
||||||
|
|
||||||
if (!selectedDir.isEmpty()) {
|
if (!selectedDir.isEmpty()) {
|
||||||
AddIncludePath(selectedDir);
|
AddIncludePath(selectedDir);
|
||||||
settings.setValue(SETTINGS_LAST_USED_PATH, selectedDir);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue