summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/QCMakeWidgets.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/QtDialog/QCMakeWidgets.cxx')
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx58
1 files changed, 25 insertions, 33 deletions
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index 7803ef3..4b3eb34 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -19,23 +19,24 @@
#include <QToolButton>
QCMakeFileEditor::QCMakeFileEditor(QWidget* p, const QString& var)
- : QLineEdit(p), Variable(var)
+ : QLineEdit(p)
+ , Variable(var)
{
this->ToolButton = new QToolButton(this);
this->ToolButton->setText("...");
this->ToolButton->setCursor(QCursor(Qt::ArrowCursor));
- QObject::connect(this->ToolButton, SIGNAL(clicked(bool)),
- this, SLOT(chooseFile()));
+ QObject::connect(this->ToolButton, SIGNAL(clicked(bool)), this,
+ SLOT(chooseFile()));
}
QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, const QString& var)
- : QCMakeFileEditor(p, var)
+ : QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, false));
}
QCMakePathEditor::QCMakePathEditor(QWidget* p, const QString& var)
- : QCMakeFileEditor(p, var)
+ : QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, true));
}
@@ -57,24 +58,21 @@ void QCMakeFilePathEditor::chooseFile()
QString path;
QFileInfo info(this->text());
QString title;
- if(this->Variable.isEmpty())
- {
+ if (this->Variable.isEmpty()) {
title = tr("Select File");
- }
- else
- {
+ } else {
title = tr("Select File for %1");
title = title.arg(this->Variable);
- }
+ }
this->fileDialogExists(true);
- path = QFileDialog::getOpenFileName(this, title, info.absolutePath(),
- QString(), NULL, QFileDialog::DontResolveSymlinks);
+ path =
+ QFileDialog::getOpenFileName(this, title, info.absolutePath(), QString(),
+ NULL, QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
- if(!path.isEmpty())
- {
+ if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
- }
+ }
}
void QCMakePathEditor::chooseFile()
@@ -82,43 +80,38 @@ void QCMakePathEditor::chooseFile()
// choose a file and set it
QString path;
QString title;
- if(this->Variable.isEmpty())
- {
+ if (this->Variable.isEmpty()) {
title = tr("Select Path");
- }
- else
- {
+ } else {
title = tr("Select Path for %1");
title = title.arg(this->Variable);
- }
+ }
this->fileDialogExists(true);
path = QFileDialog::getExistingDirectory(this, title, this->text(),
- QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ QFileDialog::ShowDirsOnly |
+ QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
- if(!path.isEmpty())
- {
+ if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
- }
+ }
}
// use same QDirModel for all completers
static QDirModel* fileDirModel()
{
static QDirModel* m = NULL;
- if(!m)
- {
+ if (!m) {
m = new QDirModel();
- }
+ }
return m;
}
static QDirModel* pathDirModel()
{
static QDirModel* m = NULL;
- if(!m)
- {
+ if (!m) {
m = new QDirModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
- }
+ }
return m;
}
@@ -133,4 +126,3 @@ QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const
{
return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx));
}
-