diff --git a/manifest b/manifest
index 703634a..c1f93fb 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Initial\ssupport\sfor\sabortable\srefreshes\n
-D 2014-07-29T11:59:44.606
+C -\sPerform\sthe\sfirst\sworkspace\sscan\safter\sthe\smain\swindow\sis\svisible\n-\sAborted\sscans\snow\sleave\sthe\sworkspace\sstate\sempty\sto\sprevent\sincorrect\soperation\n-\sMinor\srefactoring
+D 2014-07-29T14:09:36.103
F dist/arch/PKGBUILD 1d72dad77767f94a6b1a018067188e61927fa564
F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e
F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381
@@ -187,13 +187,13 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
-F src/MainWindow.cpp ec7c571b7664e537998ae8930e5e9d6cb1994fb3
-F src/MainWindow.h 6ee1c046c176782130a064a9feed35def4d93af6
+F src/MainWindow.cpp 0299d46ad799733c7e179a120b6a535b5f5fb2ab
+F src/MainWindow.h dc0a9ed7de8a338e56c38c00ec303796f31bd24d
F src/SettingsDialog.cpp effff92f746a71b07f0e6a72a21caac5a9085123
F src/SettingsDialog.h 01c1f876c64f750ba8820a0d745e377acabe4921
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
F src/Utils.h c546e478a1225a28c99cd4c30f70cf9be9804a2a
-F src/main.cpp 3150a2a1fb103f120a3dcda581a7a41a3c246715
+F src/main.cpp 99a9d7e0634f4ea54259542cacfbb9d1e76ccb75
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
F ui/BrowserWidget.ui 5ad98b13773afadb20a1a2c22148aaebe5dbd95d
F ui/CloneDialog.ui 0fc820804df91f16506ee466a44519fdd44e468f
@@ -201,7 +201,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
F ui/MainWindow.ui 7ede8bbb54513e0771fdf5d5a2566d88c81b73ad
F ui/SettingsDialog.ui 55aefad7145c40d936c43759789d1b50e361b020
-P 30ee66fdd239b24a6450dbb8b2dee4b904813a55
-R 7a758f7890147cf5446303afc8b7b101
-U Kostas
-Z edd995531a4645688e87cfd0c0dd161e
+P ac8a195f2fcfaa16e849461ae63aa01f88d1794d
+R 0de503ecd93bfe74dd7fd86b2c3e51e5
+U kostas
+Z 5ca34810e5aa3638217680aac3bf6987
diff --git a/manifest.uuid b/manifest.uuid
index 0714c6f..8bb3967 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ac8a195f2fcfaa16e849461ae63aa01f88d1794d
\ No newline at end of file
+be20b59a51389fdf0527c039742581032b52e3a5
\ No newline at end of file
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index e4da794..68ea08f 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -25,10 +25,15 @@
#include "Utils.h"
#include "LoggedProcess.h"
-#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
+#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
+
+#define PATH_SEP "/"
+
+static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
+
+// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
+static const QRegExp REGEX_STASH("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
-#define PATH_SEP "/"
-static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
//-----------------------------------------------------------------------------
enum
@@ -229,15 +234,14 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
viewMode = VIEWMODE_TREE;
applySettings();
- refreshOnShow = true;
// Apply any explicit workspace path if available
if(workspacePath && !workspacePath->isEmpty())
openWorkspace(*workspacePath);
- abortCurrentAction = false;
+ abortOperation = false;
- connect(this, SIGNAL(show), SLOT(onShow()), Qt::DirectConnection);
+ rebuildRecent();
}
//------------------------------------------------------------------------------
@@ -669,7 +673,7 @@ void MainWindow::scanWorkspace()
workspaceFiles.clear();
pathSet.clear();
- abortCurrentAction = false;
+ abortOperation = false;
if(scan_files)
{
@@ -683,13 +687,8 @@ void MainWindow::scanWorkspace()
ignore = settings.GetFossilValue(FOSSIL_SETTING_IGNORE_GLOB).toString().replace(',',';');
}
- if(!scanDirectory(all_files, wkdir, wkdir, ignore, abortCurrentAction))
- {
- setBusy(false);
- setStatus("");
- QApplication::restoreOverrideCursor();
- return;
- }
+ if(!scanDirectory(all_files, wkdir, wkdir, ignore, abortOperation))
+ goto _done;
for(QFileInfoList::iterator it=all_files.begin(); it!=all_files.end(); ++it)
{
@@ -783,30 +782,22 @@ void MainWindow::scanWorkspace()
stashMap.clear();
res.clear();
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
- {
- setBusy(false);
- setStatus("");
- QApplication::restoreOverrideCursor();
- return;
- }
-
- // 19: [5c46757d4b9765] on 2012-04-22 04:41:15
- QRegExp stash_rx("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
+ goto _done;
for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); )
{
QString line = *line_it;
- int index = stash_rx.indexIn(line);
+ int index = REGEX_STASH.indexIn(line);
if(index==-1)
break;
- QString id = stash_rx.cap(1);
+ QString id = REGEX_STASH.cap(1);
++line_it;
QString name;
// Finish at an anonymous stash or start of a new stash ?
- if(line_it==res.end() || stash_rx.indexIn(*line_it)!=-1)
+ if(line_it==res.end() || REGEX_STASH.indexIn(*line_it)!=-1)
name = line.trimmed();
else // Named stash
{
@@ -821,6 +812,7 @@ void MainWindow::scanWorkspace()
// Update the file item model
+_done:
updateDirView();
updateFileView();
updateStashView();
@@ -1129,7 +1121,7 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
QString ans_always = 'a' + EOL_MARK;
QString ans_convert = 'c' + EOL_MARK;
- abortCurrentAction = false;
+ abortOperation = false;
QString buffer;
#ifdef Q_OS_WIN
@@ -1150,7 +1142,7 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
if(state!=QProcess::Running && bytes_avail<1)
break;
- if(abortCurrentAction)
+ if(abortOperation)
{
#ifdef Q_OS_WIN // Verify this is still true on Qt5
process.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
@@ -2666,19 +2658,15 @@ void MainWindow::setBusy(bool busy)
//------------------------------------------------------------------------------
void MainWindow::onAbort()
{
- abortCurrentAction = true;
- log("\n* "+tr("Terminated")+" *\n");
+ abortOperation = true;
+ // FIXME: Rename this to something better, Operation Aborted
+ log("
* "+tr("Terminated")+" *
", true);
}
//------------------------------------------------------------------------------
-void MainWindow::onShow()
+void MainWindow::fullRefresh()
{
- if(refreshOnShow)
- {
- refresh();
- rebuildRecent();
- // Select the Root of the tree to update the file view
- selectRootDir();
- refreshOnShow = false;
- }
+ refresh();
+ // Select the Root of the tree to update the file view
+ selectRootDir();
}
diff --git a/src/MainWindow.h b/src/MainWindow.h
index bec9f0c..49aab29 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -120,6 +120,7 @@ public:
explicit MainWindow(Settings &_settings, QWidget *parent = 0, QString *workspacePath = 0);
~MainWindow();
bool diffFile(QString repoFile);
+ void fullRefresh();
private:
typedef QSet stringset_t;
@@ -192,7 +193,6 @@ private slots:
void onTreeViewSelectionChanged(const class QItemSelection &selected, const class QItemSelection &deselected);
void onFileViewDragOut();
void onAbort();
- void onShow();
// Designer slots
void on_actionRefresh_triggered();
@@ -251,8 +251,7 @@ private:
class QAction *recentWorkspaceActs[MAX_RECENT];
class QProgressBar *progressBar;
class QShortcut *abortShortcut;
- bool abortCurrentAction;
- bool refreshOnShow;
+ bool abortOperation;
Settings &settings;
QString projectName;
diff --git a/src/main.cpp b/src/main.cpp
index 231d608..db3e1ab 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -39,6 +39,7 @@ int main(int argc, char *argv[])
0,
workspace.isEmpty() ? 0 : &workspace);
mainwin.show();
+ mainwin.fullRefresh();
return app.exec();
}