- enhancement: auto save/load the default open folder in the configuration file

This commit is contained in:
royqh1979@gmail.com 2021-11-10 10:42:33 +08:00
parent 1549fe1aed
commit 4e7269cbf0
6 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,6 @@
Version 0.8.4 For Dev-C++ 7 Beta
- enhancement: auto save/load the default open folder in the configuration file
Version 0.8.3 For Dev-C++ 7 Beta
- enhancement: View menu
- enhancement: hide/show statusbar

View File

@ -124,6 +124,10 @@ int main(int argc, char *argv[])
QMessageBox::Ok);
}
//set default open folder
QDir::setCurrent(pSettings->environment().defaultOpenFolder());
MainWindow mainWindow;
pMainWindow = &mainWindow;
if (app.arguments().count()>1) {

View File

@ -3254,6 +3254,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
settings.save();
//save current folder ( for files view )
pSettings->environment().setDefaultOpenFolder(QDir::currentPath());
pSettings->environment().save();
try {
mBookmarkModel->save(includeTrailingPathDelimiter(pSettings->dirs().config())

View File

@ -2658,10 +2658,15 @@ void Settings::Environment::doLoad()
mInterfaceFont = stringValue("interface font","Segoe UI");
mInterfaceFontSize = intValue("interface font size",10);
mLanguage = stringValue("language", QLocale::system().name());
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
if (!fileExists(mCurrentFolder)) {
mCurrentFolder = QDir::currentPath();
}
mDefaultOpenFolder = stringValue("default_open_folder",QDir::currentPath());
if (!fileExists(mDefaultOpenFolder)) {
mDefaultOpenFolder = QDir::currentPath();
}
}
int Settings::Environment::interfaceFontSize() const
@ -2694,6 +2699,16 @@ void Settings::Environment::setCurrentFolder(const QString &newCurrentFolder)
mCurrentFolder = newCurrentFolder;
}
const QString &Settings::Environment::defaultOpenFolder() const
{
return mDefaultOpenFolder;
}
void Settings::Environment::setDefaultOpenFolder(const QString &newDefaultOpenFolder)
{
mDefaultOpenFolder = newDefaultOpenFolder;
}
void Settings::Environment::doSave()
{
//Appearence
@ -2701,7 +2716,9 @@ void Settings::Environment::doSave()
saveValue("interface font", mInterfaceFont);
saveValue("interface font size", mInterfaceFontSize);
saveValue("language", mLanguage);
saveValue("current_folder",mCurrentFolder);
saveValue("default_open_folder",mDefaultOpenFolder);
}
QString Settings::Environment::interfaceFont() const

View File

@ -468,6 +468,9 @@ public:
const QString &currentFolder() const;
void setCurrentFolder(const QString &newCurrentFolder);
const QString &defaultOpenFolder() const;
void setDefaultOpenFolder(const QString &newDefaultOpenFolder);
private:
//Appearence
@ -476,6 +479,8 @@ public:
int mInterfaceFontSize;
QString mLanguage;
QString mCurrentFolder;
QString mDefaultOpenFolder;
// _Base interface
protected:
void doSave() override;

View File

@ -3,7 +3,7 @@
#include <QStringList>
#define DEVCPP_VERSION "beta.0.8.3"
#define DEVCPP_VERSION "beta.0.8.4"
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
#ifdef Q_OS_WIN