Improved OSX GUI
"About" dialog now displays the fossil version FossilOrigin-Name: 81e1f4c7ec00176abd9d467add266f84b0e63059
This commit is contained in:
119
MainWindow.cpp
119
MainWindow.cpp
@ -18,9 +18,9 @@
|
||||
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
#ifdef QT_WS_WIN
|
||||
#define EOL_MARK "\r\n"
|
||||
QString EOL_MARK("\r\n");
|
||||
#else
|
||||
#define EOL_MARK "\n"
|
||||
QString EOL_MARK("\n");
|
||||
#endif
|
||||
|
||||
enum
|
||||
@ -88,6 +88,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
statusLabel->setMinimumSize( statusLabel->sizeHint() );
|
||||
ui->statusBar->addWidget( statusLabel, 1 );
|
||||
|
||||
// Native applications on OSX don't use menu icons
|
||||
#ifdef Q_WS_MACX
|
||||
foreach(QAction *a, ui->menuBar->actions())
|
||||
a->setIconVisibleInMenu(false);
|
||||
foreach(QAction *a, ui->menuFile->actions())
|
||||
a->setIconVisibleInMenu(false);
|
||||
#endif
|
||||
|
||||
loadSettings();
|
||||
refresh();
|
||||
rebuildRecent();
|
||||
@ -486,9 +494,9 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *ans_yes = "y" EOL_MARK;
|
||||
const char *ans_no = "n" EOL_MARK;
|
||||
const char *ans_always = "a" EOL_MARK;
|
||||
QString ans_yes = 'y' + EOL_MARK;
|
||||
QString ans_no = 'n' + EOL_MARK;
|
||||
QString ans_always = 'a' + EOL_MARK;
|
||||
|
||||
fossilAbort = false;
|
||||
QString buffer;
|
||||
@ -513,10 +521,12 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
||||
|
||||
QString last_line;
|
||||
if(last_line_start != -1)
|
||||
last_line = buffer.mid(last_line_start+COUNTOF(EOL_MARK));
|
||||
last_line = buffer.mid(last_line_start+EOL_MARK.length());
|
||||
else
|
||||
last_line = buffer;
|
||||
|
||||
QChar cc = buffer[last_line_start];
|
||||
|
||||
last_line = last_line.trimmed();
|
||||
|
||||
// Check if we have a query
|
||||
@ -544,46 +554,58 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int
|
||||
buffer = buffer.mid(last_line_start);
|
||||
|
||||
// Now process any query
|
||||
if(have_query && have_yn_query)
|
||||
if(have_query && have_yna_query)
|
||||
{
|
||||
QString query = ParseFossilQuery(last_line);
|
||||
|
||||
int res = QMessageBox::question(this, "Fossil", query, QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
|
||||
if(res==QMessageBox::Yes)
|
||||
{
|
||||
process.write(ans_yes, COUNTOF(ans_yes));
|
||||
log("Y\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
process.write(ans_no, COUNTOF(ans_no));
|
||||
log("N\n");
|
||||
}
|
||||
QMessageBox mb(QMessageBox::Question, "Fossil", query, QMessageBox::Yes|QMessageBox::No|QMessageBox::YesToAll, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::Sheet );
|
||||
mb.setDefaultButton(QMessageBox::No);
|
||||
mb.setWindowModality(Qt::WindowModal);
|
||||
mb.setModal(true);
|
||||
mb.exec();
|
||||
int res = mb.standardButton(mb.clickedButton());
|
||||
|
||||
buffer.clear();
|
||||
}
|
||||
else if(have_query && have_yna_query)
|
||||
{
|
||||
QString query = ParseFossilQuery(query);
|
||||
|
||||
int res = QMessageBox::question(this, "Fossil", query, QMessageBox::Yes|QMessageBox::No|QMessageBox::YesToAll, QMessageBox::No);
|
||||
if(res==QDialogButtonBox::Yes)
|
||||
{
|
||||
process.write(ans_yes, COUNTOF(ans_yes));
|
||||
process.write(ans_yes.toAscii());
|
||||
log("Y\n");
|
||||
}
|
||||
else if(res==QDialogButtonBox::YesToAll)
|
||||
{
|
||||
process.write(ans_always, COUNTOF(ans_always));
|
||||
process.write(ans_always.toAscii());
|
||||
log("A\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
process.write(ans_no, COUNTOF(ans_no));
|
||||
process.write(ans_no.toAscii());
|
||||
log("N\n");
|
||||
}
|
||||
buffer.clear();
|
||||
}
|
||||
else if(have_query && have_yn_query)
|
||||
{
|
||||
QString query = ParseFossilQuery(last_line);
|
||||
|
||||
QMessageBox mb(QMessageBox::Question, "Fossil", query, QMessageBox::Yes|QMessageBox::No|QMessageBox::YesToAll, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::Sheet );
|
||||
mb.setDefaultButton(QMessageBox::No);
|
||||
mb.setWindowModality(Qt::WindowModal);
|
||||
mb.setModal(true);
|
||||
mb.exec();
|
||||
int res = mb.standardButton(mb.clickedButton());
|
||||
|
||||
if(res==QMessageBox::Yes)
|
||||
{
|
||||
process.write(ans_yes.toAscii());
|
||||
log("Y\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
process.write(ans_no.toAscii());
|
||||
log("N\n");
|
||||
}
|
||||
|
||||
buffer.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Must be finished by now
|
||||
@ -967,7 +989,7 @@ void MainWindow::on_actionRename_triggered()
|
||||
QFileInfo fi_before(repo_files[0]);
|
||||
|
||||
bool ok = false;
|
||||
QString new_name = QInputDialog::getText(this, tr("Rename"), tr("Enter new name"), QLineEdit::Normal, fi_before.filePath(), &ok );
|
||||
QString new_name = QInputDialog::getText(this, tr("Rename"), tr("Enter new name"), QLineEdit::Normal, fi_before.filePath(), &ok, Qt::Sheet );
|
||||
if(!ok)
|
||||
return;
|
||||
|
||||
@ -1084,13 +1106,24 @@ void MainWindow::on_actionUndo_triggered()
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
{
|
||||
QMessageBox::about(this, "About... Fuel ",
|
||||
QString fossil_ver;
|
||||
QStringList res;
|
||||
|
||||
if(runFossil(QStringList() << "version", &res, true) && res.length()==1)
|
||||
{
|
||||
int off = res[0].indexOf("version ");
|
||||
if(off!=-1)
|
||||
fossil_ver = tr("Fossil version ")+res[0].mid(off) + "\n\n";
|
||||
}
|
||||
|
||||
QMessageBox::about(this, "About Fuel...",
|
||||
QCoreApplication::applicationName() + " "+ QCoreApplication::applicationVersion() + " " +
|
||||
tr("a GUI frontend to Fossil SCM\n"
|
||||
"by Kostas Karanikolas\n"
|
||||
"Released under the GNU GPL\n\n"
|
||||
"Icon-set by Deleket - Jojo Mendoza\n"
|
||||
"Available under the CC Attribution-Noncommercial-No Derivate 3.0 License"));
|
||||
tr("a GUI frontend to the Fossil SCM\n"
|
||||
"by Kostas Karanikolas\n"
|
||||
"Released under the GNU GPL\n\n")
|
||||
+ fossil_ver +
|
||||
tr("Icon-set by Deleket - Jojo Mendoza\n"
|
||||
"Available under the CC Attribution-Noncommercial-No Derivate 3.0 License"));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1128,12 +1161,19 @@ void MainWindow::on_actionSyncSettings_triggered()
|
||||
if(runFossil(QStringList() << "remote-url", &out, true) && out.length()==1)
|
||||
current = out[0].trimmed();
|
||||
|
||||
bool ok = false;
|
||||
current = QInputDialog::getText(this, tr("Remote URL"), tr("Enter new remote url"), QLineEdit::Normal, current, &ok );
|
||||
QInputDialog dlg(this, Qt::Sheet);
|
||||
dlg.setWindowTitle(tr("Remote URL"));
|
||||
dlg.setInputMode(QInputDialog::TextInput);
|
||||
dlg.setWindowModality(Qt::WindowModal);
|
||||
dlg.setModal(true);
|
||||
dlg.setLabelText(tr("Enter new remote URL:"));
|
||||
dlg.setTextValue(current);
|
||||
|
||||
if(!ok)
|
||||
if(dlg.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
current = dlg.textValue();
|
||||
|
||||
QUrl url(current);
|
||||
if(!url.isValid())
|
||||
{
|
||||
@ -1141,5 +1181,6 @@ void MainWindow::on_actionSyncSettings_triggered()
|
||||
return;
|
||||
}
|
||||
|
||||
runFossil(QStringList() << "remote-url" << QuotePath(url.toString()));
|
||||
// Run as silent to avoid displaying credentials in the log
|
||||
runFossil(QStringList() << "remote-url" << QuotePath(url.toString()), 0, true);
|
||||
}
|
||||
|
13
main.cpp
13
main.cpp
@ -8,8 +8,15 @@ int main(int argc, char *argv[])
|
||||
a.setApplicationVersion("0.9.1");
|
||||
a.setOrganizationDomain("karanik.com");
|
||||
a.setOrganizationName("Karanik");
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
// Native applications on OSX don't use menu icons
|
||||
#ifdef Q_WS_MACX
|
||||
a.setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||
#endif
|
||||
|
||||
{
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
}
|
||||
|
14
manifest
14
manifest
@ -1,12 +1,12 @@
|
||||
C Added\sSync\sSettings\saction\n
|
||||
D 2011-08-07T05:46:53.925
|
||||
C Improved\sOSX\sGUI\n"About"\sdialog\snow\sdisplays\sthe\sfossil\sversion
|
||||
D 2011-08-07T08:15:07.685
|
||||
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 c3c91806c454a15888a89b8a137b57e4b02a7de4
|
||||
F MainWindow.cpp 80d52a1f0b9b099dde95a5be7e89f8aff869c190
|
||||
F MainWindow.h f458f469ab1b680268000553ffb917374dd3e67b
|
||||
F MainWindow.ui 67ab0e7b52f0023c02406c851cdf4c267e12cedd
|
||||
F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e
|
||||
@ -171,9 +171,9 @@ F icons/Zoom\sOut-01.png 8eda092100d9e00c9097f43a80d1e26695947448
|
||||
F icons/Zoom-01.png 67ca532922e9166325c5c75fce1ca3fbb0d2b6a6
|
||||
F icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b
|
||||
F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
|
||||
F main.cpp 261837e5ffc52bca29935907e62468018a3b6a38
|
||||
F main.cpp 360c3ec843cd72dcaf735b7fb6f51f5639830959
|
||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||
P d0b361eba56da87b7a0345d3a47e14987fbe287c
|
||||
R 6330d9662105044dfc581509c4825727
|
||||
P dbb036dbd2c7e2a34fae27e2a39bddf2168ab83d
|
||||
R d953e0a12899c0c5f8173cdd242461fe
|
||||
U kostas
|
||||
Z f8e6616d287dfd95305111e8845337a0
|
||||
Z f2b518bc85eac6f6d5652326d3dcd962
|
||||
|
@ -1 +1 @@
|
||||
dbb036dbd2c7e2a34fae27e2a39bddf2168ab83d
|
||||
81e1f4c7ec00176abd9d467add266f84b0e63059
|
Reference in New Issue
Block a user