Initial QT5 Support

Minor fixes


FossilOrigin-Name: 15630ec9d832cd6c843ca0896677120d34879100
This commit is contained in:
kostas 2013-05-14 15:25:12 +00:00
parent e3d38006ea
commit 5f68886c0a
6 changed files with 57 additions and 44 deletions

View File

@ -4,12 +4,16 @@
QT += core gui webkit QT += core gui webkit
contains(QT_VERSION, ^5\\..*) {
QT += widgets webkitwidgets
}
TARGET = Fuel TARGET = Fuel
TEMPLATE = app TEMPLATE = app
win32 { win32 {
RC_FILE = rsrc/fuel.rc RC_FILE = rsrc/fuel.rc
LIBS += -luser32 -lshell32 -luuid LIBS += -luser32 -lshell32 -luuid
} }
macx { macx {
@ -38,7 +42,7 @@ unix:!macx {
INCLUDEPATH += src INCLUDEPATH += src
SOURCES += src/main.cpp\ SOURCES += src/main.cpp\
src/MainWindow.cpp \ src/MainWindow.cpp \
src/CommitDialog.cpp \ src/CommitDialog.cpp \
src/FileActionDialog.cpp \ src/FileActionDialog.cpp \
src/SettingsDialog.cpp \ src/SettingsDialog.cpp \
@ -46,8 +50,8 @@ SOURCES += src/main.cpp\
src/FileTableView.cpp \ src/FileTableView.cpp \
src/CloneDialog.cpp \ src/CloneDialog.cpp \
src/LoggedProcess.cpp \ src/LoggedProcess.cpp \
src/BrowserWidget.cpp \ src/BrowserWidget.cpp \
src/CustomWebView.cpp src/CustomWebView.cpp
HEADERS += src/MainWindow.h \ HEADERS += src/MainWindow.h \
src/CommitDialog.h \ src/CommitDialog.h \
@ -57,15 +61,15 @@ HEADERS += src/MainWindow.h \
src/FileTableView.h \ src/FileTableView.h \
src/CloneDialog.h \ src/CloneDialog.h \
src/LoggedProcess.h \ src/LoggedProcess.h \
src/BrowserWidget.h \ src/BrowserWidget.h \
src/CustomWebView.h src/CustomWebView.h
FORMS += ui/MainWindow.ui \ FORMS += ui/MainWindow.ui \
ui/CommitDialog.ui \ ui/CommitDialog.ui \
ui/FileActionDialog.ui \ ui/FileActionDialog.ui \
ui/SettingsDialog.ui \ ui/SettingsDialog.ui \
ui/CloneDialog.ui \ ui/CloneDialog.ui \
ui/BrowserWidget.ui ui/BrowserWidget.ui
RESOURCES += \ RESOURCES += \
rsrc/resources.qrc rsrc/resources.qrc

View File

@ -1,11 +1,11 @@
C Fixed\slink\serror\son\swindows\sin\snewer\sversions\sof\smingw\n\n C Initial\sQT5\sSupport\nMinor\sfixes\n
D 2013-04-04T14:13:21.839 D 2013-05-14T15:25:12.667
F dist/arch/PKGBUILD e6e0ada3856c94748557c3f18827b83f1ae06b17 F dist/arch/PKGBUILD e6e0ada3856c94748557c3f18827b83f1ae06b17
F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e
F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381 F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381
F doc/Changes.txt a190c5c88663a52f3206f1970700fce0906c8ed9 F doc/Changes.txt a190c5c88663a52f3206f1970700fce0906c8ed9
F doc/License.txt 4cc77b90af91e615a64ae04893fdffa7939db84c F doc/License.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
F fuel.pro 1d6f6e3a4f11d6b620ede9e689339b5a557b31f6 F fuel.pro 3b4380436f341611245c1fa8e3cf4737db5eaf5e
F intl/convert.bat 7e878e302a8be2324fd51b9eed1aab272dbd8bbd x F intl/convert.bat 7e878e302a8be2324fd51b9eed1aab272dbd8bbd x
F intl/convert.sh 5694496585ff5f4363c90ff8b6f48e19e0b6b4aa x F intl/convert.sh 5694496585ff5f4363c90ff8b6f48e19e0b6b4aa x
F intl/de_DE.ts ca35d7eb8b7dea47d5c8e33f4605798664cd88c3 F intl/de_DE.ts ca35d7eb8b7dea47d5c8e33f4605798664cd88c3
@ -186,9 +186,9 @@ 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 59456ae5b02871e78c1d38fefed9165d6e94c64c F src/MainWindow.cpp b7c0659d51861c45700ce19b7dcde10f5b370404
F src/MainWindow.h 9c70fd9db3bbd5f96132563819b50d21517aa740 F src/MainWindow.h 3e0ed4d5f6a531401e0aed92d1cd0eb29543d62b
F src/SettingsDialog.cpp f0b834ff886b705d2823f052dba2a14c6421f1ef F src/SettingsDialog.cpp 5c515baf88f43bb56a150a75dab7fbf753512aeb
F src/SettingsDialog.h 01c1f876c64f750ba8820a0d745e377acabe4921 F src/SettingsDialog.h 01c1f876c64f750ba8820a0d745e377acabe4921
F src/Utils.cpp caca5268e3194abe77211040bf9511a82909d2e6 F src/Utils.cpp caca5268e3194abe77211040bf9511a82909d2e6
F src/Utils.h 5af911147390879176e587fc60fb662490bb9e97 F src/Utils.h 5af911147390879176e587fc60fb662490bb9e97
@ -200,7 +200,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 3074d4c5f5701d9edcbea76ffafc4ae4ff3c7c60 P 560caeb5557f39c27f4632181f9f5f3731fdb0b3
R f4de5dbe7f27ddfe61dd6e91046519c2 R d3856874ca7fe2f9ecd22c3947e35801
U kostas U kostas
Z 05fe6f909a125405fc204ff403fd3ebb Z 768dc6286211ec6161b7878570b55ea1

View File

@ -1 +1 @@
560caeb5557f39c27f4632181f9f5f3731fdb0b3 15630ec9d832cd6c843ca0896677120d34879100

View File

@ -146,7 +146,11 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
// Needed on OSX as the preset value from the GUI editor is not always reflected // Needed on OSX as the preset value from the GUI editor is not always reflected
ui->tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); ui->tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
ui->tableView->horizontalHeader()->setMovable(true); ui->tableView->horizontalHeader()->setMovable(true);
#else
ui->tableView->horizontalHeader()->setSectionsMovable(true);
#endif
ui->tableView->horizontalHeader()->setStretchLastSection(true); ui->tableView->horizontalHeader()->setStretchLastSection(true);
// TreeView // TreeView
@ -496,7 +500,7 @@ void MainWindow::on_actionCloneRepository_triggered()
log("<b>&gt;"+logcmd.join(" ")+"</b><br>", true); log("<b>&gt;"+logcmd.join(" ")+"</b><br>", true);
// Clone Repo // Clone Repo
if(!runFossil(cmd, 0, RUNGLAGS_SILENT_INPUT)) if(!runFossil(cmd, 0, RUNFLAGS_SILENT_INPUT))
{ {
QMessageBox::critical(this, tr("Error"), tr("Could not clone the repository"), QMessageBox::Ok); QMessageBox::critical(this, tr("Error"), tr("Could not clone the repository"), QMessageBox::Ok);
return; return;
@ -642,7 +646,7 @@ void MainWindow::scanWorkspace()
// Retrieve the status of files tracked by fossil // Retrieve the status of files tracked by fossil
QStringList res; QStringList res;
if(!runFossil(QStringList() << "ls" << "-l", &res, RUNGLAGS_SILENT_ALL)) if(!runFossil(QStringList() << "ls" << "-l", &res, RUNFLAGS_SILENT_ALL))
return; return;
bool scan_files = ui->actionViewUnknown->isChecked(); bool scan_files = ui->actionViewUnknown->isChecked();
@ -761,7 +765,7 @@ void MainWindow::scanWorkspace()
// Load the stash // Load the stash
stashMap.clear(); stashMap.clear();
res.clear(); res.clear();
if(!runFossil(QStringList() << "stash" << "ls", &res, RUNGLAGS_SILENT_ALL)) if(!runFossil(QStringList() << "stash" << "ls", &res, RUNFLAGS_SILENT_ALL))
return; return;
// 19: [5c46757d4b9765] on 2012-04-22 04:41:15 // 19: [5c46757d4b9765] on 2012-04-22 04:41:15
@ -949,7 +953,7 @@ MainWindow::RepoStatus MainWindow::getRepoStatus()
// We need to determine the reason why fossil has failed // We need to determine the reason why fossil has failed
// so we delay processing of the exit_code // so we delay processing of the exit_code
if(!runFossilRaw(QStringList() << "info", &res, &exit_code, RUNGLAGS_SILENT_ALL)) if(!runFossilRaw(QStringList() << "info", &res, &exit_code, RUNFLAGS_SILENT_ALL))
return REPO_NOT_FOUND; return REPO_NOT_FOUND;
bool run_ok = exit_code == EXIT_SUCCESS; bool run_ok = exit_code == EXIT_SUCCESS;
@ -1056,9 +1060,9 @@ static QString ParseFossilQuery(QString line)
// issued an error // issued an error
bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags) bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags)
{ {
bool silent_input = (runFlags & RUNGLAGS_SILENT_INPUT) != 0; bool silent_input = (runFlags & RUNFLAGS_SILENT_INPUT) != 0;
bool silent_output = (runFlags & RUNGLAGS_SILENT_OUTPUT) != 0; bool silent_output = (runFlags & RUNFLAGS_SILENT_OUTPUT) != 0;
bool detached = (runFlags & RUNGLAGS_DETACHED) != 0; bool detached = (runFlags & RUNFLAGS_DETACHED) != 0;
if(!silent_input) if(!silent_input)
{ {
@ -1202,17 +1206,17 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
QMessageBox::StandardButton res = DialogQuery(this, "Fossil", query, QMessageBox::YesToAll|QMessageBox::Yes|QMessageBox::No); QMessageBox::StandardButton res = DialogQuery(this, "Fossil", query, QMessageBox::YesToAll|QMessageBox::Yes|QMessageBox::No);
if(res==QMessageBox::Yes) if(res==QMessageBox::Yes)
{ {
process.write(ans_yes.toAscii()); process.write(ans_yes.toLatin1());
log("Y\n"); log("Y\n");
} }
else if(res==QMessageBox::YesAll) else if(res==QMessageBox::YesAll)
{ {
process.write(ans_always.toAscii()); process.write(ans_always.toLatin1());
log("A\n"); log("A\n");
} }
else else
{ {
process.write(ans_no.toAscii()); process.write(ans_no.toLatin1());
log("N\n"); log("N\n");
} }
buffer.clear(); buffer.clear();
@ -1225,12 +1229,12 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
if(res==QMessageBox::Yes) if(res==QMessageBox::Yes)
{ {
process.write(ans_yes.toAscii()); process.write(ans_yes.toLatin1());
log("Y\n"); log("Y\n");
} }
else else
{ {
process.write(ans_no.toAscii()); process.write(ans_no.toLatin1());
log("N\n"); log("N\n");
} }
@ -1243,12 +1247,12 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
QMessageBox::StandardButton res = DialogQuery(this, "Fossil", query, QMessageBox::YesToAll|QMessageBox::No); QMessageBox::StandardButton res = DialogQuery(this, "Fossil", query, QMessageBox::YesToAll|QMessageBox::No);
if(res==QMessageBox::YesAll) if(res==QMessageBox::YesAll)
{ {
process.write(ans_always.toAscii()); process.write(ans_always.toLatin1());
log("A\n"); log("A\n");
} }
else else
{ {
process.write(ans_no.toAscii()); process.write(ans_no.toLatin1());
log("N\n"); log("N\n");
} }
buffer.clear(); buffer.clear();
@ -1582,7 +1586,7 @@ void MainWindow::getStashViewSelection(QStringList &stashNames, bool allIfEmpty)
bool MainWindow::diffFile(QString repoFile) bool MainWindow::diffFile(QString repoFile)
{ {
// Run the diff detached // Run the diff detached
return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNGLAGS_DETACHED); return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNFLAGS_DETACHED);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1959,19 +1963,22 @@ void MainWindow::on_actionAbout_triggered()
QString fossil_ver; QString fossil_ver;
QStringList res; QStringList res;
if(runFossil(QStringList() << "version", &res, RUNGLAGS_SILENT_ALL) && res.length()==1) if(runFossil(QStringList() << "version", &res, RUNFLAGS_SILENT_ALL) && res.length()==1)
{ {
int off = res[0].indexOf("version "); int off = res[0].indexOf("version ");
if(off!=-1) if(off!=-1)
fossil_ver = tr("Fossil version %0").arg(res[0].mid(off)) + "\n\n"; fossil_ver = tr("Fossil version %0").arg(res[0].mid(off+8)) + "\n";
} }
QString qt_ver = tr("QT version %0").arg(QT_VERSION_STR) + "\n\n";
QMessageBox::about(this, tr("About Fuel..."), QMessageBox::about(this, tr("About Fuel..."),
QCoreApplication::applicationName() + " "+ QCoreApplication::applicationVersion() + " " + QCoreApplication::applicationName() + " "+ QCoreApplication::applicationVersion() + " " +
tr("a GUI frontend to the Fossil SCM\n" tr("a GUI frontend to the Fossil SCM\n"
"by Kostas Karanikolas\n" "by Kostas Karanikolas\n"
"Released under the GNU GPL")+"\n\n" "Released under the GNU GPL")+"\n\n" +
+ fossil_ver + fossil_ver +
qt_ver +
tr("Icons by Deleket - Jojo Mendoza\n" tr("Icons by Deleket - Jojo Mendoza\n"
"Available under the CC Attribution Noncommercial No Derivative 3.0 License") + "\n\n" + "Available under the CC Attribution Noncommercial No Derivative 3.0 License") + "\n\n" +
tr("Translations with the help of:") + "\n" tr("Translations with the help of:") + "\n"
@ -1986,7 +1993,7 @@ void MainWindow::on_actionUpdate_triggered()
{ {
QStringList res; QStringList res;
if(!runFossil(QStringList() << "update" << "--nochange", &res, RUNGLAGS_SILENT_ALL)) if(!runFossil(QStringList() << "update" << "--nochange", &res, RUNFLAGS_SILENT_ALL))
return; return;
if(res.length()==0) if(res.length()==0)
@ -2006,7 +2013,7 @@ void MainWindow::loadFossilSettings()
{ {
// Also retrieve the fossil global settings // Also retrieve the fossil global settings
QStringList out; QStringList out;
if(!runFossil(QStringList() << "settings", &out, RUNGLAGS_SILENT_ALL)) if(!runFossil(QStringList() << "settings", &out, RUNFLAGS_SILENT_ALL))
return; return;
QStringMap kv = MakeKeyValues(out); QStringMap kv = MakeKeyValues(out);
@ -2021,7 +2028,7 @@ void MainWindow::loadFossilSettings()
{ {
// Retrieve existing url // Retrieve existing url
QStringList out; QStringList out;
if(runFossil(QStringList() << name, &out, RUNGLAGS_SILENT_ALL) && out.length()==1) if(runFossil(QStringList() << name, &out, RUNFLAGS_SILENT_ALL) && out.length()==1)
it.value().Value = out[0].trimmed(); it.value().Value = out[0].trimmed();
continue; continue;
@ -2066,7 +2073,7 @@ void MainWindow::on_actionSettings_triggered()
if(type == Settings::Setting::TYPE_FOSSIL_COMMAND) if(type == Settings::Setting::TYPE_FOSSIL_COMMAND)
{ {
// Run as silent to avoid displaying credentials in the log // Run as silent to avoid displaying credentials in the log
runFossil(QStringList() << "remote-url" << QuotePath(it.value().Value.toString()), 0, RUNGLAGS_SILENT_INPUT); runFossil(QStringList() << "remote-url" << QuotePath(it.value().Value.toString()), 0, RUNFLAGS_SILENT_INPUT);
continue; continue;
} }

View File

@ -125,10 +125,10 @@ private:
enum RunFlags enum RunFlags
{ {
RUNFLAGS_NONE = 0<<0, RUNFLAGS_NONE = 0<<0,
RUNGLAGS_SILENT_INPUT = 1<<0, RUNFLAGS_SILENT_INPUT = 1<<0,
RUNGLAGS_SILENT_OUTPUT = 1<<1, RUNFLAGS_SILENT_OUTPUT = 1<<1,
RUNGLAGS_SILENT_ALL = RUNGLAGS_SILENT_INPUT | RUNGLAGS_SILENT_OUTPUT, RUNFLAGS_SILENT_ALL = RUNFLAGS_SILENT_INPUT | RUNFLAGS_SILENT_OUTPUT,
RUNGLAGS_DETACHED = 1<<2 RUNFLAGS_DETACHED = 1<<2
}; };
private: private:

View File

@ -223,7 +223,9 @@ Settings::~Settings()
void Settings::ApplyEnvironment() void Settings::ApplyEnvironment()
{ {
QString lang_id = GetValue(FUEL_SETTING_LANGUAGE).toString(); QString lang_id = GetValue(FUEL_SETTING_LANGUAGE).toString();
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
#endif
if(!InstallLang(lang_id)) if(!InstallLang(lang_id))
SetValue(FUEL_SETTING_LANGUAGE, "en_US"); SetValue(FUEL_SETTING_LANGUAGE, "en_US");
} }