Fuel
Check-in [3adc2a837c]
Not logged in
Overview
Comment:Moved LoggedProcess to separate files Added message box when attempting to push or pull when no remote url has been set
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3adc2a837ceb5080094dede9f0f3bdeb0e0429f0
User & Date: kostas 2012-05-12 10:43:40.977
Context
2012-05-12
11:20
Updated the installer for windows check-in: 345df342d5 user: kostas tags: trunk, v0.9.6
10:43
Moved LoggedProcess to separate files Added message box when attempting to push or pull when no remote url has been set check-in: 3adc2a837c user: kostas tags: trunk
08:45
Fixed DnD on OSX check-in: 165f5a8e36 user: kostas tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added LoggedProcess.cpp.












































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "LoggedProcess.h"

///////////////////////////////////////////////////////////////////////////////
LoggedProcess::LoggedProcess(QObject *parent) : QProcess(parent)
{
	setProcessChannelMode(QProcess::MergedChannels);
	connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput()));
}

void LoggedProcess::getLogAndClear(QByteArray &buffer)
{
	QMutexLocker lck(&mutex);
	buffer = log;
	log.clear();
}

void LoggedProcess::onReadyReadStandardOutput()
{
	QMutexLocker lck(&mutex);
	log.append(readAllStandardOutput());
}

Added LoggedProcess.h.
















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef LOGGEDPROCESS_H
#define LOGGEDPROCESS_H

#include <QProcess>
#include <QMutex>

class LoggedProcess : public QProcess
{
	Q_OBJECT
public:
	explicit LoggedProcess(QObject *parent = 0);
	void getLogAndClear(QByteArray &buffer);
	bool isLogEmpty() const { return log.isEmpty(); }
	qint64 logBytesAvailable() const { return log.size(); }

private slots:
	void onReadyReadStandardOutput();

private:
	QMutex mutex;
	QByteArray log;
};

#endif // LOGGEDPROCESS_H
Changes to MainWindow.cpp.
16
17
18
19
20
21
22

23
24
25
26
27
28
29
#include <QFileIconProvider>
#include <QDebug>
#include <QProgressBar>
#include "CommitDialog.h"
#include "FileActionDialog.h"
#include "CloneDialog.h"
#include "Utils.h"


#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

#define PATH_SEP			"/"
#define FOSSIL_CHECKOUT1	"_FOSSIL_"
#define FOSSIL_CHECKOUT2	".fslckout"








>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <QFileIconProvider>
#include <QDebug>
#include <QProgressBar>
#include "CommitDialog.h"
#include "FileActionDialog.h"
#include "CloneDialog.h"
#include "Utils.h"
#include "LoggedProcess.h"

#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))

#define PATH_SEP			"/"
#define FOSSIL_CHECKOUT1	"_FOSSIL_"
#define FOSSIL_CHECKOUT2	".fslckout"

1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
	// Make StatusBar message
	QString status_msg = tr("Running Fossil");
	if(args.length() > 0)
		status_msg = QString("Fossil %0").arg(args[0].toCaseFolded());
	ScopedStatus status(status_msg, ui, progressBar);

	// Create fossil process
	QLoggedProcess process(this);
	process.setWorkingDirectory(wkdir);

	process.start(fossil, args);
	if(!process.waitForStarted())
	{
		log(tr("Could not start fossil executable '") + fossil + "''\n");
		return false;







|







1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
	// Make StatusBar message
	QString status_msg = tr("Running Fossil");
	if(args.length() > 0)
		status_msg = QString("Fossil %0").arg(args[0].toCaseFolded());
	ScopedStatus status(status_msg, ui, progressBar);

	// Create fossil process
	LoggedProcess process(this);
	process.setWorkingDirectory(wkdir);

	process.start(fossil, args);
	if(!process.waitForStarted())
	{
		log(tr("Could not start fossil executable '") + fossil + "''\n");
		return false;
1688
1689
1690
1691
1692
1693
1694








1695
1696
1697
1698
1699
1700








1701
1702
1703
1704
1705
1706
1707
		QDesktopServices::openUrl(QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+*it));
	}
}

//------------------------------------------------------------------------------
void MainWindow::on_actionPush_triggered()
{








	runFossil(QStringList() << "push");
}

//------------------------------------------------------------------------------
void MainWindow::on_actionPull_triggered()
{








	runFossil(QStringList() << "pull");
}

