Moved Fossil operation abortion logic to UICallback
FossilOrigin-Name: eaec54a0320c199d5e1133b38acfafa3da82228e
This commit is contained in:
@@ -12,8 +12,7 @@ static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Fossil::Fossil()
|
||||
: operationAborted(false)
|
||||
, uiCallback(0)
|
||||
: uiCallback(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -732,12 +731,6 @@ bool Fossil::runFossil(const QStringList &args, QStringList *output, int runFlag
|
||||
return exit_code == EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Fossil::abortOperation()
|
||||
{
|
||||
operationAborted = true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Run fossil. Returns true if execution was successful regardless if fossil
|
||||
// issued an error
|
||||
@@ -825,7 +818,6 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
QString ans_always = 'a' + EOL_MARK;
|
||||
QString ans_convert = 'c' + EOL_MARK;
|
||||
|
||||
operationAborted = false;
|
||||
QString buffer;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -851,7 +843,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
if(state!=QProcess::Running && bytes_avail<1)
|
||||
break;
|
||||
|
||||
if(operationAborted)
|
||||
if(uiCallback->processAborted())
|
||||
{
|
||||
log("\n* "+QObject::tr("Terminated")+" *\n");
|
||||
#ifdef Q_OS_WIN // Verify this is still true on Qt5
|
||||
|
@@ -68,8 +68,6 @@ public:
|
||||
bool stashDrop(const QString& name);
|
||||
bool stashDiff(const QString& name);
|
||||
|
||||
void abortOperation();
|
||||
|
||||
// Tags
|
||||
bool tagList(QStringMap& tags);
|
||||
bool tagNew(const QString& name, const QString& revision);
|
||||
@@ -117,7 +115,6 @@ private:
|
||||
|
||||
QString getFossilPath();
|
||||
|
||||
bool operationAborted;
|
||||
UICallback *uiCallback;
|
||||
QString workspacePath;
|
||||
QString fossilPath; // The value from the settings
|
||||
|
@@ -2471,9 +2471,8 @@ void MainWindow::setBusy(bool busy)
|
||||
void MainWindow::onAbort()
|
||||
{
|
||||
operationAborted = true;
|
||||
getWorkspace().fossil().abortOperation();
|
||||
// FIXME: Rename this to something better, Operation Aborted
|
||||
log("<br><b>* "+tr("Terminated")+" *</b><br>", true);
|
||||
uiCallback.abortProcess();
|
||||
log("<br><b>* "+tr("Operation Aborted")+" *</b><br>", true);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -2495,6 +2494,7 @@ void MainWindow::MainWinUICallback::logText(const QString& text, bool isHTML)
|
||||
void MainWindow::MainWinUICallback::beginProcess(const QString& text)
|
||||
{
|
||||
Q_ASSERT(mainWindow);
|
||||
aborted = false;
|
||||
mainWindow->ui->statusBar->showMessage(text);
|
||||
mainWindow->lblTags->setHidden(true);
|
||||
mainWindow->progressBar->setHidden(false);
|
||||
|
@@ -140,7 +140,7 @@ private:
|
||||
class MainWinUICallback : public UICallback
|
||||
{
|
||||
public:
|
||||
MainWinUICallback() : mainWindow(0)
|
||||
MainWinUICallback() : mainWindow(0), aborted(false)
|
||||
{}
|
||||
|
||||
void init(class MainWindow *mainWindow)
|
||||
@@ -151,12 +151,14 @@ private:
|
||||
virtual void logText(const QString& text, bool isHTML);
|
||||
virtual void beginProcess(const QString& text);
|
||||
virtual void updateProcess(const QString& text);
|
||||
virtual bool processAborted() const { return aborted; }
|
||||
virtual void endProcess();
|
||||
virtual QMessageBox::StandardButton Query(const QString &title, const QString &query, QMessageBox::StandardButtons buttons);
|
||||
|
||||
void abortProcess() { aborted = true; }
|
||||
|
||||
private:
|
||||
class MainWindow *mainWindow;
|
||||
bool aborted;
|
||||
};
|
||||
|
||||
friend class MainWinUICallback;
|
||||
|
@@ -23,6 +23,7 @@ public:
|
||||
virtual void logText(const QString &text, bool isHTML)=0;
|
||||
virtual void beginProcess(const QString &text)=0;
|
||||
virtual void updateProcess(const QString &text)=0;
|
||||
virtual bool processAborted() const=0;
|
||||
virtual void endProcess()=0;
|
||||
virtual QMessageBox::StandardButton Query(const QString &title, const QString &query, QMessageBox::StandardButtons buttons)=0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user