work save
This commit is contained in:
parent
3e442b0860
commit
d2ca199024
|
@ -90,10 +90,23 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->tblStackTrace->setModel(mDebugger->backtraceModel());
|
||||
ui->watchView->setModel(mDebugger->watchModel());
|
||||
|
||||
mDebugger->breakpointModel()->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BREAKPOINTS_FILE);
|
||||
mDebugger->watchModel()->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
try {
|
||||
mDebugger->breakpointModel()->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BREAKPOINTS_FILE);
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
try {
|
||||
mDebugger->watchModel()->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_WATCH_FILE);
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
|
||||
|
||||
// ui->actionIndent->setShortcut(Qt::Key_Tab);
|
||||
// ui->actionUnIndent->setShortcut(Qt::Key_Tab | Qt::ShiftModifier);
|
||||
|
@ -149,14 +162,39 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
mTodoParser = std::make_shared<TodoParser>();
|
||||
mSymbolUsageManager = std::make_shared<SymbolUsageManager>();
|
||||
mSymbolUsageManager->load();
|
||||
try {
|
||||
mSymbolUsageManager->load();
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
|
||||
mCodeSnippetManager = std::make_shared<CodeSnippetsManager>();
|
||||
mCodeSnippetManager->load();
|
||||
try {
|
||||
mCodeSnippetManager->load();
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
mToolsManager = std::make_shared<ToolsManager>();
|
||||
mToolsManager->load();
|
||||
try {
|
||||
mToolsManager->load();
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
mBookmarkModel = std::make_shared<BookmarkModel>();
|
||||
mBookmarkModel->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
try {
|
||||
mBookmarkModel->load(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BOOKMARK_FILE);
|
||||
} catch (FileError &e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Error"),
|
||||
e.reason());
|
||||
}
|
||||
ui->tableBookmark->setModel(mBookmarkModel.get());
|
||||
mSearchResultTreeModel = std::make_shared<SearchResultTreeModel>(&mSearchResultModel);
|
||||
mSearchResultListModel = std::make_shared<SearchResultListModel>(&mSearchResultModel);
|
||||
|
@ -169,6 +207,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->searchView,&QTreeView::expandAll);
|
||||
ui->replacePanel->setVisible(false);
|
||||
|
||||
|
||||
ui->treeFiles->setModel(&mFileSystemModel);
|
||||
mFileSystemModel.setRootPath(pSettings->environment().currentFolder());
|
||||
ui->treeFiles->setRootIndex(mFileSystemModel.index(pSettings->environment().currentFolder()));
|
||||
//class browser
|
||||
ui->classBrowser->setModel(&mClassBrowserModel);
|
||||
|
||||
|
@ -2030,6 +2072,8 @@ void MainWindow::buildContextMenus()
|
|||
mFileEncodingStatus->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(mFileEncodingStatus,&QWidget::customContextMenuRequested,
|
||||
this, &MainWindow::onFileEncodingContextMenu);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
void MainWindow::buildEncodingMenu()
|
||||
|
@ -2710,18 +2754,37 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
settings.setLeftPanelIndex(ui->tabInfos->currentIndex());
|
||||
settings.setLeftPanelOpenned(mLeftPanelOpenned);
|
||||
settings.save();
|
||||
mBookmarkModel->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
try {
|
||||
mBookmarkModel->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BOOKMARK_FILE);
|
||||
if (pSettings->debugger().autosaveBreakpoints())
|
||||
mDebugger->breakpointModel()->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BREAKPOINTS_FILE);
|
||||
else
|
||||
} catch (FileError& e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Save Error"),
|
||||
e.reason());
|
||||
}
|
||||
|
||||
if (pSettings->debugger().autosaveBreakpoints()) {
|
||||
try {
|
||||
mDebugger->breakpointModel()->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BREAKPOINTS_FILE);
|
||||
} catch (FileError& e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Save Error"),
|
||||
e.reason());
|
||||
}
|
||||
} else
|
||||
removeFile(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_BREAKPOINTS_FILE);
|
||||
if (pSettings->debugger().autosaveWatches())
|
||||
mDebugger->watchModel()->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_WATCH_FILE);
|
||||
else
|
||||
if (pSettings->debugger().autosaveWatches()) {
|
||||
try {
|
||||
mDebugger->watchModel()->save(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_WATCH_FILE);
|
||||
} catch (FileError& e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Save Error"),
|
||||
e.reason());
|
||||
}
|
||||
} else
|
||||
removeFile(includeTrailingPathDelimiter(pSettings->dirs().config())
|
||||
+DEV_WATCH_FILE);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QFileSystemWatcher>
|
||||
#include <QMainWindow>
|
||||
#include <QTimer>
|
||||
#include <QFileSystemModel>
|
||||
#include "common.h"
|
||||
#include "widgets/searchresultview.h"
|
||||
#include "widgets/classbrowser.h"
|
||||
|
@ -458,6 +459,7 @@ private:
|
|||
PCodeSnippetManager mCodeSnippetManager;
|
||||
PTodoParser mTodoParser;
|
||||
PToolsManager mToolsManager;
|
||||
QFileSystemModel mFileSystemModel;
|
||||
|
||||
bool mCheckSyntaxInBack;
|
||||
bool mOpenClosingBottomPanel;
|
||||
|
@ -504,6 +506,16 @@ private:
|
|||
QAction * mClassBrowser_goto_definition;
|
||||
QWidget * mClassBrowserToolbar;
|
||||
|
||||
//actions for files view
|
||||
QAction * mFilesView_Open;
|
||||
QAction * mFilesView_OpenWithExternal;
|
||||
QAction * mFilesView_OpenInTerminal;
|
||||
QAction * mFilesView_OpenInExplorer;
|
||||
QAction * mFilesView_OnlyShowDevFiles;
|
||||
QAction * mFilesView_LocateCurrent;
|
||||
|
||||
QWidget * mFilesViewToolbar;
|
||||
|
||||
//action for debug console
|
||||
QAction * mDebugConsole_ShowCommandLog;
|
||||
QAction * mDebugConsole_Clear;
|
||||
|
|
|
@ -204,6 +204,32 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabFiles">
|
||||
<attribute name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/018-copy.png</normaloff>:/icons/images/newlook24/018-copy.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Files</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeFiles"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="EditorPanel" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -2618,6 +2618,7 @@ 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());
|
||||
}
|
||||
|
||||
int Settings::Environment::interfaceFontSize() const
|
||||
|
@ -2640,6 +2641,16 @@ void Settings::Environment::setLanguage(const QString &language)
|
|||
mLanguage = language;
|
||||
}
|
||||
|
||||
const QString &Settings::Environment::currentFolder() const
|
||||
{
|
||||
return mCurrentFolder;
|
||||
}
|
||||
|
||||
void Settings::Environment::setCurrentFolder(const QString &newCurrentFolder)
|
||||
{
|
||||
mCurrentFolder = newCurrentFolder;
|
||||
}
|
||||
|
||||
void Settings::Environment::doSave()
|
||||
{
|
||||
//Appearence
|
||||
|
@ -2647,6 +2658,7 @@ void Settings::Environment::doSave()
|
|||
saveValue("interface font", mInterfaceFont);
|
||||
saveValue("interface font size", mInterfaceFontSize);
|
||||
saveValue("language", mLanguage);
|
||||
saveValue("current_folder",mCurrentFolder);
|
||||
}
|
||||
|
||||
QString Settings::Environment::interfaceFont() const
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
#include "qsynedit/SynEdit.h"
|
||||
|
||||
/**
|
||||
|
@ -455,6 +456,9 @@ public:
|
|||
QString language() const;
|
||||
void setLanguage(const QString &language);
|
||||
|
||||
const QString ¤tFolder() const;
|
||||
void setCurrentFolder(const QString &newCurrentFolder);
|
||||
|
||||
private:
|
||||
|
||||
//Appearence
|
||||
|
@ -462,6 +466,7 @@ public:
|
|||
QString mInterfaceFont;
|
||||
int mInterfaceFontSize;
|
||||
QString mLanguage;
|
||||
QString mCurrentFolder;
|
||||
// _Base interface
|
||||
protected:
|
||||
void doSave() override;
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
#include <QListView>
|
||||
#include <QMessageBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QSpinBox>
|
||||
#include "../widgets/coloredit.h"
|
||||
#include "../utils.h"
|
||||
|
||||
SettingsWidget::SettingsWidget(const QString &name, const QString &group, QWidget *parent):
|
||||
QWidget(parent),
|
||||
|
@ -27,14 +29,26 @@ void SettingsWidget::init()
|
|||
|
||||
void SettingsWidget::load()
|
||||
{
|
||||
doLoad();
|
||||
clearSettingsChanged();
|
||||
try {
|
||||
doLoad();
|
||||
clearSettingsChanged();
|
||||
} catch (FileError & e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Load Error"),
|
||||
e.reason());
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWidget::save()
|
||||
{
|
||||
doSave();
|
||||
clearSettingsChanged();
|
||||
try {
|
||||
doSave();
|
||||
clearSettingsChanged();
|
||||
} catch (FileError & e) {
|
||||
QMessageBox::warning(nullptr,
|
||||
tr("Save Error"),
|
||||
e.reason());
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWidget::connectAbstractItemView(QAbstractItemView *pView)
|
||||
|
|
Loading…
Reference in New Issue