Fixed fossil process termination on Windows
Abstracted fossil ui url Added (disabled) code to detect fossil ui launch port FossilOrigin-Name: e8b33f373c855cce60dd9fc528b7684f85849d5d
This commit is contained in:
parent
ee5f84b75d
commit
ea8419286c
@ -639,7 +639,11 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
||||
if(fossilAbort)
|
||||
{
|
||||
log("\n* Terminated *\n");
|
||||
process.terminate();
|
||||
#ifdef Q_WS_WIN
|
||||
fossilUI.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
||||
#else
|
||||
process.terminate();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -748,20 +752,20 @@ QString MainWindow::getFossilPath()
|
||||
{
|
||||
// Use the user-specified fossil if available
|
||||
if(!settings.fossilPath.isEmpty())
|
||||
return QDir::toNativeSeparators(settings.fossilPath);
|
||||
return QDir::toNativeSeparators(settings.fossilPath);
|
||||
|
||||
QString fossil_exe = "fossil";
|
||||
QString fossil_exe = "fossil";
|
||||
#ifdef Q_WS_WIN32
|
||||
fossil_exe += ".exe";
|
||||
fossil_exe += ".exe";
|
||||
#endif
|
||||
// Use our fossil if available
|
||||
QString fuel_fossil = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + QDir::separator() + fossil_exe);
|
||||
// Use our fossil if available
|
||||
QString fuel_fossil = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + QDir::separator() + fossil_exe);
|
||||
|
||||
if(QFile::exists(fuel_fossil))
|
||||
return fuel_fossil;
|
||||
|
||||
// Otherwise assume there is a "fossil" executable in the path
|
||||
return fossil_exe;
|
||||
return fossil_exe;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::loadSettings()
|
||||
@ -903,6 +907,7 @@ bool MainWindow::startUI()
|
||||
if(uiRunning())
|
||||
return true;
|
||||
|
||||
fossilUI.setParent(this);
|
||||
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
|
||||
fossilUI.setWorkingDirectory(getCurrentWorkspace());
|
||||
|
||||
@ -910,12 +915,38 @@ bool MainWindow::startUI()
|
||||
QString fossil = getFossilPath();
|
||||
|
||||
fossilUI.start(fossil, QStringList() << "ui");
|
||||
if(!fossilUI.waitForStarted())
|
||||
if(!fossilUI.waitForStarted() || fossilUI.state()!=QProcess::Running)
|
||||
{
|
||||
log(fossil+ tr(" does not exist") +"\n");
|
||||
ui->actionFossilUI->setChecked(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
QString buffer;
|
||||
while(buffer.indexOf(EOL_MARK)==-1)
|
||||
{
|
||||
fossilUI.waitForReadyRead(500);
|
||||
buffer += fossilUI.readAll();
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
fossilUIPort.clear();
|
||||
|
||||
// Parse output to determine the running port
|
||||
// "Listening for HTTP requests on TCP port 8080"
|
||||
int idx = buffer.indexOf("TCP Port ");
|
||||
if(idx!=-1)
|
||||
fossilUIPort = buffer.mid(idx, 4);
|
||||
else
|
||||
fossilUIPort = "8080"; // Have a sensible default if we failed to parse the message
|
||||
#else
|
||||
fossilUIPort = "8080";
|
||||
#endif
|
||||
|
||||
|
||||
ui->actionFossilUI->setChecked(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -923,14 +954,20 @@ bool MainWindow::startUI()
|
||||
void MainWindow::stopUI()
|
||||
{
|
||||
if(uiRunning())
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
fossilUI.kill(); // QT on windows cannot terminate console processes with QProcess::terminate
|
||||
#else
|
||||
fossilUI.terminate();
|
||||
#endif
|
||||
}
|
||||
ui->actionFossilUI->setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionFossilUI_toggled(bool arg1)
|
||||
void MainWindow::on_actionFossilUI_triggered()
|
||||
{
|
||||
if(arg1)
|
||||
if(!uiRunning())
|
||||
startUI();
|
||||
else
|
||||
stopUI();
|
||||
@ -950,7 +987,7 @@ void MainWindow::on_actionTimeline_triggered()
|
||||
|
||||
Q_ASSERT(uiRunning());
|
||||
|
||||
QDesktopServices::openUrl(QUrl("http://127.0.0.1:8080/timeline"));
|
||||
QDesktopServices::openUrl(QUrl(getFossilHttpAddress()+"/timeline"));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -966,14 +1003,14 @@ void MainWindow::on_actionHistory_triggered()
|
||||
|
||||
for(QStringList::iterator it = selection.begin(); it!=selection.end(); ++it)
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("http://127.0.0.1:8080/finfo?name="+*it));
|
||||
QDesktopServices::openUrl(QUrl(getFossilHttpAddress()+"/finfo?name="+*it));
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_tableView_doubleClicked(const QModelIndex &/*index*/)
|
||||
{
|
||||
on_actionOpenFile_triggered();
|
||||
on_actionDiff_triggered();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1336,7 +1373,7 @@ void MainWindow::on_actionSettings_triggered()
|
||||
if(maps[m].value->isEmpty())
|
||||
runFossil(QStringList() << "unset" << maps[m].command << "-global");
|
||||
else
|
||||
runFossil(QStringList() << "settings" << maps[m].command << *maps[m].value << "-global");
|
||||
runFossil(QStringList() << "settings" << maps[m].command << *maps[m].value << "-global");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1383,3 +1420,10 @@ void MainWindow::on_actionViewUnknown_triggered()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
QString MainWindow::getFossilHttpAddress()
|
||||
{
|
||||
return "http://127.0.0.1:"+fossilUIPort;
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,7 @@ private:
|
||||
void rebuildRecent();
|
||||
bool openWorkspace(const QString &dir);
|
||||
QString getFossilPath();
|
||||
QString getFossilHttpAddress();
|
||||
|
||||
enum RepoStatus
|
||||
{
|
||||
@ -136,7 +137,7 @@ private slots:
|
||||
void on_actionRefresh_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
void on_actionDiff_triggered();
|
||||
void on_actionFossilUI_toggled(bool arg1);
|
||||
void on_actionFossilUI_triggered();
|
||||
void on_actionQuit_triggered();
|
||||
void on_actionTimeline_triggered();
|
||||
void on_actionHistory_triggered();
|
||||
@ -171,6 +172,7 @@ private:
|
||||
Ui::MainWindow *ui;
|
||||
QStandardItemModel itemModel;
|
||||
QProcess fossilUI;
|
||||
QString fossilUIPort;
|
||||
class QAction *recentWorkspaceActs[MAX_RECENT];
|
||||
class QLabel *statusLabel;
|
||||
bool fossilAbort; // FIXME: No GUI for it yet
|
||||
|
1046
MainWindow.ui
1046
MainWindow.ui
File diff suppressed because it is too large
Load Diff
16
manifest
16
manifest
@ -1,14 +1,14 @@
|
||||
C Fixed\sfossil\spath\sdetection\son\swindows\nThe\ssettings\sdialog\snow\squotes\spaths\sto\sexternal\stools\sif\sthey\scontain\sspaces\n
|
||||
D 2011-09-03T12:33:47.295
|
||||
C Fixed\sfossil\sprocess\stermination\son\sWindows\nAbstracted\sfossil\sui\surl\nAdded\s(disabled)\scode\sto\sdetect\sfossil\sui\slaunch\sport\n
|
||||
D 2011-09-03T15:03:01.556
|
||||
F CommitDialog.cpp a1fcdc94933f4e1a144224c7c70f1e067d3ee31e
|
||||
F CommitDialog.h 0550b1b652924ae54b6f6c9274cad2d4c491808a
|
||||
F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154
|
||||
F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7
|
||||
F MainWindow.cpp 7d7371085c08bbacc347a1b656d0a352a234c3f9
|
||||
F MainWindow.h 21fbbabd8b827d0b49fe3d40763b71042205fc3d
|
||||
F MainWindow.ui 5d10c04ab0f19f9b38a4da0abb0b36a00ff12efc
|
||||
F MainWindow.cpp 741cb2db89baf6330d3bfe87c99fb5918b5b2516
|
||||
F MainWindow.h cb4d2ab3c3fb3ecc26c5d162358316516090a89e
|
||||
F MainWindow.ui fcce2709fd2dc332061ee72cbc5a5a17adfd0779
|
||||
F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e
|
||||
F RepoDialog.h a958c5f98f1e6882bf41dbdd2e4df3cb89700802
|
||||
F RepoDialog.ui be7b18199c04a3003f3c7534a616cd7441b7bb0c
|
||||
@ -173,7 +173,7 @@ F icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b
|
||||
F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
|
||||
F main.cpp 083845039c167badd57a4abf482dd3d5e77aab35
|
||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||
P ee85c090a173816f1d8053a7c982ab7facfe5c8b
|
||||
R 3f3a7738535c921e5dd68fe8b5c4cc7b
|
||||
P 208e56425e61f15f00ee2bbe200de18fda7fbc07
|
||||
R b8326070b54d51ef8c16887c4286d870
|
||||
U kostas
|
||||
Z dad7dd77b03e67f817ef15852b8851a5
|
||||
Z ba35c3d1bb569a4e3dbcd9d6ff41a92f
|
||||
|
@ -1 +1 @@
|
||||
208e56425e61f15f00ee2bbe200de18fda7fbc07
|
||||
e8b33f373c855cce60dd9fc528b7684f85849d5d
|
Loading…
x
Reference in New Issue
Block a user