//------------------------------------------------------------------------------
void MainWindow::on_actionCommit_triggered()
{
	QStringList commit_files;







>
>
>
>
>
>
>
>






>
>
>
>
>
>
>
>







1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
		QDesktopServices::openUrl(QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+*it));
	}
}

//------------------------------------------------------------------------------
void MainWindow::on_actionPush_triggered()
{
	QString remote_url = settings.Mappings[FUEL_SETTING_REMOTE_URL].Value.toString();

	if(remote_url.isEmpty() || remote_url == "off")
	{
		QMessageBox::critical(this, tr("Error"), tr("A remote repository has not been specified.\nUse the preferences window to set the remote repostory location"), QMessageBox::Ok );
		return;
	}

	runFossil(QStringList() << "push");
}

//------------------------------------------------------------------------------
void MainWindow::on_actionPull_triggered()
{
	QString remote_url = settings.Mappings[FUEL_SETTING_REMOTE_URL].Value.toString();

	if(remote_url.isEmpty() || remote_url == "off")
	{
		QMessageBox::critical(this, tr("Error"), tr("A remote repository has not been specified.\nUse the preferences window to set the remote repostory location"), QMessageBox::Ok );
		return;
	}

	runFossil(QStringList() << "pull");
}

//------------------------------------------------------------------------------
void MainWindow::on_actionCommit_triggered()
{
	QStringList commit_files;
Changes to Utils.cpp.
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
	pMalloc->Release ();

	return bResult;
}

#endif

///////////////////////////////////////////////////////////////////////////////
QLoggedProcess::QLoggedProcess(QObject *parent) : QProcess(parent)
{
	setProcessChannelMode(QProcess::MergedChannels);
	connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput()));
}

void QLoggedProcess::getLogAndClear(QByteArray &buffer)
{
	QMutexLocker lck(&mutex);
	buffer = log;
	log.clear();
}

void QLoggedProcess::onReadyReadStandardOutput()
{
	QMutexLocker lck(&mutex);
	log.append(readAllStandardOutput());
}








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
287
288
289
290
291
292
293




















	pMalloc->Release ();

	return bResult;
}

#endif





















Changes to Utils.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef UTILS_H
#define UTILS_H

#include <QString>
#include <QMessageBox>
#include <QProcess>
#include <QMutex>

QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No);

#ifdef Q_WS_WIN
	bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint);
#endif

class QLoggedProcess : public QProcess
{
	Q_OBJECT
public:
	explicit QLoggedProcess(QObject *parent = 0);
	void getLogAndClear(QByteArray &buffer);
	bool isLogEmpty() const { return log.isEmpty(); }
	qint64 logBytesAvailable() const { return log.size(); }

private slots:
	void onReadyReadStandardOutput();

private:
	QMutex mutex;
	QByteArray log;
};

#endif // UTILS_H





<
<







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


1
2
3
4
5


6
7
8
9
10
11
12
















13
14
#ifndef UTILS_H
#define UTILS_H

#include <QString>
#include <QMessageBox>



QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No);

#ifdef Q_WS_WIN
	bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint);
#endif


















#endif // UTILS_H
Changes to fuel.pro.
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
SOURCES += main.cpp\
		MainWindow.cpp \
	CommitDialog.cpp \
	FileActionDialog.cpp \
	SettingsDialog.cpp \
	Utils.cpp \
	FileTableView.cpp \
	CloneDialog.cpp


HEADERS  += MainWindow.h \
	CommitDialog.h \
	FileActionDialog.h \
	SettingsDialog.h \
	Utils.h \
	FileTableView.h \
	CloneDialog.h


FORMS    += MainWindow.ui \
	CommitDialog.ui \
	FileActionDialog.ui \
	SettingsDialog.ui \
	CloneDialog.ui








|
>







|
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SOURCES += main.cpp\
		MainWindow.cpp \
	CommitDialog.cpp \
	FileActionDialog.cpp \
	SettingsDialog.cpp \
	Utils.cpp \
	FileTableView.cpp \
	CloneDialog.cpp \
    LoggedProcess.cpp

HEADERS  += MainWindow.h \
	CommitDialog.h \
	FileActionDialog.h \
	SettingsDialog.h \
	Utils.h \
	FileTableView.h \
	CloneDialog.h \
    LoggedProcess.h

FORMS    += MainWindow.ui \
	CommitDialog.ui \
	FileActionDialog.ui \
	SettingsDialog.ui \
	CloneDialog.ui