- change: rename "compile log" panel to "tools output"
- fix: debug panel can't be correctly show/hide - enhancement: redesign tools output's context menu, add "clear" menu item - update translations
This commit is contained in:
parent
b0bd6475cd
commit
4e16a2e186
3
NEWS.md
3
NEWS.md
|
@ -2,6 +2,9 @@ Red Panda C++ Version 0.14.2
|
|||
- enhancement: file system view mode for project
|
||||
- enhancement: remove / rename / create new folder in the files view
|
||||
- fix: crash when there are catch blocks in the upper most scope
|
||||
- change: rename "compile log" panel to "tools output"
|
||||
- fix: debug panel can't be correctly show/hide
|
||||
- enhancement: redesign tools output's context menu, add "clear" menu item
|
||||
|
||||
Red Panda C++ Version 0.14.1
|
||||
- enhancement: custom theme
|
||||
|
|
|
@ -91,6 +91,7 @@ SOURCES += \
|
|||
todoparser.cpp \
|
||||
toolsmanager.cpp \
|
||||
vcs/gitmanager.cpp \
|
||||
vcs/gitrepository.cpp \
|
||||
widgets/aboutdialog.cpp \
|
||||
widgets/bookmarkmodel.cpp \
|
||||
widgets/classbrowser.cpp \
|
||||
|
@ -219,6 +220,7 @@ HEADERS += \
|
|||
todoparser.h \
|
||||
toolsmanager.h \
|
||||
vcs/gitmanager.h \
|
||||
vcs/gitrepository.h \
|
||||
widgets/aboutdialog.h \
|
||||
widgets/bookmarkmodel.h \
|
||||
widgets/classbrowser.h \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -99,7 +99,7 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin
|
|||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
mCompiler->start();
|
||||
|
@ -129,7 +129,7 @@ void CompilerManager::compileProject(std::shared_ptr<Project> project, bool rebu
|
|||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
mCompiler->start();
|
||||
|
@ -161,7 +161,7 @@ void CompilerManager::cleanProject(std::shared_ptr<Project> project)
|
|||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
mCompiler->start();
|
||||
|
@ -209,7 +209,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QString &conten
|
|||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this, &CompilerManager::onSyntaxCheckFinished);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
mBackgroundSyntaxChecker->start();
|
||||
|
|
|
@ -677,8 +677,8 @@ void MainWindow::applyUISettings()
|
|||
|
||||
ui->actionIssues->setChecked(settings.showIssues());
|
||||
showHideMessagesTab(ui->tabIssues,settings.showIssues());
|
||||
ui->actionCompile_Log->setChecked(settings.showCompileLog());
|
||||
showHideMessagesTab(ui->tabCompilerOutput,settings.showCompileLog());
|
||||
ui->actionTools_Output->setChecked(settings.showCompileLog());
|
||||
showHideMessagesTab(ui->tabToolsOutput,settings.showCompileLog());
|
||||
ui->actionDebug_Window->setChecked(settings.showDebug());
|
||||
showHideMessagesTab(ui->tabDebug,settings.showDebug());
|
||||
ui->actionSearch->setChecked(settings.showSearch());
|
||||
|
@ -1280,6 +1280,8 @@ void MainWindow::updateActionIcons()
|
|||
mBreakpointViewRemoveAllAction->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_CLEAN));
|
||||
mBreakpointViewRemoveAction->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_CROSS));
|
||||
|
||||
//Tools Output
|
||||
|
||||
//classbrowser
|
||||
mClassBrowser_Sort_By_Name->setIcon(pIconsManager->getIcon(IconsManager::ACTION_EDIT_SORT_BY_NAME));
|
||||
mClassBrowser_Sort_By_Type->setIcon(pIconsManager->getIcon(IconsManager::ACTION_EDIT_SORT_BY_TYPE));
|
||||
|
@ -1336,14 +1338,12 @@ void MainWindow::updateActionIcons()
|
|||
idx = ui->tabMessages->indexOf(ui->tabSearch);
|
||||
if (idx>=0)
|
||||
ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_EDIT_SEARCH));
|
||||
idx = ui->tabMessages->indexOf(ui->tabCompilerOutput);
|
||||
idx = ui->tabMessages->indexOf(ui->tabToolsOutput);
|
||||
if (idx>=0)
|
||||
ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_COMPILELOG));
|
||||
idx = ui->tabMessages->indexOf(ui->tabTODO);
|
||||
if (idx>=0)
|
||||
ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_TODO));
|
||||
|
||||
|
||||
idx = ui->tabMessages->indexOf(ui->tabBookmark);
|
||||
if (idx>=0)
|
||||
ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_BOOKMARK));
|
||||
|
@ -1410,7 +1410,7 @@ bool MainWindow::compile(bool rebuild)
|
|||
mCompileSuccessionTask->filename = mProject->executable();
|
||||
}
|
||||
openCloseBottomPanel(true);
|
||||
ui->tabMessages->setCurrentWidget(ui->tabCompilerOutput);
|
||||
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
||||
mCompilerManager->compileProject(mProject,rebuild);
|
||||
updateCompileActions();
|
||||
updateAppTitle();
|
||||
|
@ -1426,7 +1426,7 @@ bool MainWindow::compile(bool rebuild)
|
|||
mCompileSuccessionTask->filename = getCompiledExecutableName(editor->filename());
|
||||
}
|
||||
openCloseBottomPanel(true);
|
||||
ui->tabMessages->setCurrentWidget(ui->tabCompilerOutput);
|
||||
ui->tabMessages->setCurrentWidget(ui->tabToolsOutput);
|
||||
mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild);
|
||||
updateCompileActions();
|
||||
updateAppTitle();
|
||||
|
@ -2742,6 +2742,26 @@ void MainWindow::buildContextMenus()
|
|||
hlayout->addStretch();
|
||||
}
|
||||
|
||||
//context menu signal for class browser
|
||||
ui->txtToolsOutput->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->txtToolsOutput,&QWidget::customContextMenuRequested,
|
||||
this, &MainWindow::onToolsOutputContextMenu);
|
||||
mToolsOutput_Clear = createActionFor(
|
||||
tr("Clear"),
|
||||
ui->txtToolsOutput);
|
||||
connect(mToolsOutput_Clear, &QAction::triggered,
|
||||
this, &MainWindow::onToolsOutputClear);
|
||||
mToolsOutput_Copy = createActionFor(
|
||||
tr("Copy"),
|
||||
ui->txtToolsOutput);
|
||||
mToolsOutput_Copy->setShortcut(QKeySequence("Ctrl+C"));
|
||||
connect(mToolsOutput_Copy, &QAction::triggered,
|
||||
this, &MainWindow::onToolsOutputCopy);
|
||||
mToolsOutput_SelectAll = createActionFor(
|
||||
tr("Select All"),
|
||||
ui->txtToolsOutput);
|
||||
connect(mToolsOutput_SelectAll, &QAction::triggered,
|
||||
this, &MainWindow::onToolsOutputSelectAll);
|
||||
}
|
||||
|
||||
void MainWindow::buildEncodingMenu()
|
||||
|
@ -3117,6 +3137,16 @@ void MainWindow::onLstProblemSetContextMenu(const QPoint &pos)
|
|||
menu.exec(ui->lstProblemSet->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void MainWindow::onToolsOutputContextMenu(const QPoint &pos)
|
||||
{
|
||||
QMenu menu(this);
|
||||
menu.addAction(mToolsOutput_Copy);
|
||||
menu.addAction(mToolsOutput_SelectAll);
|
||||
menu.addSeparator();
|
||||
menu.addAction(mToolsOutput_Clear);
|
||||
menu.exec(ui->txtToolsOutput->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QModelIndex &/* previous */)
|
||||
{
|
||||
QModelIndex idx = current;
|
||||
|
@ -3269,6 +3299,21 @@ void MainWindow::onEditorClosed()
|
|||
updateAppTitle();
|
||||
}
|
||||
|
||||
void MainWindow::onToolsOutputClear()
|
||||
{
|
||||
ui->txtToolsOutput->clear();
|
||||
}
|
||||
|
||||
void MainWindow::onToolsOutputCopy()
|
||||
{
|
||||
ui->txtToolsOutput->copy();
|
||||
}
|
||||
|
||||
void MainWindow::onToolsOutputSelectAll()
|
||||
{
|
||||
ui->txtToolsOutput->selectAll();
|
||||
}
|
||||
|
||||
void MainWindow::onShowInsertCodeSnippetMenu()
|
||||
{
|
||||
mMenuInsertCodeSnippet->clear();
|
||||
|
@ -3962,12 +4007,12 @@ void MainWindow::onCompilerSetChanged(int index)
|
|||
pSettings->compilerSets().saveDefaultIndex();
|
||||
}
|
||||
|
||||
void MainWindow::onCompileLog(const QString& msg)
|
||||
void MainWindow::logToolsOutput(const QString& msg)
|
||||
{
|
||||
ui->txtCompilerOutput->appendPlainText(msg);
|
||||
ui->txtCompilerOutput->moveCursor(QTextCursor::End);
|
||||
ui->txtCompilerOutput->moveCursor(QTextCursor::StartOfLine);
|
||||
ui->txtCompilerOutput->ensureCursorVisible();
|
||||
ui->txtToolsOutput->appendPlainText(msg);
|
||||
ui->txtToolsOutput->moveCursor(QTextCursor::End);
|
||||
ui->txtToolsOutput->moveCursor(QTextCursor::StartOfLine);
|
||||
ui->txtToolsOutput->ensureCursorVisible();
|
||||
}
|
||||
|
||||
void MainWindow::onCompileIssue(PCompileIssue issue)
|
||||
|
@ -3993,9 +4038,14 @@ void MainWindow::onCompileIssue(PCompileIssue issue)
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::clearToolsOutput()
|
||||
{
|
||||
ui->txtToolsOutput->clear();
|
||||
}
|
||||
|
||||
void MainWindow::onCompileStarted()
|
||||
{
|
||||
ui->txtCompilerOutput->clear();
|
||||
//do nothing
|
||||
}
|
||||
|
||||
void MainWindow::onCompileFinished(bool isCheckSyntax)
|
||||
|
@ -6124,17 +6174,17 @@ void MainWindow::on_actionIssues_triggered()
|
|||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionCompile_Log_triggered()
|
||||
void MainWindow::on_actionTools_Output_triggered()
|
||||
{
|
||||
bool state = ui->actionCompile_Log->isChecked();
|
||||
ui->actionCompile_Log->setChecked(state);
|
||||
showHideMessagesTab(ui->tabCompilerOutput,state);
|
||||
bool state = ui->actionTools_Output->isChecked();
|
||||
ui->actionTools_Output->setChecked(state);
|
||||
showHideMessagesTab(ui->tabToolsOutput,state);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionDebug_Window_triggered()
|
||||
{
|
||||
bool state = ui->actionCompile_Log->isChecked();
|
||||
bool state = ui->actionDebug_Window->isChecked();
|
||||
ui->actionDebug_Window->setChecked(state);
|
||||
showHideMessagesTab(ui->tabDebug, state);
|
||||
}
|
||||
|
|
|
@ -183,8 +183,9 @@ public:
|
|||
bool openningFiles() const;
|
||||
|
||||
public slots:
|
||||
void onCompileLog(const QString& msg);
|
||||
void logToolsOutput(const QString& msg);
|
||||
void onCompileIssue(PCompileIssue issue);
|
||||
void clearToolsOutput();
|
||||
void onCompileStarted();
|
||||
void onCompileFinished(bool isCheckSyntax);
|
||||
void onCompileErrorOccured(const QString& reason);
|
||||
|
@ -267,12 +268,17 @@ private slots:
|
|||
void onFileEncodingContextMenu(const QPoint& pos);
|
||||
void onFilesViewContextMenu(const QPoint& pos);
|
||||
void onLstProblemSetContextMenu(const QPoint& pos);
|
||||
void onToolsOutputContextMenu(const QPoint&pos);
|
||||
|
||||
void onProblemSetIndexChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void onProblemCaseIndexChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
void onProblemNameChanged(int index);
|
||||
void onNewProblemConnection();
|
||||
void updateProblemTitle();
|
||||
void onEditorClosed();
|
||||
void onToolsOutputClear();
|
||||
void onToolsOutputCopy();
|
||||
void onToolsOutputSelectAll();
|
||||
|
||||
void onShowInsertCodeSnippetMenu();
|
||||
|
||||
|
@ -534,7 +540,7 @@ private slots:
|
|||
|
||||
void on_actionIssues_triggered();
|
||||
|
||||
void on_actionCompile_Log_triggered();
|
||||
void on_actionTools_Output_triggered();
|
||||
|
||||
void on_actionDebug_Window_triggered();
|
||||
|
||||
|
@ -690,6 +696,11 @@ private:
|
|||
QAction * mProblem_OpenSource;
|
||||
QAction * mProblem_Properties;
|
||||
|
||||
//action for tools output
|
||||
QAction * mToolsOutput_Clear;
|
||||
QAction * mToolsOutput_SelectAll;
|
||||
QAction * mToolsOutput_Copy;
|
||||
|
||||
QSortFilterProxyModel* mProjectProxyModel;
|
||||
|
||||
// QWidget interface
|
||||
|
|
|
@ -518,7 +518,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -552,7 +552,6 @@
|
|||
<widget class="IssuesTable" name="tableIssues">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -581,14 +580,14 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabCompilerOutput">
|
||||
<widget class="QWidget" name="tabToolsOutput">
|
||||
<attribute name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/images/newlook24/015-compres.png</normalon>
|
||||
</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>Compile Log</string>
|
||||
<string>Tools Output</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
|
@ -604,7 +603,7 @@
|
|||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="txtCompilerOutput">
|
||||
<widget class="QPlainTextEdit" name="txtToolsOutput">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -1398,7 +1397,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1114</width>
|
||||
<height>26</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -1561,7 +1560,7 @@
|
|||
<addaction name="actionProblem_Set"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionIssues"/>
|
||||
<addaction name="actionCompile_Log"/>
|
||||
<addaction name="actionTools_Output"/>
|
||||
<addaction name="actionDebug_Window"/>
|
||||
<addaction name="actionSearch"/>
|
||||
<addaction name="actionTODO"/>
|
||||
|
@ -1572,6 +1571,16 @@
|
|||
<addaction name="menuTool_Windows"/>
|
||||
<addaction name="actionStatus_Bar"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGit">
|
||||
<property name="title">
|
||||
<string>Git</string>
|
||||
</property>
|
||||
<addaction name="actionGit_Create_Repository"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGit_Commit"/>
|
||||
<addaction name="actionGit_Revert"/>
|
||||
<addaction name="actionGit_Reset"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menuView"/>
|
||||
|
@ -1580,6 +1589,7 @@
|
|||
<addaction name="menuRefactor"/>
|
||||
<addaction name="menuProject"/>
|
||||
<addaction name="menuExecute"/>
|
||||
<addaction name="menuGit"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuWindow"/>
|
||||
<addaction name="menuHelp"/>
|
||||
|
@ -2590,12 +2600,12 @@
|
|||
<string>Issues</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCompile_Log">
|
||||
<action name="actionTools_Output">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compile Log</string>
|
||||
<string>Tools Output</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug_Window">
|
||||
|
@ -2719,6 +2729,26 @@
|
|||
<string>New Header...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGit_Create_Repository">
|
||||
<property name="text">
|
||||
<string>Create Repository</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGit_Commit">
|
||||
<property name="text">
|
||||
<string>Commit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGit_Revert">
|
||||
<property name="text">
|
||||
<string>Revert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGit_Reset">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Git</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="3">
|
||||
|
|
|
@ -95,25 +95,25 @@ void GitManager::revert(const QString &folder)
|
|||
runGit(folder,args);
|
||||
}
|
||||
|
||||
void GitManager::reset(const QString &folder, const QString &commit, ResetStrategy strategy)
|
||||
void GitManager::reset(const QString &folder, const QString &commit, GitResetStrategy strategy)
|
||||
{
|
||||
//todo reset type
|
||||
QStringList args;
|
||||
args.append("reset");
|
||||
switch(strategy) {
|
||||
case ResetStrategy::Soft:
|
||||
case GitResetStrategy::Soft:
|
||||
args.append("--soft");
|
||||
break;
|
||||
case ResetStrategy::Hard:
|
||||
case GitResetStrategy::Hard:
|
||||
args.append("--hard");
|
||||
break;
|
||||
case ResetStrategy::Mixed:
|
||||
case GitResetStrategy::Mixed:
|
||||
args.append("--mixed");
|
||||
break;
|
||||
case ResetStrategy::Merge:
|
||||
case GitResetStrategy::Merge:
|
||||
args.append("--merge");
|
||||
break;
|
||||
case ResetStrategy::Keep:
|
||||
case GitResetStrategy::Keep:
|
||||
args.append("--keep");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,25 +3,17 @@
|
|||
|
||||
#include <QObject>
|
||||
#include "utils.h"
|
||||
#include "gitrepository.h"
|
||||
|
||||
class GitError: public BaseError {
|
||||
public:
|
||||
explicit GitError(const QString& reason);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class GitManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class ResetStrategy {
|
||||
Soft,
|
||||
Hard,
|
||||
Merge,
|
||||
Mixed,
|
||||
Keep
|
||||
};
|
||||
|
||||
explicit GitManager(QObject *parent = nullptr);
|
||||
|
||||
|
@ -38,7 +30,7 @@ public:
|
|||
void clone(const QString& folder, const QString& url);
|
||||
void commit(const QString& folder, const QString& message);
|
||||
void revert(const QString& folder);
|
||||
void reset(const QString& folder, const QString& commit, ResetStrategy strategy);
|
||||
void reset(const QString& folder, const QString& commit, GitResetStrategy strategy);
|
||||
|
||||
signals:
|
||||
void gitCmdRunning(const QString& gitCmd);
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
#include "gitrepository.h"
|
||||
#include "gitmanager.h"
|
||||
|
||||
GitRepository::GitRepository(const QString& folder, GitManager *manager, QObject *parent)
|
||||
: QObject{parent},
|
||||
mFolder(folder),
|
||||
mManager(manager)
|
||||
{
|
||||
Q_ASSERT(manager!=nullptr);
|
||||
}
|
||||
|
||||
const QString &GitRepository::folder() const
|
||||
{
|
||||
return mFolder;
|
||||
}
|
||||
|
||||
void GitRepository::createRepository()
|
||||
{
|
||||
mManager->createRepository(mFolder);
|
||||
}
|
||||
|
||||
bool GitRepository::hasRepository()
|
||||
{
|
||||
return mManager->hasRepository(mFolder);
|
||||
}
|
||||
|
||||
void GitRepository::add(const QString &path)
|
||||
{
|
||||
mManager->add(mFolder,path);
|
||||
}
|
||||
|
||||
void GitRepository::remove(const QString &path)
|
||||
{
|
||||
mManager->remove(mFolder,path);
|
||||
}
|
||||
|
||||
void GitRepository::rename(const QString &oldName, const QString &newName)
|
||||
{
|
||||
mManager->rename(mFolder, oldName, newName);
|
||||
}
|
||||
|
||||
void GitRepository::restore(const QString &path)
|
||||
{
|
||||
mManager->restore(mFolder, path);
|
||||
}
|
||||
|
||||
QStringList GitRepository::listFiles(bool refresh)
|
||||
{
|
||||
if (refresh || mFiles.isEmpty()) {
|
||||
mFiles = mManager->listFiles(mFolder);
|
||||
}
|
||||
return mFiles;
|
||||
}
|
||||
|
||||
void GitRepository::clone(const QString &url)
|
||||
{
|
||||
mManager->clone(mFolder,url);
|
||||
}
|
||||
|
||||
void GitRepository::commit(const QString &message)
|
||||
{
|
||||
mManager->commit(mFolder, message);
|
||||
}
|
||||
|
||||
void GitRepository::revert()
|
||||
{
|
||||
mManager->revert(mFolder);
|
||||
}
|
||||
|
||||
void GitRepository::reset(const QString &commit, GitResetStrategy strategy)
|
||||
{
|
||||
mManager->reset(mFolder,commit,strategy);
|
||||
}
|
||||
|
||||
GitManager *GitRepository::manager() const
|
||||
{
|
||||
return mManager;
|
||||
}
|
||||
|
||||
void GitRepository::setManager(GitManager *newManager)
|
||||
{
|
||||
Q_ASSERT(newManager!=nullptr);
|
||||
mManager = newManager;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
#ifndef GITREPOSITORY_H
|
||||
#define GITREPOSITORY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <memory>
|
||||
|
||||
enum class GitResetStrategy {
|
||||
Soft,
|
||||
Hard,
|
||||
Merge,
|
||||
Mixed,
|
||||
Keep
|
||||
};
|
||||
|
||||
class GitManager;
|
||||
class GitRepository : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GitRepository(const QString& folder, GitManager* manager, QObject *parent = nullptr);
|
||||
|
||||
const QString &folder() const;
|
||||
|
||||
void createRepository();
|
||||
bool hasRepository();
|
||||
|
||||
void add(const QString& path);
|
||||
void remove(const QString& path);
|
||||
void rename(const QString& oldName, const QString& newName);
|
||||
void restore(const QString& path);
|
||||
QStringList listFiles(bool refresh);
|
||||
|
||||
void clone(const QString& url);
|
||||
void commit(const QString& message);
|
||||
void revert();
|
||||
void reset(const QString& commit, GitResetStrategy strategy);
|
||||
|
||||
GitManager *manager() const;
|
||||
void setManager(GitManager *newManager);
|
||||
|
||||
signals:
|
||||
private:
|
||||
QString mFolder;
|
||||
GitManager* mManager;
|
||||
QStringList mFiles;
|
||||
};
|
||||
|
||||
#endif // GITREPOSITORY_H
|
Loading…
Reference in New Issue