Dialog refactoring
Extended the settings dialog Reorganized the workspace management code Fixed issue where the previous current directory was in effect even in new workspaces Improved the log responsiveness on long fossil operations FossilOrigin-Name: 945c841fba73be1355611554499e68a878b95359
This commit is contained in:
@ -2,48 +2,78 @@
|
||||
#include "ui_SettingsDialog.h"
|
||||
#include <QFileDialog>
|
||||
|
||||
static QString SelectExe(QWidget *parent, const QString &description)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QString filter("Applications (*.exe)");
|
||||
#else
|
||||
QString filter("Applications (*)");
|
||||
#endif
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
parent,
|
||||
"Select "+description,
|
||||
QString(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(!QFile::exists(path))
|
||||
return QString();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) :
|
||||
QDialog(parent, Qt::Sheet),
|
||||
ui(new Ui::SettingsDialog),
|
||||
settings(&_settings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->lineEdit->setText(settings->fossilPath);
|
||||
ui->lineFossilPath->setText(settings->fossilPath);
|
||||
ui->lineGDiffCommand->setText(settings->gDiffCommand);
|
||||
ui->lineGMergeCommand->setText(settings->gMergeCommand);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_btnSelectFossil_clicked()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QString filter(tr("Fossil Executables (*.exe)"));
|
||||
#else
|
||||
QString filter(tr("Fossil Executables (*)"));
|
||||
#endif
|
||||
QString path = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Select Fossil Executable"),
|
||||
QString(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(QFile::exists(path))
|
||||
{
|
||||
ui->lineEdit->setText(path) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SettingsDialog::run(QWidget *parent, Settings &settings)
|
||||
{
|
||||
SettingsDialog dlg(parent, settings);
|
||||
return dlg.exec() == QDialog::Accepted;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SettingsDialog::on_buttonBox_accepted()
|
||||
{
|
||||
settings->fossilPath = ui->lineEdit->text();
|
||||
settings->fossilPath = ui->lineFossilPath->text();
|
||||
settings->gDiffCommand = ui->lineGDiffCommand->text();
|
||||
settings->gMergeCommand = ui->lineGMergeCommand->text();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void SettingsDialog::on_btnSelectFossil_clicked()
|
||||
{
|
||||
QString path = SelectExe(this, tr("Fossil executable"));
|
||||
if(!path.isEmpty())
|
||||
ui->lineFossilPath->setText(path);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SettingsDialog::on_btnSelectFossilGDiff_clicked()
|
||||
{
|
||||
QString path = SelectExe(this, tr("Graphical Diff application"));
|
||||
if(!path.isEmpty())
|
||||
ui->lineGDiffCommand->setText(path);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SettingsDialog::on_btnSelectGMerge_clicked()
|
||||
{
|
||||
QString path = SelectExe(this, tr("Graphical Merge application"));
|
||||
if(!path.isEmpty())
|
||||
ui->lineGMergeCommand->setText(path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user