Initial support for abortable refreshes
FossilOrigin-Name: ac8a195f2fcfaa16e849461ae63aa01f88d1794d
This commit is contained in:
parent
5ebf0dbef4
commit
76f6550ae5
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Refreshed\slocalizations\nChanged\sversion\sto\s0.9.8
|
C Initial\ssupport\sfor\sabortable\srefreshes\n
|
||||||
D 2014-07-29T08:30:53.427
|
D 2014-07-29T11:59:44.606
|
||||||
F dist/arch/PKGBUILD 1d72dad77767f94a6b1a018067188e61927fa564
|
F dist/arch/PKGBUILD 1d72dad77767f94a6b1a018067188e61927fa564
|
||||||
F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e
|
F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e
|
||||||
F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381
|
F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381
|
||||||
@ -187,8 +187,8 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
|||||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||||
F src/MainWindow.cpp 6e217d10880fc3d544d4a0de384684feb1152647
|
F src/MainWindow.cpp ec7c571b7664e537998ae8930e5e9d6cb1994fb3
|
||||||
F src/MainWindow.h 631af46749d69c3be1b5c1427c7ff6bd43855ad5
|
F src/MainWindow.h 6ee1c046c176782130a064a9feed35def4d93af6
|
||||||
F src/SettingsDialog.cpp effff92f746a71b07f0e6a72a21caac5a9085123
|
F src/SettingsDialog.cpp effff92f746a71b07f0e6a72a21caac5a9085123
|
||||||
F src/SettingsDialog.h 01c1f876c64f750ba8820a0d745e377acabe4921
|
F src/SettingsDialog.h 01c1f876c64f750ba8820a0d745e377acabe4921
|
||||||
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
|
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
|
||||||
@ -201,7 +201,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
|||||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||||
F ui/MainWindow.ui 7ede8bbb54513e0771fdf5d5a2566d88c81b73ad
|
F ui/MainWindow.ui 7ede8bbb54513e0771fdf5d5a2566d88c81b73ad
|
||||||
F ui/SettingsDialog.ui 55aefad7145c40d936c43759789d1b50e361b020
|
F ui/SettingsDialog.ui 55aefad7145c40d936c43759789d1b50e361b020
|
||||||
P 9d073dbbd5ca3382a184e8693107a01d1c72a754
|
P 30ee66fdd239b24a6450dbb8b2dee4b904813a55
|
||||||
R 67239183343409750edd50bfaecdfddc
|
R 7a758f7890147cf5446303afc8b7b101
|
||||||
U Kostas
|
U Kostas
|
||||||
Z 00d2fb0baf1c9e413735cf3928ad8ed0
|
Z edd995531a4645688e87cfd0c0dd161e
|
||||||
|
@ -1 +1 @@
|
|||||||
30ee66fdd239b24a6450dbb8b2dee4b904813a55
|
ac8a195f2fcfaa16e849461ae63aa01f88d1794d
|
@ -1,23 +1,24 @@
|
|||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QStandardItem>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QSettings>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QLabel>
|
|
||||||
#include <QTemporaryFile>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QDrag>
|
|
||||||
#include <QMimeData>
|
|
||||||
#include <QFileIconProvider>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QProgressBar>
|
#include <QDesktopServices>
|
||||||
|
#include <QDrag>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFileIconProvider>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QProgressBar>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QShortcut>
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include <QTemporaryFile>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
#include <QUrl>
|
||||||
#include "CommitDialog.h"
|
#include "CommitDialog.h"
|
||||||
#include "FileActionDialog.h"
|
#include "FileActionDialog.h"
|
||||||
#include "CloneDialog.h"
|
#include "CloneDialog.h"
|
||||||
@ -220,21 +221,23 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
|||||||
a->setIconVisibleInMenu(false);
|
a->setIconVisibleInMenu(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
abortShortcut = new QShortcut(QKeySequence("Escape"), this);
|
||||||
|
abortShortcut->setContext(Qt::ApplicationShortcut);
|
||||||
|
abortShortcut->setEnabled(false);
|
||||||
|
connect(abortShortcut, SIGNAL(activated()), this, SLOT(onAbort()));
|
||||||
|
|
||||||
viewMode = VIEWMODE_TREE;
|
viewMode = VIEWMODE_TREE;
|
||||||
|
|
||||||
applySettings();
|
applySettings();
|
||||||
|
refreshOnShow = true;
|
||||||
|
|
||||||
// Apply any explicit workspace path if available
|
// Apply any explicit workspace path if available
|
||||||
if(workspacePath && !workspacePath->isEmpty())
|
if(workspacePath && !workspacePath->isEmpty())
|
||||||
openWorkspace(*workspacePath);
|
openWorkspace(*workspacePath);
|
||||||
|
|
||||||
refresh();
|
abortCurrentAction = false;
|
||||||
rebuildRecent();
|
|
||||||
|
|
||||||
// Select the Root of the tree to update the file view
|
connect(this, SIGNAL(show), SLOT(onShow()), Qt::DirectConnection);
|
||||||
selectRootDir();
|
|
||||||
|
|
||||||
fossilAbort = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -543,7 +546,7 @@ void MainWindow::onOpenRecent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool MainWindow::scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec)
|
bool MainWindow::scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool &abort)
|
||||||
{
|
{
|
||||||
QDir dir(dirPath);
|
QDir dir(dirPath);
|
||||||
|
|
||||||
@ -553,6 +556,9 @@ bool MainWindow::scanDirectory(QFileInfoList &entries, const QString& dirPath, c
|
|||||||
QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
||||||
for (int i=0; i<list.count(); ++i)
|
for (int i=0; i<list.count(); ++i)
|
||||||
{
|
{
|
||||||
|
if(abort)
|
||||||
|
return false;
|
||||||
|
|
||||||
QFileInfo info = list[i];
|
QFileInfo info = list[i];
|
||||||
QString filename = info.fileName();
|
QString filename = info.fileName();
|
||||||
QString filepath = info.filePath();
|
QString filepath = info.filePath();
|
||||||
@ -565,7 +571,7 @@ bool MainWindow::scanDirectory(QFileInfoList &entries, const QString& dirPath, c
|
|||||||
|
|
||||||
if (info.isDir())
|
if (info.isDir())
|
||||||
{
|
{
|
||||||
if(!scanDirectory(entries, filepath, baseDir, ignoreSpec))
|
if(!scanDirectory(entries, filepath, baseDir, ignoreSpec, abort))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -653,7 +659,7 @@ void MainWindow::scanWorkspace()
|
|||||||
bool scan_files = ui->actionViewUnknown->isChecked();
|
bool scan_files = ui->actionViewUnknown->isChecked();
|
||||||
|
|
||||||
setStatus(tr("Scanning Workspace..."));
|
setStatus(tr("Scanning Workspace..."));
|
||||||
setEnabled(false);
|
setBusy(true);
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
|
|
||||||
// Dispose RepoFiles
|
// Dispose RepoFiles
|
||||||
@ -663,6 +669,8 @@ void MainWindow::scanWorkspace()
|
|||||||
workspaceFiles.clear();
|
workspaceFiles.clear();
|
||||||
pathSet.clear();
|
pathSet.clear();
|
||||||
|
|
||||||
|
abortCurrentAction = false;
|
||||||
|
|
||||||
if(scan_files)
|
if(scan_files)
|
||||||
{
|
{
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@ -675,7 +683,13 @@ void MainWindow::scanWorkspace()
|
|||||||
ignore = settings.GetFossilValue(FOSSIL_SETTING_IGNORE_GLOB).toString().replace(',',';');
|
ignore = settings.GetFossilValue(FOSSIL_SETTING_IGNORE_GLOB).toString().replace(',',';');
|
||||||
}
|
}
|
||||||
|
|
||||||
scanDirectory(all_files, wkdir, wkdir, ignore);
|
if(!scanDirectory(all_files, wkdir, wkdir, ignore, abortCurrentAction))
|
||||||
|
{
|
||||||
|
setBusy(false);
|
||||||
|
setStatus("");
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(QFileInfoList::iterator it=all_files.begin(); it!=all_files.end(); ++it)
|
for(QFileInfoList::iterator it=all_files.begin(); it!=all_files.end(); ++it)
|
||||||
{
|
{
|
||||||
@ -769,7 +783,12 @@ void MainWindow::scanWorkspace()
|
|||||||
stashMap.clear();
|
stashMap.clear();
|
||||||
res.clear();
|
res.clear();
|
||||||
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
|
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
|
||||||
|
{
|
||||||
|
setBusy(false);
|
||||||
|
setStatus("");
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15
|
||||||
QRegExp stash_rx("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
QRegExp stash_rx("\\s*(\\d+):\\s+\\[(.*)\\] on (\\d+)-(\\d+)-(\\d+) (\\d+):(\\d+):(\\d+)", Qt::CaseInsensitive);
|
||||||
@ -806,7 +825,7 @@ void MainWindow::scanWorkspace()
|
|||||||
updateFileView();
|
updateFileView();
|
||||||
updateStashView();
|
updateStashView();
|
||||||
|
|
||||||
setEnabled(true);
|
setBusy(false);
|
||||||
setStatus("");
|
setStatus("");
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
@ -1110,7 +1129,7 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
|||||||
QString ans_always = 'a' + EOL_MARK;
|
QString ans_always = 'a' + EOL_MARK;
|
||||||
QString ans_convert = 'c' + EOL_MARK;
|
QString ans_convert = 'c' + EOL_MARK;
|
||||||
|
|
||||||
fossilAbort = false;
|
abortCurrentAction = false;
|
||||||
QString buffer;
|
QString buffer;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -1131,9 +1150,8 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
|||||||
if(state!=QProcess::Running && bytes_avail<1)
|
if(state!=QProcess::Running && bytes_avail<1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(fossilAbort)
|
if(abortCurrentAction)
|
||||||
{
|
{
|
||||||
log("\n* "+tr("Terminated")+" *\n");
|
|
||||||
#ifdef Q_OS_WIN // Verify this is still true on Qt5
|
#ifdef Q_OS_WIN // Verify this is still true on Qt5
|
||||||
process.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
process.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
||||||
#else
|
#else
|
||||||
@ -1229,7 +1247,7 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
|||||||
// Map the Convert option to the Apply button
|
// Map the Convert option to the Apply button
|
||||||
if(have_acyn_query)
|
if(have_acyn_query)
|
||||||
{
|
{
|
||||||
query = before_last_line + query;
|
query = before_last_line + "\n" + query;
|
||||||
buttons |= QMessageBox::Apply;
|
buttons |= QMessageBox::Apply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2635,3 +2653,32 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::setBusy(bool busy)
|
||||||
|
{
|
||||||
|
abortShortcut->setEnabled(busy);
|
||||||
|
bool enabled = !busy;
|
||||||
|
ui->menuBar->setEnabled(enabled);
|
||||||
|
ui->mainToolBar->setEnabled(enabled);
|
||||||
|
ui->centralWidget->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::onAbort()
|
||||||
|
{
|
||||||
|
abortCurrentAction = true;
|
||||||
|
log("\n* "+tr("Terminated")+" *\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::onShow()
|
||||||
|
{
|
||||||
|
if(refreshOnShow)
|
||||||
|
{
|
||||||
|
refresh();
|
||||||
|
rebuildRecent();
|
||||||
|
// Select the Root of the tree to update the file view
|
||||||
|
selectRootDir();
|
||||||
|
refreshOnShow = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -159,7 +159,7 @@ private:
|
|||||||
void loadFossilSettings();
|
void loadFossilSettings();
|
||||||
QString getFossilPath();
|
QString getFossilPath();
|
||||||
QString getFossilHttpAddress();
|
QString getFossilHttpAddress();
|
||||||
bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec);
|
bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool& abort);
|
||||||
void updateDirView();
|
void updateDirView();
|
||||||
void updateFileView();
|
void updateFileView();
|
||||||
void updateStashView();
|
void updateStashView();
|
||||||
@ -167,8 +167,7 @@ private:
|
|||||||
void fossilBrowse(const QString &fossilUrl);
|
void fossilBrowse(const QString &fossilUrl);
|
||||||
void dragEnterEvent(class QDragEnterEvent *event);
|
void dragEnterEvent(class QDragEnterEvent *event);
|
||||||
void dropEvent(class QDropEvent *event);
|
void dropEvent(class QDropEvent *event);
|
||||||
|
void setBusy(bool busy);
|
||||||
|
|
||||||
virtual QMenu *createPopupMenu();
|
virtual QMenu *createPopupMenu();
|
||||||
|
|
||||||
enum RepoStatus
|
enum RepoStatus
|
||||||
@ -192,6 +191,8 @@ private slots:
|
|||||||
void onOpenRecent();
|
void onOpenRecent();
|
||||||
void onTreeViewSelectionChanged(const class QItemSelection &selected, const class QItemSelection &deselected);
|
void onTreeViewSelectionChanged(const class QItemSelection &selected, const class QItemSelection &deselected);
|
||||||
void onFileViewDragOut();
|
void onFileViewDragOut();
|
||||||
|
void onAbort();
|
||||||
|
void onShow();
|
||||||
|
|
||||||
// Designer slots
|
// Designer slots
|
||||||
void on_actionRefresh_triggered();
|
void on_actionRefresh_triggered();
|
||||||
@ -249,7 +250,9 @@ private:
|
|||||||
QProcess fossilUI;
|
QProcess fossilUI;
|
||||||
class QAction *recentWorkspaceActs[MAX_RECENT];
|
class QAction *recentWorkspaceActs[MAX_RECENT];
|
||||||
class QProgressBar *progressBar;
|
class QProgressBar *progressBar;
|
||||||
bool fossilAbort; // FIXME: No GUI for it yet
|
class QShortcut *abortShortcut;
|
||||||
|
bool abortCurrentAction;
|
||||||
|
bool refreshOnShow;
|
||||||
|
|
||||||
Settings &settings;
|
Settings &settings;
|
||||||
QString projectName;
|
QString projectName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user