- 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
|
- fix: error in templates
|
||||||
- enhancement: git - reset
|
- enhancement: git - reset
|
||||||
- fix: header completion error when header name contains '+'
|
- 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
|
Red Panda C++ Version 0.14.3
|
||||||
- fix: wrong code completion font size, when screen dpi changed
|
- 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
|
#endif
|
||||||
|
|
||||||
QString getSettingFilename(const QString& filepath = QString()) {
|
QString getSettingFilename(const QString& filepath, bool& firstRun) {
|
||||||
QString filename;
|
QString filename;
|
||||||
if (filepath.isEmpty()) {
|
if (filepath.isEmpty()) {
|
||||||
if (isGreenEdition()) {
|
if (isGreenEdition()) {
|
||||||
|
@ -90,6 +90,7 @@ QString getSettingFilename(const QString& filepath = QString()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo fileInfo(filename);
|
QFileInfo fileInfo(filename);
|
||||||
|
firstRun = !fileInfo.exists();
|
||||||
QDir dir(fileInfo.absoluteDir());
|
QDir dir(fileInfo.absoluteDir());
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
if (!dir.mkpath(dir.absolutePath())) {
|
if (!dir.mkpath(dir.absolutePath())) {
|
||||||
|
@ -115,12 +116,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
//Translation must be loaded first
|
//Translation must be loaded first
|
||||||
QTranslator trans,transQt;
|
QTranslator trans,transQt;
|
||||||
QString settingFilename = getSettingFilename();
|
bool firstRun;
|
||||||
|
QString settingFilename = getSettingFilename(QString(), firstRun);
|
||||||
if (!isGreenEdition()) {
|
if (!isGreenEdition()) {
|
||||||
QDir::setCurrent(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]);
|
QDir::setCurrent(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]);
|
||||||
}
|
}
|
||||||
if (settingFilename.isEmpty())
|
if (settingFilename.isEmpty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
{
|
{
|
||||||
QSettings languageSetting(settingFilename,QSettings::IniFormat);
|
QSettings languageSetting(settingFilename,QSettings::IniFormat);
|
||||||
languageSetting.beginGroup(SETTING_ENVIRONMENT);
|
languageSetting.beginGroup(SETTING_ENVIRONMENT);
|
||||||
|
@ -149,6 +152,11 @@ int main(int argc, char *argv[])
|
||||||
auto charsetInfoManager = std::unique_ptr<CharsetInfoManager>(pCharsetInfoManager);
|
auto charsetInfoManager = std::unique_ptr<CharsetInfoManager>(pCharsetInfoManager);
|
||||||
//load settings
|
//load settings
|
||||||
pSettings = new Settings(settingFilename);
|
pSettings = new Settings(settingFilename);
|
||||||
|
if (firstRun) {
|
||||||
|
pSettings->compilerSets().findSets();
|
||||||
|
pSettings->compilerSets().saveSets();
|
||||||
|
}
|
||||||
|
pSettings->load();
|
||||||
auto settings = std::unique_ptr<Settings>(pSettings);
|
auto settings = std::unique_ptr<Settings>(pSettings);
|
||||||
|
|
||||||
//Color scheme settings must be loaded after translation
|
//Color scheme settings must be loaded after translation
|
||||||
|
|
|
@ -905,30 +905,42 @@ void MainWindow::rebuildOpenedFileHisotryMenu()
|
||||||
{
|
{
|
||||||
mMenuRecentFiles->clear();
|
mMenuRecentFiles->clear();
|
||||||
mMenuRecentProjects->clear();
|
mMenuRecentProjects->clear();
|
||||||
if (pSettings->history().openedFiles().size()==0) {
|
if (pSettings->history().opennedFiles().size()==0) {
|
||||||
mMenuRecentFiles->setEnabled(false);
|
mMenuRecentFiles->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mMenuRecentFiles->setEnabled(true);
|
mMenuRecentFiles->setEnabled(true);
|
||||||
for (const QString& filename: pSettings->history().openedFiles()) {
|
for (const QString& filename: pSettings->history().opennedFiles()) {
|
||||||
QAction* action = new QAction(filename,mMenuRecentFiles);
|
QAction* action = new QAction(filename,mMenuRecentFiles);
|
||||||
connect(action, &QAction::triggered, [&filename,this](bool){
|
connect(action, &QAction::triggered, [&filename,this](bool){
|
||||||
openFile(filename);
|
openFile(filename);
|
||||||
});
|
});
|
||||||
mMenuRecentFiles->addAction(action);
|
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);
|
mMenuRecentProjects->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mMenuRecentProjects->setEnabled(true);
|
mMenuRecentProjects->setEnabled(true);
|
||||||
for (const QString& filename: pSettings->history().openedProjects()) {
|
for (const QString& filename: pSettings->history().opennedProjects()) {
|
||||||
QAction* action = new QAction(filename,mMenuRecentProjects);
|
QAction* action = new QAction(filename,mMenuRecentProjects);
|
||||||
connect(action, &QAction::triggered, [&filename,this](bool){
|
connect(action, &QAction::triggered, [&filename,this](bool){
|
||||||
this->openProject(filename);
|
this->openProject(filename);
|
||||||
});
|
});
|
||||||
mMenuRecentProjects->addAction(action);
|
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(mProject_SwitchCustomViewMode);
|
||||||
}
|
}
|
||||||
menu.addAction(ui->actionProject_options);
|
menu.addAction(ui->actionProject_options);
|
||||||
|
menu.addSeparator();
|
||||||
|
menu.addAction(ui->actionClose_Project);
|
||||||
|
|
||||||
if (pSettings->vcs().gitOk() && hasRepository) {
|
if (pSettings->vcs().gitOk() && hasRepository) {
|
||||||
mProject->model()->iconProvider()->update();
|
mProject->model()->iconProvider()->update();
|
||||||
|
|
|
@ -49,7 +49,7 @@ Settings::Settings(const QString &filename):
|
||||||
mUI(this),
|
mUI(this),
|
||||||
mVCS(this)
|
mVCS(this)
|
||||||
{
|
{
|
||||||
load();
|
//load();
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::~Settings()
|
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;
|
return mOpenedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList &Settings::History::openedProjects() const
|
const QStringList &Settings::History::opennedProjects() const
|
||||||
{
|
{
|
||||||
return mOpenedProjects;
|
return mOpenedProjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::History::clearOpennedFiles()
|
||||||
|
{
|
||||||
|
mOpenedFiles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::History::clearOpennedProjects()
|
||||||
|
{
|
||||||
|
mOpenedProjects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::History::addToOpenedFiles(const QString &filename)
|
bool Settings::History::addToOpenedFiles(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!QFile(filename).exists())
|
if (!QFile(filename).exists())
|
||||||
|
|
|
@ -803,8 +803,10 @@ public:
|
||||||
public:
|
public:
|
||||||
explicit History(Settings *settings);
|
explicit History(Settings *settings);
|
||||||
|
|
||||||
const QStringList& openedFiles() const;
|
const QStringList& opennedFiles() const;
|
||||||
const QStringList& openedProjects() const;
|
const QStringList& opennedProjects() const;
|
||||||
|
void clearOpennedFiles();
|
||||||
|
void clearOpennedProjects();
|
||||||
bool addToOpenedFiles(const QString& filename);
|
bool addToOpenedFiles(const QString& filename);
|
||||||
void removeFile(const QString& filename);
|
void removeFile(const QString& filename);
|
||||||
bool addToOpenedProjects(const QString& filename);
|
bool addToOpenedProjects(const QString& filename);
|
||||||
|
|
Loading…
Reference in New Issue