- enhancement: clear history in file -> recent menu
- enhancement: close project in project view's context menu - enhancement: auto find compiler sets when run for the first time
This commit is contained in:
parent
ed7f3d971e
commit
205d517fcd
3
NEWS.md
3
NEWS.md
|
@ -3,6 +3,9 @@ Red Panda C++ Version 0.14.4
|
|||
- fix: error in templates
|
||||
- enhancement: git - reset
|
||||
- fix: header completion error when header name contains '+'
|
||||
- enhancement: clear history in file -> recent menu
|
||||
- enhancement: close project in project view's context menu
|
||||
- enhancement: auto find compiler sets when run for the first time
|
||||
|
||||
Red Panda C++ Version 0.14.3
|
||||
- fix: wrong code completion font size, when screen dpi changed
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -75,7 +75,7 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/
|
|||
}
|
||||
#endif
|
||||
|
||||
QString getSettingFilename(const QString& filepath = QString()) {
|
||||
QString getSettingFilename(const QString& filepath, bool& firstRun) {
|
||||
QString filename;
|
||||
if (filepath.isEmpty()) {
|
||||
if (isGreenEdition()) {
|
||||
|
@ -90,6 +90,7 @@ QString getSettingFilename(const QString& filepath = QString()) {
|
|||
}
|
||||
|
||||
QFileInfo fileInfo(filename);
|
||||
firstRun = !fileInfo.exists();
|
||||
QDir dir(fileInfo.absoluteDir());
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkpath(dir.absolutePath())) {
|
||||
|
@ -115,12 +116,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
//Translation must be loaded first
|
||||
QTranslator trans,transQt;
|
||||
QString settingFilename = getSettingFilename();
|
||||
bool firstRun;
|
||||
QString settingFilename = getSettingFilename(QString(), firstRun);
|
||||
if (!isGreenEdition()) {
|
||||
QDir::setCurrent(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]);
|
||||
}
|
||||
if (settingFilename.isEmpty())
|
||||
return -1;
|
||||
|
||||
{
|
||||
QSettings languageSetting(settingFilename,QSettings::IniFormat);
|
||||
languageSetting.beginGroup(SETTING_ENVIRONMENT);
|
||||
|
@ -149,6 +152,11 @@ int main(int argc, char *argv[])
|
|||
auto charsetInfoManager = std::unique_ptr<CharsetInfoManager>(pCharsetInfoManager);
|
||||
//load settings
|
||||
pSettings = new Settings(settingFilename);
|
||||
if (firstRun) {
|
||||
pSettings->compilerSets().findSets();
|
||||
pSettings->compilerSets().saveSets();
|
||||
}
|
||||
pSettings->load();
|
||||
auto settings = std::unique_ptr<Settings>(pSettings);
|
||||
|
||||
//Color scheme settings must be loaded after translation
|
||||
|
|
|
@ -905,30 +905,42 @@ void MainWindow::rebuildOpenedFileHisotryMenu()
|
|||
{
|
||||
mMenuRecentFiles->clear();
|
||||
mMenuRecentProjects->clear();
|
||||
if (pSettings->history().openedFiles().size()==0) {
|
||||
if (pSettings->history().opennedFiles().size()==0) {
|
||||
mMenuRecentFiles->setEnabled(false);
|
||||
} else {
|
||||
mMenuRecentFiles->setEnabled(true);
|
||||
for (const QString& filename: pSettings->history().openedFiles()) {
|
||||
for (const QString& filename: pSettings->history().opennedFiles()) {
|
||||
QAction* action = new QAction(filename,mMenuRecentFiles);
|
||||
connect(action, &QAction::triggered, [&filename,this](bool){
|
||||
openFile(filename);
|
||||
});
|
||||
mMenuRecentFiles->addAction(action);
|
||||
}
|
||||
mMenuRecentFiles->addSeparator();
|
||||
QAction *action = new QAction(tr("Clear History"),mMenuRecentFiles);
|
||||
connect(action, &QAction::triggered, [](bool){
|
||||
pSettings->history().clearOpennedFiles();
|
||||
});
|
||||
mMenuRecentFiles->addAction(action);
|
||||
}
|
||||
|
||||
if (pSettings->history().openedProjects().size()==0) {
|
||||
if (pSettings->history().opennedProjects().size()==0) {
|
||||
mMenuRecentProjects->setEnabled(false);
|
||||
} else {
|
||||
mMenuRecentProjects->setEnabled(true);
|
||||
for (const QString& filename: pSettings->history().openedProjects()) {
|
||||
for (const QString& filename: pSettings->history().opennedProjects()) {
|
||||
QAction* action = new QAction(filename,mMenuRecentProjects);
|
||||
connect(action, &QAction::triggered, [&filename,this](bool){
|
||||
this->openProject(filename);
|
||||
});
|
||||
mMenuRecentProjects->addAction(action);
|
||||
}
|
||||
mMenuRecentProjects->addSeparator();
|
||||
QAction *action = new QAction(tr("Clear History"),mMenuRecentProjects);
|
||||
connect(action, &QAction::triggered, [](bool){
|
||||
pSettings->history().clearOpennedProjects();
|
||||
});
|
||||
mMenuRecentProjects->addAction(action);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3061,6 +3073,8 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
|
|||
menu.addAction(mProject_SwitchCustomViewMode);
|
||||
}
|
||||
menu.addAction(ui->actionProject_options);
|
||||
menu.addSeparator();
|
||||
menu.addAction(ui->actionClose_Project);
|
||||
|
||||
if (pSettings->vcs().gitOk() && hasRepository) {
|
||||
mProject->model()->iconProvider()->update();
|
||||
|
|
|
@ -49,7 +49,7 @@ Settings::Settings(const QString &filename):
|
|||
mUI(this),
|
||||
mVCS(this)
|
||||
{
|
||||
load();
|
||||
//load();
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
|
@ -3451,16 +3451,26 @@ Settings::History::History(Settings *settings):_Base(settings, SETTING_HISTORY)
|
|||
|
||||
}
|
||||
|
||||
const QStringList &Settings::History::openedFiles() const
|
||||
const QStringList &Settings::History::opennedFiles() const
|
||||
{
|
||||
return mOpenedFiles;
|
||||
}
|
||||
|
||||
const QStringList &Settings::History::openedProjects() const
|
||||
const QStringList &Settings::History::opennedProjects() const
|
||||
{
|
||||
return mOpenedProjects;
|
||||
}
|
||||
|
||||
void Settings::History::clearOpennedFiles()
|
||||
{
|
||||
mOpenedFiles.clear();
|
||||
}
|
||||
|
||||
void Settings::History::clearOpennedProjects()
|
||||
{
|
||||
mOpenedProjects.clear();
|
||||
}
|
||||
|
||||
bool Settings::History::addToOpenedFiles(const QString &filename)
|
||||
{
|
||||
if (!QFile(filename).exists())
|
||||
|
|
|
@ -803,8 +803,10 @@ public:
|
|||
public:
|
||||
explicit History(Settings *settings);
|
||||
|
||||
const QStringList& openedFiles() const;
|
||||
const QStringList& openedProjects() const;
|
||||
const QStringList& opennedFiles() const;
|
||||
const QStringList& opennedProjects() const;
|
||||
void clearOpennedFiles();
|
||||
void clearOpennedProjects();
|
||||
bool addToOpenedFiles(const QString& filename);
|
||||
void removeFile(const QString& filename);
|
||||
bool addToOpenedProjects(const QString& filename);
|
||||
|
|
Loading…
Reference in New Issue