summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/QtDialog
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/QtDialog')
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx64
-rw-r--r--Source/QtDialog/AddCacheEntry.h5
-rw-r--r--Source/QtDialog/CMakeSetup.cxx164
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx795
-rw-r--r--Source/QtDialog/CMakeSetupDialog.h12
-rw-r--r--Source/QtDialog/Compilers.h5
-rw-r--r--Source/QtDialog/FirstConfigure.cxx182
-rw-r--r--Source/QtDialog/FirstConfigure.h173
-rw-r--r--Source/QtDialog/QCMake.cxx234
-rw-r--r--Source/QtDialog/QCMake.h33
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx394
-rw-r--r--Source/QtDialog/QCMakeCacheView.h57
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx58
-rw-r--r--Source/QtDialog/QCMakeWidgets.h9
-rw-r--r--Source/QtDialog/RegexExplorer.cxx80
-rw-r--r--Source/QtDialog/WarningMessagesDialog.cxx27
16 files changed, 1038 insertions, 1254 deletions
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index efb2b65..dc7a4b0 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -17,21 +17,23 @@
static const int NumTypes = 4;
static const int DefaultTypeIndex = 0;
-static const QByteArray TypeStrings[NumTypes] =
- { "BOOL", "PATH", "FILEPATH", "STRING" };
-static const QCMakeProperty::PropertyType Types[NumTypes] =
- { QCMakeProperty::BOOL, QCMakeProperty::PATH,
- QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
+static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH",
+ "STRING" };
+static const QCMakeProperty::PropertyType Types[NumTypes] = {
+ QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH,
+ QCMakeProperty::STRING
+};
AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes)
- : QWidget(p), VarNames(varNames), VarTypes(varTypes)
+ const QStringList& varTypes)
+ : QWidget(p)
+ , VarNames(varNames)
+ , VarTypes(varTypes)
{
this->setupUi(this);
- for(int i=0; i<NumTypes; i++)
- {
+ for (int i = 0; i < NumTypes; i++) {
this->Type->addItem(TypeStrings[i]);
- }
+ }
QWidget* cb = new QCheckBox();
QWidget* path = new QCMakePathEditor();
QWidget* filepath = new QCMakeFilePathEditor();
@@ -46,10 +48,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
this->setTabOrder(path, filepath);
this->setTabOrder(filepath, string);
this->setTabOrder(string, this->Description);
- QCompleter *completer = new QCompleter(this->VarNames, this);
+ QCompleter* completer = new QCompleter(this->VarNames, this);
this->Name->setCompleter(completer);
- connect(completer, SIGNAL(activated(const QString&)),
- this, SLOT(onCompletionActivated(const QString&)));
+ connect(completer, SIGNAL(activated(const QString&)), this,
+ SLOT(onCompletionActivated(const QString&)));
}
QString AddCacheEntry::name() const
@@ -60,14 +62,11 @@ QString AddCacheEntry::name() const
QVariant AddCacheEntry::value() const
{
QWidget* w = this->StackedWidget->currentWidget();
- if(qobject_cast<QLineEdit*>(w))
- {
+ if (qobject_cast<QLineEdit*>(w)) {
return static_cast<QLineEdit*>(w)->text();
- }
- else if(qobject_cast<QCheckBox*>(w))
- {
+ } else if (qobject_cast<QCheckBox*>(w)) {
return static_cast<QCheckBox*>(w)->isChecked();
- }
+ }
return QVariant();
}
@@ -79,36 +78,31 @@ QString AddCacheEntry::description() const
QCMakeProperty::PropertyType AddCacheEntry::type() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return Types[idx];
- }
+ }
return Types[DefaultTypeIndex];
}
QString AddCacheEntry::typeString() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return TypeStrings[idx];
- }
+ }
return TypeStrings[DefaultTypeIndex];
}
-void AddCacheEntry::onCompletionActivated(const QString &text)
+void AddCacheEntry::onCompletionActivated(const QString& text)
{
int idx = this->VarNames.indexOf(text);
- if (idx != -1)
- {
+ if (idx != -1) {
QString vartype = this->VarTypes[idx];
- for (int i = 0; i < NumTypes; i++)
- {
- if (TypeStrings[i] == vartype)
- {
- this->Type->setCurrentIndex(i);
- break;
- }
+ for (int i = 0; i < NumTypes; i++) {
+ if (TypeStrings[i] == vartype) {
+ this->Type->setCurrentIndex(i);
+ break;
}
}
+ }
}
diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h
index 7c08af6..05469af 100644
--- a/Source/QtDialog/AddCacheEntry.h
+++ b/Source/QtDialog/AddCacheEntry.h
@@ -26,7 +26,7 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry
Q_OBJECT
public:
AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes);
+ const QStringList& varTypes);
QString name() const;
QVariant value() const;
@@ -35,7 +35,7 @@ public:
QString typeString() const;
private slots:
- void onCompletionActivated(const QString &text);
+ void onCompletionActivated(const QString& text);
private:
const QStringList& VarNames;
@@ -43,4 +43,3 @@ private:
};
#endif
-
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 1e1f040..c3c1468 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -9,7 +9,7 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
-#include "QCMake.h" // include to disable MS warnings
+#include "QCMake.h" // include to disable MS warnings
#include "CMakeSetupDialog.h"
#include "cmAlgorithms.h"
@@ -25,26 +25,18 @@
#include <cmsys/Encoding.hxx>
#include <cmsys/SystemTools.hxx>
-static const char * cmDocumentationName[][2] =
-{
- {0,
- " cmake-gui - CMake GUI."},
- {0,0}
-};
+static const char* cmDocumentationName[][2] = { { 0,
+ " cmake-gui - CMake GUI." },
+ { 0, 0 } };
-static const char * cmDocumentationUsage[][2] =
-{
- {0,
- " cmake-gui [options]\n"
- " cmake-gui [options] <path-to-source>\n"
- " cmake-gui [options] <path-to-existing-build>"},
- {0,0}
+static const char* cmDocumentationUsage[][2] = {
+ { 0, " cmake-gui [options]\n"
+ " cmake-gui [options] <path-to-source>\n"
+ " cmake-gui [options] <path-to-existing-build>" },
+ { 0, 0 }
};
-static const char * cmDocumentationOptions[][2] =
-{
- {0,0}
-};
+static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
#if defined(Q_OS_MAC)
static int cmOSXInstall(std::string dir);
@@ -62,8 +54,7 @@ int main(int argc, char** argv)
// do docs, if args were given
cmDocumentation doc;
doc.addCMakeStandardDocSections();
- if(argc2 >1 && doc.CheckOptions(argc2, argv2))
- {
+ if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) {
// Construct and print requested documentation.
cmake hcm;
hcm.SetHomeDirectory("");
@@ -73,23 +64,21 @@ int main(int argc, char** argv)
std::vector<cmDocumentationEntry> generators;
hcm.GetGeneratorDocumentation(generators);
doc.SetName("cmake");
- doc.SetSection("Name",cmDocumentationName);
- doc.SetSection("Usage",cmDocumentationUsage);
- doc.AppendSection("Generators",generators);
- doc.PrependSection("Options",cmDocumentationOptions);
+ doc.SetSection("Name", cmDocumentationName);
+ doc.SetSection("Usage", cmDocumentationUsage);
+ doc.AppendSection("Generators", generators);
+ doc.PrependSection("Options", cmDocumentationOptions);
- return (doc.PrintRequestedDocumentation(std::cout)? 0:1);
- }
+ return (doc.PrintRequestedDocumentation(std::cout) ? 0 : 1);
+ }
#if defined(Q_OS_MAC)
- if (argc2 == 2 && strcmp(argv2[1], "--install") == 0)
- {
+ if (argc2 == 2 && strcmp(argv2[1], "--install") == 0) {
return cmOSXInstall("/usr/local/bin");
- }
- if (argc2 == 2 && cmHasLiteralPrefix(argv2[1], "--install="))
- {
- return cmOSXInstall(argv2[1]+10);
- }
+ }
+ if (argc2 == 2 && cmHasLiteralPrefix(argv2[1], "--install=")) {
+ return cmOSXInstall(argv2[1] + 10);
+ }
#endif
QApplication app(argc, argv);
@@ -103,10 +92,9 @@ int main(int argc, char** argv)
// clean out standard Qt paths for plugins, which we don't use anyway
// when creating Mac bundles, it potentially causes problems
- foreach(QString p, QApplication::libraryPaths())
- {
+ foreach (QString p, QApplication::libraryPaths()) {
QApplication::removeLibraryPath(p);
- }
+ }
// tell the cmake library where cmake is
QDir cmExecDir(QApplication::applicationDirPath());
@@ -139,110 +127,92 @@ int main(int argc, char** argv)
std::string binaryDirectory;
std::string sourceDirectory;
typedef cmsys::CommandLineArguments argT;
- arg.AddArgument("-B", argT::CONCAT_ARGUMENT,
- &binaryDirectory, "Binary Directory");
- arg.AddArgument("-H", argT::CONCAT_ARGUMENT,
- &sourceDirectory, "Source Directory");
+ arg.AddArgument("-B", argT::CONCAT_ARGUMENT, &binaryDirectory,
+ "Binary Directory");
+ arg.AddArgument("-H", argT::CONCAT_ARGUMENT, &sourceDirectory,
+ "Source Directory");
// do not complain about unknown options
arg.StoreUnusedArguments(true);
arg.Parse();
- if(!sourceDirectory.empty() && !binaryDirectory.empty())
- {
+ if (!sourceDirectory.empty() && !binaryDirectory.empty()) {
dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str()));
dialog.setBinaryDirectory(QString::fromLocal8Bit(binaryDirectory.c_str()));
- }
- else
- {
+ } else {
QStringList args = app.arguments();
- if(args.count() == 2)
- {
- std::string filePath = cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data());
+ if (args.count() == 2) {
+ std::string filePath =
+ cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data());
// check if argument is a directory containing CMakeCache.txt
std::string buildFilePath =
cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str());
// check if argument is a CMakeCache.txt file
- if(cmSystemTools::GetFilenameName(filePath) == "CMakeCache.txt" &&
- cmSystemTools::FileExists(filePath.c_str()))
- {
+ if (cmSystemTools::GetFilenameName(filePath) == "CMakeCache.txt" &&
+ cmSystemTools::FileExists(filePath.c_str())) {
buildFilePath = filePath;
- }
+ }
// check if argument is a directory containing CMakeLists.txt
std::string srcFilePath =
cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str());
- if(cmSystemTools::FileExists(buildFilePath.c_str()))
- {
- dialog.setBinaryDirectory(
- QString::fromLocal8Bit(
- cmSystemTools::GetFilenamePath(buildFilePath).c_str()
- )
- );
- }
- else if(cmSystemTools::FileExists(srcFilePath.c_str()))
- {
+ if (cmSystemTools::FileExists(buildFilePath.c_str())) {
+ dialog.setBinaryDirectory(QString::fromLocal8Bit(
+ cmSystemTools::GetFilenamePath(buildFilePath).c_str()));
+ } else if (cmSystemTools::FileExists(srcFilePath.c_str())) {
dialog.setSourceDirectory(QString::fromLocal8Bit(filePath.c_str()));
- dialog.setBinaryDirectory(
- QString::fromLocal8Bit(cmSystemTools::CollapseFullPath(".").c_str())
- );
- }
+ dialog.setBinaryDirectory(QString::fromLocal8Bit(
+ cmSystemTools::CollapseFullPath(".").c_str()));
}
}
+ }
return app.exec();
}
#if defined(Q_OS_MAC)
-# include <errno.h>
-# include <string.h>
-# include <sys/stat.h>
-# include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
static bool cmOSXInstall(std::string const& dir, std::string const& tool)
{
- if (tool.empty())
- {
+ if (tool.empty()) {
return true;
- }
+ }
std::string link = dir + cmSystemTools::GetFilenameName(tool);
struct stat st;
- if (lstat(link.c_str(), &st) == 0 && S_ISLNK(st.st_mode))
- {
+ if (lstat(link.c_str(), &st) == 0 && S_ISLNK(st.st_mode)) {
char buf[4096];
- ssize_t s = readlink(link.c_str(), buf, sizeof(buf)-1);
- if (s >= 0 && std::string(buf, s) == tool)
- {
+ ssize_t s = readlink(link.c_str(), buf, sizeof(buf) - 1);
+ if (s >= 0 && std::string(buf, s) == tool) {
std::cerr << "Exists: '" << link << "' -> '" << tool << "'\n";
return true;
- }
}
+ }
cmSystemTools::MakeDirectory(dir);
- if (symlink(tool.c_str(), link.c_str()) == 0)
- {
+ if (symlink(tool.c_str(), link.c_str()) == 0) {
std::cerr << "Linked: '" << link << "' -> '" << tool << "'\n";
return true;
- }
- else
- {
+ } else {
int err = errno;
- std::cerr << "Failed: '" << link << "' -> '" << tool << "': "
- << strerror(err) << "\n";
+ std::cerr << "Failed: '" << link << "' -> '" << tool
+ << "': " << strerror(err) << "\n";
return false;
- }
+ }
}
static int cmOSXInstall(std::string dir)
{
- if (!cmHasLiteralSuffix(dir, "/"))
- {
+ if (!cmHasLiteralSuffix(dir, "/")) {
dir += "/";
- }
- return (
- cmOSXInstall(dir, cmSystemTools::GetCMakeCommand()) &&
- cmOSXInstall(dir, cmSystemTools::GetCTestCommand()) &&
- cmOSXInstall(dir, cmSystemTools::GetCPackCommand()) &&
- cmOSXInstall(dir, cmSystemTools::GetCMakeGUICommand()) &&
- cmOSXInstall(dir, cmSystemTools::GetCMakeCursesCommand())
- ) ? 0 : 1;
+ }
+ return (cmOSXInstall(dir, cmSystemTools::GetCMakeCommand()) &&
+ cmOSXInstall(dir, cmSystemTools::GetCTestCommand()) &&
+ cmOSXInstall(dir, cmSystemTools::GetCPackCommand()) &&
+ cmOSXInstall(dir, cmSystemTools::GetCMakeGUICommand()) &&
+ cmOSXInstall(dir, cmSystemTools::GetCMakeCursesCommand()))
+ ? 0
+ : 1;
}
#endif
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 945739d..712611d 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -40,7 +40,8 @@
#include "cmVersion.h"
QCMakeThread::QCMakeThread(QObject* p)
- : QThread(p), CMakeInstance(NULL)
+ : QThread(p)
+ , CMakeInstance(NULL)
{
}
@@ -60,7 +61,10 @@ void QCMakeThread::run()
}
CMakeSetupDialog::CMakeSetupDialog()
- : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting)
+ : ExitAfterGenerate(true)
+ , CacheModified(false)
+ , ConfigureNeeded(true)
+ , CurrentState(Interrupting)
{
QString title = QString(tr("CMake %1"));
title = title.arg(cmVersion::GetCMakeVersion());
@@ -72,10 +76,11 @@ CMakeSetupDialog::CMakeSetupDialog()
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
- this->AddVariableNames = settings.value("AddVariableNames",
- QStringList("CMAKE_INSTALL_PREFIX")).toStringList();
- this->AddVariableTypes = settings.value("AddVariableTypes",
- QStringList("PATH")).toStringList();
+ this->AddVariableNames =
+ settings.value("AddVariableNames", QStringList("CMAKE_INSTALL_PREFIX"))
+ .toStringList();
+ this->AddVariableTypes =
+ settings.value("AddVariableTypes", QStringList("PATH")).toStringList();
QWidget* cont = new QWidget(this);
this->setupUi(cont);
@@ -95,60 +100,57 @@ CMakeSetupDialog::CMakeSetupDialog()
bool advancedView = settings.value("AdvancedView", false).toBool();
this->setAdvancedView(advancedView);
- this->advancedCheck->setCheckState(advancedView?Qt::Checked : Qt::Unchecked);
+ this->advancedCheck->setCheckState(advancedView ? Qt::Checked
+ : Qt::Unchecked);
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
- QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)),
- this, SLOT(doReloadCache()));
+ QObject::connect(this->ReloadCacheAction, SIGNAL(triggered(bool)), this,
+ SLOT(doReloadCache()));
this->DeleteCacheAction = FileMenu->addAction(tr("&Delete Cache"));
- QObject::connect(this->DeleteCacheAction, SIGNAL(triggered(bool)),
- this, SLOT(doDeleteCache()));
+ QObject::connect(this->DeleteCacheAction, SIGNAL(triggered(bool)), this,
+ SLOT(doDeleteCache()));
this->ExitAction = FileMenu->addAction(tr("E&xit"));
this->ExitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
- QObject::connect(this->ExitAction, SIGNAL(triggered(bool)),
- this, SLOT(close()));
+ QObject::connect(this->ExitAction, SIGNAL(triggered(bool)), this,
+ SLOT(close()));
QMenu* ToolsMenu = this->menuBar()->addMenu(tr("&Tools"));
this->ConfigureAction = ToolsMenu->addAction(tr("&Configure"));
// prevent merging with Preferences menu item on Mac OS X
this->ConfigureAction->setMenuRole(QAction::NoRole);
- QObject::connect(this->ConfigureAction, SIGNAL(triggered(bool)),
- this, SLOT(doConfigure()));
+ QObject::connect(this->ConfigureAction, SIGNAL(triggered(bool)), this,
+ SLOT(doConfigure()));
this->GenerateAction = ToolsMenu->addAction(tr("&Generate"));
- QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)),
- this, SLOT(doGenerate()));
+ QObject::connect(this->GenerateAction, SIGNAL(triggered(bool)), this,
+ SLOT(doGenerate()));
QAction* showChangesAction = ToolsMenu->addAction(tr("&Show My Changes"));
- QObject::connect(showChangesAction, SIGNAL(triggered(bool)),
- this, SLOT(showUserChanges()));
+ QObject::connect(showChangesAction, SIGNAL(triggered(bool)), this,
+ SLOT(showUserChanges()));
#if defined(Q_WS_MAC) || defined(Q_OS_MAC)
- this->InstallForCommandLineAction
- = ToolsMenu->addAction(tr("&How to Install For Command Line Use"));
+ this->InstallForCommandLineAction =
+ ToolsMenu->addAction(tr("&How to Install For Command Line Use"));
QObject::connect(this->InstallForCommandLineAction, SIGNAL(triggered(bool)),
this, SLOT(doInstallForCommandLine()));
#endif
ToolsMenu->addSeparator();
- ToolsMenu->addAction(tr("Regular Expression Explorer..."),
- this, SLOT(doRegexExplorerDialog()));
+ ToolsMenu->addAction(tr("Regular Expression Explorer..."), this,
+ SLOT(doRegexExplorerDialog()));
ToolsMenu->addSeparator();
- ToolsMenu->addAction(tr("&Find in Output..."),
- this, SLOT(doOutputFindDialog()),
- QKeySequence::Find);
- ToolsMenu->addAction(tr("Find Next"),
- this, SLOT(doOutputFindNext()),
+ ToolsMenu->addAction(tr("&Find in Output..."), this,
+ SLOT(doOutputFindDialog()), QKeySequence::Find);
+ ToolsMenu->addAction(tr("Find Next"), this, SLOT(doOutputFindNext()),
QKeySequence::FindNext);
- ToolsMenu->addAction(tr("Find Previous"),
- this, SLOT(doOutputFindPrev()),
+ ToolsMenu->addAction(tr("Find Previous"), this, SLOT(doOutputFindPrev()),
QKeySequence::FindPrevious);
- ToolsMenu->addAction(tr("Goto Next Error"),
- this, SLOT(doOutputErrorNext()),
- QKeySequence(Qt::Key_F8)); // in Visual Studio
- new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Period),
- this, SLOT(doOutputErrorNext())); // in Eclipse
+ ToolsMenu->addAction(tr("Goto Next Error"), this, SLOT(doOutputErrorNext()),
+ QKeySequence(Qt::Key_F8)); // in Visual Studio
+ new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Period), this,
+ SLOT(doOutputErrorNext())); // in Eclipse
QMenu* OptionsMenu = this->menuBar()->addMenu(tr("&Options"));
- OptionsMenu->addAction(tr("Warning Messages..."),
- this, SLOT(doWarningMessagesDialog()));
+ OptionsMenu->addAction(tr("Warning Messages..."), this,
+ SLOT(doWarningMessagesDialog()));
this->WarnUninitializedAction =
OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
this->WarnUninitializedAction->setCheckable(true);
@@ -158,24 +160,24 @@ CMakeSetupDialog::CMakeSetupDialog()
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
debugAction->setCheckable(true);
- QObject::connect(debugAction, SIGNAL(toggled(bool)),
- this, SLOT(setDebugOutput(bool)));
+ QObject::connect(debugAction, SIGNAL(toggled(bool)), this,
+ SLOT(setDebugOutput(bool)));
OptionsMenu->addSeparator();
- QAction* expandAction = OptionsMenu->addAction(tr("&Expand Grouped Entries"));
- QObject::connect(expandAction, SIGNAL(triggered(bool)),
- this->CacheValues, SLOT(expandAll()));
- QAction* collapseAction = OptionsMenu->addAction(tr("&Collapse Grouped Entries"));
- QObject::connect(collapseAction, SIGNAL(triggered(bool)),
- this->CacheValues, SLOT(collapseAll()));
+ QAction* expandAction =
+ OptionsMenu->addAction(tr("&Expand Grouped Entries"));
+ QObject::connect(expandAction, SIGNAL(triggered(bool)), this->CacheValues,
+ SLOT(expandAll()));
+ QAction* collapseAction =
+ OptionsMenu->addAction(tr("&Collapse Grouped Entries"));
+ QObject::connect(collapseAction, SIGNAL(triggered(bool)), this->CacheValues,
+ SLOT(collapseAll()));
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
QAction* a = HelpMenu->addAction(tr("About"));
- QObject::connect(a, SIGNAL(triggered(bool)),
- this, SLOT(doAbout()));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doAbout()));
a = HelpMenu->addAction(tr("Help"));
- QObject::connect(a, SIGNAL(triggered(bool)),
- this, SLOT(doHelp()));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doHelp()));
this->setAcceptDrops(true);
@@ -193,12 +195,12 @@ CMakeSetupDialog::CMakeSetupDialog()
this->Output->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->Output, SIGNAL(customContextMenuRequested(const QPoint&)),
- this, SLOT(doOutputContextMenu(const QPoint &)));
+ this, SLOT(doOutputContextMenu(const QPoint&)));
// start the cmake worker thread
this->CMakeThread = new QCMakeThread(this);
- QObject::connect(this->CMakeThread, SIGNAL(cmakeInitialized()),
- this, SLOT(initialize()), Qt::QueuedConnection);
+ QObject::connect(this->CMakeThread, SIGNAL(cmakeInitialized()), this,
+ SLOT(initialize()), Qt::QueuedConnection);
this->CMakeThread->start();
this->enterState(ReadyConfigure);
@@ -211,20 +213,20 @@ void CMakeSetupDialog::initialize()
{
// now the cmake worker thread is running, lets make our connections to it
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(propertiesChanged(const QCMakePropertyList&)),
- this->CacheValues->cacheModel(),
- SLOT(setProperties(const QCMakePropertyList&)));
+ SIGNAL(propertiesChanged(const QCMakePropertyList&)),
+ this->CacheValues->cacheModel(),
+ SLOT(setProperties(const QCMakePropertyList&)));
- QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)),
- this, SLOT(doConfigure()));
+ QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)), this,
+ SLOT(doConfigure()));
- QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)),
- this, SLOT(exitLoop(int)));
- QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)),
- this, SLOT(exitLoop(int)));
+ QObject::connect(this->CMakeThread->cmakeInstance(),
+ SIGNAL(configureDone(int)), this, SLOT(exitLoop(int)));
+ QObject::connect(this->CMakeThread->cmakeInstance(),
+ SIGNAL(generateDone(int)), this, SLOT(exitLoop(int)));
- QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
- this, SLOT(doGenerate()));
+ QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this,
+ SLOT(doGenerate()));
QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
this, SLOT(doSourceBrowse()));
@@ -233,51 +235,50 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
this, SLOT(onBinaryDirectoryChanged(QString)));
- QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
- this, SLOT(onSourceDirectoryChanged(QString)));
+ QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)), this,
+ SLOT(onSourceDirectoryChanged(QString)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(sourceDirChanged(QString)),
- this, SLOT(updateSourceDirectory(QString)));
+ SIGNAL(sourceDirChanged(QString)), this,
+ SLOT(updateSourceDirectory(QString)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(binaryDirChanged(QString)),
- this, SLOT(updateBinaryDirectory(QString)));
+ SIGNAL(binaryDirChanged(QString)), this,
+ SLOT(updateBinaryDirectory(QString)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(progressChanged(QString, float)),
- this, SLOT(showProgress(QString,float)));
+ SIGNAL(progressChanged(QString, float)), this,
+ SLOT(showProgress(QString, float)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(errorMessage(QString)),
- this, SLOT(error(QString)));
+ SIGNAL(errorMessage(QString)), this, SLOT(error(QString)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(outputMessage(QString)),
- this, SLOT(message(QString)));
+ SIGNAL(outputMessage(QString)), this,
+ SLOT(message(QString)));
- QObject::connect(this->groupedCheck, SIGNAL(toggled(bool)),
- this, SLOT(setGroupedView(bool)));
- QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)),
- this, SLOT(setAdvancedView(bool)));
- QObject::connect(this->Search, SIGNAL(textChanged(QString)),
- this, SLOT(setSearchFilter(QString)));
+ QObject::connect(this->groupedCheck, SIGNAL(toggled(bool)), this,
+ SLOT(setGroupedView(bool)));
+ QObject::connect(this->advancedCheck, SIGNAL(toggled(bool)), this,
+ SLOT(setAdvancedView(bool)));
+ QObject::connect(this->Search, SIGNAL(textChanged(QString)), this,
+ SLOT(setSearchFilter(QString)));
QObject::connect(this->CMakeThread->cmakeInstance(),
- SIGNAL(generatorChanged(QString)),
- this, SLOT(updateGeneratorLabel(QString)));
+ SIGNAL(generatorChanged(QString)), this,
+ SLOT(updateGeneratorLabel(QString)));
this->updateGeneratorLabel(QString());
QObject::connect(this->CacheValues->cacheModel(),
- SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(setCacheModified()));
+ SIGNAL(dataChanged(QModelIndex, QModelIndex)), this,
+ SLOT(setCacheModified()));
QObject::connect(this->CacheValues->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this, SLOT(selectionChanged()));
- QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
- this, SLOT(removeSelectedCacheEntries()));
- QObject::connect(this->AddEntry, SIGNAL(clicked(bool)),
- this, SLOT(addCacheEntry()));
+ QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)), this,
+ SLOT(removeSelectedCacheEntries()));
+ QObject::connect(this->AddEntry, SIGNAL(clicked(bool)), this,
+ SLOT(addCacheEntry()));
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
@@ -286,16 +287,13 @@ void CMakeSetupDialog::initialize()
this->CMakeThread->cmakeInstance(),
SLOT(setWarnUnusedMode(bool)));
- if(!this->SourceDirectory->text().isEmpty() ||
- !this->BinaryDirectory->lineEdit()->text().isEmpty())
- {
+ if (!this->SourceDirectory->text().isEmpty() ||
+ !this->BinaryDirectory->lineEdit()->text().isEmpty()) {
this->onSourceDirectoryChanged(this->SourceDirectory->text());
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
- }
- else
- {
+ } else {
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
- }
+ }
}
CMakeSetupDialog::~CMakeSetupDialog()
@@ -316,38 +314,34 @@ bool CMakeSetupDialog::prepareConfigure()
// make sure build directory exists
QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory();
QDir dir(bindir);
- if(!dir.exists())
- {
+ if (!dir.exists()) {
QString msg = tr("Build directory does not exist, "
- "should I create it?\n\n"
- "Directory: ");
+ "should I create it?\n\n"
+ "Directory: ");
msg += bindir;
QString title = tr("Create Directory");
QMessageBox::StandardButton btn;
btn = QMessageBox::information(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
- if(btn == QMessageBox::No)
- {
+ if (btn == QMessageBox::No) {
return false;
- }
- if(!dir.mkpath("."))
- {
- QMessageBox::information(this, tr("Create Directory Failed"),
+ }
+ if (!dir.mkpath(".")) {
+ QMessageBox::information(
+ this, tr("Create Directory Failed"),
QString(tr("Failed to create directory %1")).arg(dir.path()),
QMessageBox::Ok);
return false;
- }
}
+ }
// if no generator, prompt for it and other setup stuff
- if(this->CMakeThread->cmakeInstance()->generator().isEmpty())
- {
- if(!this->setupFirstConfigure())
- {
+ if (this->CMakeThread->cmakeInstance()->generator().isEmpty()) {
+ if (!this->setupFirstConfigure()) {
return false;
- }
}
+ }
// remember path
this->addBinaryPath(dir.absolutePath());
@@ -362,36 +356,30 @@ void CMakeSetupDialog::exitLoop(int err)
void CMakeSetupDialog::doConfigure()
{
- if(this->CurrentState == Configuring)
- {
+ if (this->CurrentState == Configuring) {
// stop configure
doInterrupt();
return;
- }
+ }
- if(!prepareConfigure())
- {
+ if (!prepareConfigure()) {
return;
- }
+ }
this->enterState(Configuring);
bool ret = doConfigureInternal();
- if(ret)
- {
+ if (ret) {
this->ConfigureNeeded = false;
- }
+ }
- if(ret && !this->CacheValues->cacheModel()->newPropertyCount())
- {
+ if (ret && !this->CacheValues->cacheModel()->newPropertyCount()) {
this->enterState(ReadyGenerate);
- }
- else
- {
+ } else {
this->enterState(ReadyConfigure);
this->CacheValues->scrollToTop();
- }
+ }
this->ProgressBar->reset();
}
@@ -400,21 +388,20 @@ bool CMakeSetupDialog::doConfigureInternal()
this->Output->clear();
this->CacheValues->selectionModel()->clear();
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setProperties", Qt::QueuedConnection,
- Q_ARG(QCMakePropertyList,
- this->CacheValues->cacheModel()->properties()));
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "configure", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(
+ this->CMakeThread->cmakeInstance(), "setProperties", Qt::QueuedConnection,
+ Q_ARG(QCMakePropertyList, this->CacheValues->cacheModel()->properties()));
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "configure",
+ Qt::QueuedConnection);
int err = this->LocalLoop.exec();
- if(err != 0)
- {
- QMessageBox::critical(this, tr("Error"),
+ if (err != 0) {
+ QMessageBox::critical(
+ this, tr("Error"),
tr("Error in configuration process, project files may be invalid"),
QMessageBox::Ok);
- }
+ }
return 0 == err;
}
@@ -422,21 +409,19 @@ bool CMakeSetupDialog::doConfigureInternal()
void CMakeSetupDialog::doInstallForCommandLine()
{
QString title = tr("How to Install For Command Line Use");
- QString msg = tr(
- "One may add CMake to the PATH:\n"
- "\n"
- " PATH=\"%1\":\"$PATH\"\n"
- "\n"
- "Or, to install symlinks to '/usr/local/bin', run:\n"
- "\n"
- " sudo \"%2\" --install\n"
- "\n"
- "Or, to install symlinks to another directory, run:\n"
- "\n"
- " sudo \"%3\" --install=/path/to/bin\n"
- );
- msg = msg.arg(cmSystemTools::GetFilenamePath(
- cmSystemTools::GetCMakeCommand()).c_str());
+ QString msg = tr("One may add CMake to the PATH:\n"
+ "\n"
+ " PATH=\"%1\":\"$PATH\"\n"
+ "\n"
+ "Or, to install symlinks to '/usr/local/bin', run:\n"
+ "\n"
+ " sudo \"%2\" --install\n"
+ "\n"
+ "Or, to install symlinks to another directory, run:\n"
+ "\n"
+ " sudo \"%3\" --install=/path/to/bin\n");
+ msg = msg.arg(
+ cmSystemTools::GetFilenamePath(cmSystemTools::GetCMakeCommand()).c_str());
msg = msg.arg(cmSystemTools::GetCMakeGUICommand().c_str());
msg = msg.arg(cmSystemTools::GetCMakeGUICommand().c_str());
@@ -448,8 +433,8 @@ void CMakeSetupDialog::doInstallForCommandLine()
lab->setText(msg);
lab->setWordWrap(false);
lab->setTextInteractionFlags(Qt::TextSelectableByMouse);
- QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
- Qt::Horizontal, &dialog);
+ QDialogButtonBox* btns =
+ new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
l->addWidget(btns);
dialog.exec();
@@ -457,57 +442,52 @@ void CMakeSetupDialog::doInstallForCommandLine()
bool CMakeSetupDialog::doGenerateInternal()
{
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "generate", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "generate",
+ Qt::QueuedConnection);
int err = this->LocalLoop.exec();
- if(err != 0)
- {
- QMessageBox::critical(this, tr("Error"),
+ if (err != 0) {
+ QMessageBox::critical(
+ this, tr("Error"),
tr("Error in generation process, project files may be invalid"),
QMessageBox::Ok);
- }
+ }
return 0 == err;
}
void CMakeSetupDialog::doGenerate()
{
- if(this->CurrentState == Generating)
- {
+ if (this->CurrentState == Generating) {
// stop generate
doInterrupt();
return;
- }
+ }
// see if we need to configure
// we'll need to configure if:
// the configure step hasn't been done yet
// generate was the last step done
- if(this->ConfigureNeeded)
- {
- if(!prepareConfigure())
- {
+ if (this->ConfigureNeeded) {
+ if (!prepareConfigure()) {
return;
- }
}
+ }
this->enterState(Generating);
bool config_passed = true;
- if(this->ConfigureNeeded)
- {
+ if (this->ConfigureNeeded) {
this->CacheValues->cacheModel()->setShowNewProperties(false);
this->ProgressFactor = 0.5;
config_passed = doConfigureInternal();
this->ProgressOffset = 0.5;
- }
+ }
- if(config_passed)
- {
+ if (config_passed) {
doGenerateInternal();
- }
+ }
this->ProgressOffset = 0.0;
this->ProgressFactor = 1.0;
@@ -522,78 +502,83 @@ void CMakeSetupDialog::doGenerate()
void CMakeSetupDialog::closeEvent(QCloseEvent* e)
{
// prompt for close if there are unsaved changes, and we're not busy
- if(this->CacheModified)
- {
+ if (this->CacheModified) {
QString msg = tr("You have changed options but not rebuilt, "
- "are you sure you want to exit?");
+ "are you sure you want to exit?");
QString title = tr("Confirm Exit");
QMessageBox::StandardButton btn;
btn = QMessageBox::critical(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
- if(btn == QMessageBox::No)
- {
+ if (btn == QMessageBox::No) {
e->ignore();
- }
}
+ }
// don't close if we're busy, unless the user really wants to
- if(this->CurrentState == Configuring)
- {
- QString msg = tr("You are in the middle of a Configure.\n"
- "If you Exit now the configure information will be lost.\n"
- "Are you sure you want to Exit?");
+ if (this->CurrentState == Configuring) {
+ QString msg =
+ tr("You are in the middle of a Configure.\n"
+ "If you Exit now the configure information will be lost.\n"
+ "Are you sure you want to Exit?");
QString title = tr("Confirm Exit");
QMessageBox::StandardButton btn;
btn = QMessageBox::critical(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
- if(btn == QMessageBox::No)
- {
+ if (btn == QMessageBox::No) {
e->ignore();
- }
- else
- {
+ } else {
this->doInterrupt();
- }
}
+ }
// let the generate finish
- if(this->CurrentState == Generating)
- {
+ if (this->CurrentState == Generating) {
e->ignore();
- }
+ }
}
void CMakeSetupDialog::doHelp()
{
- QString msg = tr("CMake is used to configure and generate build files for "
+ QString msg = tr(
+ "CMake is used to configure and generate build files for "
"software projects. The basic steps for configuring a project are as "
- "follows:\r\n\r\n1. Select the source directory for the project. This should "
- "contain the CMakeLists.txt files for the project.\r\n\r\n2. Select the build "
- "directory for the project. This is the directory where the project will be "
+ "follows:\r\n\r\n1. Select the source directory for the project. This "
+ "should "
+ "contain the CMakeLists.txt files for the project.\r\n\r\n2. Select the "
+ "build "
+ "directory for the project. This is the directory where the project "
+ "will be "
"built. It can be the same or a different directory than the source "
- "directory. For easy clean up, a separate build directory is recommended. "
+ "directory. For easy clean up, a separate build directory is "
+ "recommended. "
"CMake will create the directory if it does not exist.\r\n\r\n3. Once the "
"source and binary directories are selected, it is time to press the "
- "Configure button. This will cause CMake to read all of the input files and "
- "discover all the variables used by the project. The first time a variable "
- "is displayed it will be in Red. Users should inspect red variables making "
- "sure the values are correct. For some projects the Configure process can "
- "be iterative, so continue to press the Configure button until there are no "
+ "Configure button. This will cause CMake to read all of the input files "
+ "and "
+ "discover all the variables used by the project. The first time a "
+ "variable "
+ "is displayed it will be in Red. Users should inspect red variables "
+ "making "
+ "sure the values are correct. For some projects the Configure process "
+ "can "
+ "be iterative, so continue to press the Configure button until there are "
+ "no "
"longer red entries.\r\n\r\n4. Once there are no longer red entries, you "
- "should click the Generate button. This will write the build files to the build "
+ "should click the Generate button. This will write the build files to "
+ "the build "
"directory.");
QDialog dialog;
QFontMetrics met(this->font());
int msgWidth = met.width(msg);
- dialog.setMinimumSize(msgWidth/15,20);
+ dialog.setMinimumSize(msgWidth / 15, 20);
dialog.setWindowTitle(tr("Help"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
QLabel* lab = new QLabel(&dialog);
lab->setText(msg);
lab->setWordWrap(true);
- QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
- Qt::Horizontal, &dialog);
+ QDialogButtonBox* btns =
+ new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
l->addWidget(lab);
l->addWidget(btns);
@@ -608,44 +593,40 @@ void CMakeSetupDialog::doInterrupt()
void CMakeSetupDialog::doSourceBrowse()
{
- QString dir = QFileDialog::getExistingDirectory(this,
- tr("Enter Path to Source"), this->SourceDirectory->text(),
+ QString dir = QFileDialog::getExistingDirectory(
+ this, tr("Enter Path to Source"), this->SourceDirectory->text(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
- if(!dir.isEmpty())
- {
+ if (!dir.isEmpty()) {
this->setSourceDirectory(dir);
- }
+ }
}
void CMakeSetupDialog::updateSourceDirectory(const QString& dir)
{
- if(this->SourceDirectory->text() != dir)
- {
+ if (this->SourceDirectory->text() != dir) {
this->SourceDirectory->blockSignals(true);
this->SourceDirectory->setText(dir);
this->SourceDirectory->blockSignals(false);
- }
+ }
}
void CMakeSetupDialog::updateBinaryDirectory(const QString& dir)
{
- if(this->BinaryDirectory->currentText() != dir)
- {
+ if (this->BinaryDirectory->currentText() != dir) {
this->BinaryDirectory->blockSignals(true);
this->BinaryDirectory->setEditText(dir);
this->BinaryDirectory->blockSignals(false);
- }
+ }
}
void CMakeSetupDialog::doBinaryBrowse()
{
- QString dir = QFileDialog::getExistingDirectory(this,
- tr("Enter Path to Build"), this->BinaryDirectory->currentText(),
+ QString dir = QFileDialog::getExistingDirectory(
+ this, tr("Enter Path to Build"), this->BinaryDirectory->currentText(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
- if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText())
- {
+ if (!dir.isEmpty() && dir != this->BinaryDirectory->currentText()) {
this->setBinaryDirectory(dir);
- }
+ }
}
void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
@@ -657,7 +638,8 @@ void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
{
this->Output->clear();
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setSourceDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
+ "setSourceDirectory", Qt::QueuedConnection,
+ Q_ARG(QString, dir));
}
void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
@@ -669,10 +651,12 @@ void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
this->CacheModified = false;
this->CacheValues->cacheModel()->clear();
- qobject_cast<QCMakeCacheModelDelegate*>(this->CacheValues->itemDelegate())->clearChanges();
+ qobject_cast<QCMakeCacheModelDelegate*>(this->CacheValues->itemDelegate())
+ ->clearChanges();
this->Output->clear();
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setBinaryDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
+ "setBinaryDirectory", Qt::QueuedConnection,
+ Q_ARG(QString, dir));
}
void CMakeSetupDialog::setSourceDirectory(const QString& dir)
@@ -689,13 +673,14 @@ void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
void CMakeSetupDialog::error(const QString& msg)
{
this->Output->setCurrentCharFormat(this->ErrorFormat);
- //QTextEdit will terminate the msg with a ParagraphSeparator, but it also replaces
- //all newlines with ParagraphSeparators. By replacing the newlines by ourself, one
- //error msg will be one paragraph.
+ // QTextEdit will terminate the msg with a ParagraphSeparator, but it also
+ // replaces
+ // all newlines with ParagraphSeparators. By replacing the newlines by
+ // ourself, one
+ // error msg will be one paragraph.
QString paragraph(msg);
paragraph.replace(QLatin1Char('\n'), QChar::LineSeparator);
this->Output->append(paragraph);
-
}
void CMakeSetupDialog::message(const QString& msg)
@@ -717,7 +702,7 @@ void CMakeSetupDialog::setEnabledState(bool enabled)
this->ExitAction->setEnabled(enabled);
this->ConfigureAction->setEnabled(enabled);
this->AddEntry->setEnabled(enabled);
- this->RemoveEntry->setEnabled(false); // let selection re-enable it
+ this->RemoveEntry->setEnabled(false); // let selection re-enable it
}
bool CMakeSetupDialog::setupFirstConfigure()
@@ -727,58 +712,54 @@ bool CMakeSetupDialog::setupFirstConfigure()
// initialize dialog and restore saved settings
// add generators
- dialog.setGenerators(this->CMakeThread->cmakeInstance()->availableGenerators());
+ dialog.setGenerators(
+ this->CMakeThread->cmakeInstance()->availableGenerators());
// restore from settings
dialog.loadFromSettings();
- if(dialog.exec() == QDialog::Accepted)
- {
+ if (dialog.exec() == QDialog::Accepted) {
dialog.saveToSettings();
this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator());
this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset());
QCMakeCacheModel* m = this->CacheValues->cacheModel();
- if(dialog.compilerSetup())
- {
+ if (dialog.compilerSetup()) {
QString fortranCompiler = dialog.getFortranCompiler();
- if(!fortranCompiler.isEmpty())
- {
+ if (!fortranCompiler.isEmpty()) {
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
"Fortran compiler.", fortranCompiler, false);
- }
+ }
QString cxxCompiler = dialog.getCXXCompiler();
- if(!cxxCompiler.isEmpty())
- {
+ if (!cxxCompiler.isEmpty()) {
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER",
"CXX compiler.", cxxCompiler, false);
- }
+ }
QString cCompiler = dialog.getCCompiler();
- if(!cCompiler.isEmpty())
- {
+ if (!cCompiler.isEmpty()) {
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
"C compiler.", cCompiler, false);
- }
}
- else if(dialog.crossCompilerSetup())
- {
+ } else if (dialog.crossCompilerSetup()) {
QString fortranCompiler = dialog.getFortranCompiler();
- if(!fortranCompiler.isEmpty())
- {
+ if (!fortranCompiler.isEmpty()) {
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER",
"Fortran compiler.", fortranCompiler, false);
- }
+ }
QString mode = dialog.getCrossIncludeMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE",
+ m->insertProperty(QCMakeProperty::STRING,
+ "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE",
tr("CMake Find Include Mode"), mode, false);
mode = dialog.getCrossLibraryMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY",
+ m->insertProperty(QCMakeProperty::STRING,
+ "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY",
tr("CMake Find Library Mode"), mode, false);
mode = dialog.getCrossProgramMode();
- m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM",
+ m->insertProperty(QCMakeProperty::STRING,
+ "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM",
tr("CMake Find Program Mode"), mode, false);
QString rootPath = dialog.getCrossRoot();
@@ -797,15 +778,14 @@ bool CMakeSetupDialog::setupFirstConfigure()
QString cCompiler = dialog.getCCompiler();
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER",
tr("C compiler."), cCompiler, false);
- }
- else if(dialog.crossCompilerToolChainFile())
- {
+ } else if (dialog.crossCompilerToolChainFile()) {
QString toolchainFile = dialog.getCrossCompilerToolChainFile();
m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE",
- tr("Cross Compile ToolChain File"), toolchainFile, false);
- }
- return true;
+ tr("Cross Compile ToolChain File"), toolchainFile,
+ false);
}
+ return true;
+ }
return false;
}
@@ -813,21 +793,18 @@ bool CMakeSetupDialog::setupFirstConfigure()
void CMakeSetupDialog::updateGeneratorLabel(const QString& gen)
{
QString str = tr("Current Generator: ");
- if(gen.isEmpty())
- {
+ if (gen.isEmpty()) {
str += tr("None");
- }
- else
- {
+ } else {
str += gen;
- }
+ }
this->Generator->setText(str);
}
void CMakeSetupDialog::doReloadCache()
{
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "reloadCache", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "reloadCache",
+ Qt::QueuedConnection);
}
void CMakeSetupDialog::doDeleteCache()
@@ -837,12 +814,11 @@ void CMakeSetupDialog::doDeleteCache()
QMessageBox::StandardButton btn;
btn = QMessageBox::information(this, title, msg,
QMessageBox::Yes | QMessageBox::No);
- if(btn == QMessageBox::No)
- {
+ if (btn == QMessageBox::No) {
return;
- }
- QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "deleteCache", Qt::QueuedConnection);
+ }
+ QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), "deleteCache",
+ Qt::QueuedConnection);
}
void CMakeSetupDialog::doAbout()
@@ -864,7 +840,7 @@ void CMakeSetupDialog::doAbout()
msg = msg.arg(cmVersion::GetCMakeVersion());
msg = msg.arg(qVersion());
#ifdef CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL
- std::string lgpl = cmSystemTools::GetCMakeRoot()+"/Licenses/LGPLv2.1.txt";
+ std::string lgpl = cmSystemTools::GetCMakeRoot() + "/Licenses/LGPLv2.1.txt";
msg = msg.arg(lgpl.c_str());
#endif
@@ -875,8 +851,8 @@ void CMakeSetupDialog::doAbout()
l->addWidget(lab);
lab->setText(msg);
lab->setWordWrap(true);
- QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
- Qt::Horizontal, &dialog);
+ QDialogButtonBox* btns =
+ new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
l->addWidget(btns);
dialog.exec();
@@ -894,10 +870,9 @@ void CMakeSetupDialog::addBinaryPath(const QString& path)
// update UI
this->BinaryDirectory->blockSignals(true);
int idx = this->BinaryDirectory->findText(cleanpath);
- if(idx != -1)
- {
+ if (idx != -1) {
this->BinaryDirectory->removeItem(idx);
- }
+ }
this->BinaryDirectory->insertItem(0, cleanpath);
this->BinaryDirectory->setCurrentIndex(0);
this->BinaryDirectory->blockSignals(false);
@@ -911,56 +886,48 @@ void CMakeSetupDialog::addBinaryPath(const QString& path)
void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
{
- if(!(this->CurrentState == ReadyConfigure ||
- this->CurrentState == ReadyGenerate))
- {
+ if (!(this->CurrentState == ReadyConfigure ||
+ this->CurrentState == ReadyGenerate)) {
e->ignore();
return;
- }
+ }
const QMimeData* dat = e->mimeData();
QList<QUrl> urls = dat->urls();
QString file = urls.count() ? urls[0].toLocalFile() : QString();
- if(!file.isEmpty() &&
- (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) ||
- file.endsWith("CMakeLists.txt", Qt::CaseInsensitive) ) )
- {
+ if (!file.isEmpty() &&
+ (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) ||
+ file.endsWith("CMakeLists.txt", Qt::CaseInsensitive))) {
e->accept();
- }
- else
- {
+ } else {
e->ignore();
- }
+ }
}
void CMakeSetupDialog::dropEvent(QDropEvent* e)
{
- if(!(this->CurrentState == ReadyConfigure ||
- this->CurrentState == ReadyGenerate))
- {
+ if (!(this->CurrentState == ReadyConfigure ||
+ this->CurrentState == ReadyGenerate)) {
return;
- }
+ }
const QMimeData* dat = e->mimeData();
QList<QUrl> urls = dat->urls();
QString file = urls.count() ? urls[0].toLocalFile() : QString();
- if(file.endsWith("CMakeCache.txt", Qt::CaseInsensitive))
- {
+ if (file.endsWith("CMakeCache.txt", Qt::CaseInsensitive)) {
QFileInfo info(file);
- if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath())
- {
+ if (this->CMakeThread->cmakeInstance()->binaryDirectory() !=
+ info.absolutePath()) {
this->setBinaryDirectory(info.absolutePath());
- }
}
- else if(file.endsWith("CMakeLists.txt", Qt::CaseInsensitive))
- {
+ } else if (file.endsWith("CMakeLists.txt", Qt::CaseInsensitive)) {
QFileInfo info(file);
- if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath())
- {
+ if (this->CMakeThread->cmakeInstance()->binaryDirectory() !=
+ info.absolutePath()) {
this->setSourceDirectory(info.absolutePath());
this->setBinaryDirectory(info.absolutePath());
- }
}
+ }
}
QStringList CMakeSetupDialog::loadBuildPaths()
@@ -969,14 +936,12 @@ QStringList CMakeSetupDialog::loadBuildPaths()
settings.beginGroup("Settings/StartPath");
QStringList buildPaths;
- for(int i=0; i<10; i++)
- {
- QString p = settings.value(QString("WhereBuild%1").arg(i)).toString();
- if(!p.isEmpty())
- {
- buildPaths.append(p);
- }
+ for (int i = 0; i < 10; i++) {
+ QString p = settings.value(QString("WhereBuild%1").arg(i)).toString();
+ if (!p.isEmpty()) {
+ buildPaths.append(p);
}
+ }
return buildPaths;
}
@@ -986,15 +951,13 @@ void CMakeSetupDialog::saveBuildPaths(const QStringList& paths)
settings.beginGroup("Settings/StartPath");
int num = paths.count();
- if(num > 10)
- {
+ if (num > 10) {
num = 10;
- }
+ }
- for(int i=0; i<num; i++)
- {
+ for (int i = 0; i < num; i++) {
settings.setValue(QString("WhereBuild%1").arg(i), paths[i]);
- }
+ }
}
void CMakeSetupDialog::setCacheModified()
@@ -1008,78 +971,62 @@ void CMakeSetupDialog::removeSelectedCacheEntries()
{
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
QList<QPersistentModelIndex> pidxs;
- foreach(QModelIndex i, idxs)
- {
+ foreach (QModelIndex i, idxs) {
pidxs.append(i);
- }
- foreach(QPersistentModelIndex pi, pidxs)
- {
+ }
+ foreach (QPersistentModelIndex pi, pidxs) {
this->CacheValues->model()->removeRow(pi.row(), pi.parent());
- }
+ }
}
void CMakeSetupDialog::selectionChanged()
{
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
- if(idxs.count() &&
- (this->CurrentState == ReadyConfigure ||
- this->CurrentState == ReadyGenerate) )
- {
+ if (idxs.count() && (this->CurrentState == ReadyConfigure ||
+ this->CurrentState == ReadyGenerate)) {
this->RemoveEntry->setEnabled(true);
- }
- else
- {
+ } else {
this->RemoveEntry->setEnabled(false);
- }
+ }
}
void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
{
- if(s == this->CurrentState)
- {
+ if (s == this->CurrentState) {
return;
- }
+ }
this->CurrentState = s;
- if(s == Interrupting)
- {
+ if (s == Interrupting) {
this->ConfigureButton->setEnabled(false);
this->GenerateButton->setEnabled(false);
- }
- else if(s == Configuring)
- {
+ } else if (s == Configuring) {
this->setEnabledState(false);
this->GenerateButton->setEnabled(false);
this->GenerateAction->setEnabled(false);
this->ConfigureButton->setText(tr("&Stop"));
- }
- else if(s == Generating)
- {
+ } else if (s == Generating) {
this->CacheModified = false;
this->setEnabledState(false);
this->ConfigureButton->setEnabled(false);
this->GenerateAction->setEnabled(false);
this->GenerateButton->setText(tr("&Stop"));
- }
- else if(s == ReadyConfigure)
- {
+ } else if (s == ReadyConfigure) {
this->setEnabledState(true);
this->GenerateButton->setEnabled(true);
this->GenerateAction->setEnabled(true);
this->ConfigureButton->setEnabled(true);
this->ConfigureButton->setText(tr("&Configure"));
this->GenerateButton->setText(tr("&Generate"));
- }
- else if(s == ReadyGenerate)
- {
+ } else if (s == ReadyGenerate) {
this->setEnabledState(true);
this->GenerateButton->setEnabled(true);
this->GenerateAction->setEnabled(true);
this->ConfigureButton->setEnabled(true);
this->ConfigureButton->setText(tr("&Configure"));
this->GenerateButton->setText(tr("&Generate"));
- }
+ }
}
void CMakeSetupDialog::addCacheEntry()
@@ -1088,44 +1035,40 @@ void CMakeSetupDialog::addCacheEntry()
dialog.resize(400, 200);
dialog.setWindowTitle(tr("Add Cache Entry"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
- AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableNames,
- this->AddVariableTypes);
+ AddCacheEntry* w =
+ new AddCacheEntry(&dialog, this->AddVariableNames, this->AddVariableTypes);
QDialogButtonBox* btns = new QDialogButtonBox(
- QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
- Qt::Horizontal, &dialog);
+ QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
QObject::connect(btns, SIGNAL(rejected()), &dialog, SLOT(reject()));
l->addWidget(w);
l->addStretch();
l->addWidget(btns);
- if(QDialog::Accepted == dialog.exec())
- {
+ if (QDialog::Accepted == dialog.exec()) {
QCMakeCacheModel* m = this->CacheValues->cacheModel();
- m->insertProperty(w->type(), w->name(), w->description(), w->value(), false);
+ m->insertProperty(w->type(), w->name(), w->description(), w->value(),
+ false);
// only add variable names to the completion which are new
- if (!this->AddVariableNames.contains(w->name()))
- {
+ if (!this->AddVariableNames.contains(w->name())) {
this->AddVariableNames << w->name();
this->AddVariableTypes << w->typeString();
// limit to at most 100 completion items
- if (this->AddVariableNames.size() > 100)
- {
+ if (this->AddVariableNames.size() > 100) {
this->AddVariableNames.removeFirst();
this->AddVariableTypes.removeFirst();
- }
+ }
// make sure CMAKE_INSTALL_PREFIX is always there
- if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX"))
- {
+ if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) {
this->AddVariableNames << "CMAKE_INSTALL_PREFIX";
this->AddVariableTypes << "PATH";
- }
+ }
QSettings settings;
settings.beginGroup("Settings/StartPath");
settings.setValue("AddVariableNames", this->AddVariableNames);
settings.setValue("AddVariableTypes", this->AddVariableTypes);
- }
}
+ }
}
void CMakeSetupDialog::startSearch()
@@ -1137,18 +1080,19 @@ void CMakeSetupDialog::startSearch()
void CMakeSetupDialog::setDebugOutput(bool flag)
{
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
- "setDebugOutput", Qt::QueuedConnection, Q_ARG(bool, flag));
+ "setDebugOutput", Qt::QueuedConnection,
+ Q_ARG(bool, flag));
}
void CMakeSetupDialog::setGroupedView(bool v)
{
- this->CacheValues->cacheModel()->setViewType(v ? QCMakeCacheModel::GroupView : QCMakeCacheModel::FlatView);
+ this->CacheValues->cacheModel()->setViewType(v ? QCMakeCacheModel::GroupView
+ : QCMakeCacheModel::FlatView);
this->CacheValues->setRootIsDecorated(v);
QSettings settings;
settings.beginGroup("Settings/StartPath");
settings.setValue("GroupView", v);
-
}
void CMakeSetupDialog::setAdvancedView(bool v)
@@ -1162,7 +1106,8 @@ void CMakeSetupDialog::setAdvancedView(bool v)
void CMakeSetupDialog::showUserChanges()
{
QSet<QCMakeProperty> changes =
- qobject_cast<QCMakeCacheModelDelegate*>(this->CacheValues->itemDelegate())->changes();
+ qobject_cast<QCMakeCacheModelDelegate*>(this->CacheValues->itemDelegate())
+ ->changes();
QDialog dialog(this);
dialog.setWindowTitle(tr("My Changes"));
@@ -1171,19 +1116,17 @@ void CMakeSetupDialog::showUserChanges()
QTextEdit* textedit = new QTextEdit(&dialog);
textedit->setReadOnly(true);
l->addWidget(textedit);
- QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Close,
- Qt::Horizontal, &dialog);
+ QDialogButtonBox* btns =
+ new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
QObject::connect(btns, SIGNAL(rejected()), &dialog, SLOT(accept()));
l->addWidget(btns);
QString command;
QString cache;
- foreach(QCMakeProperty prop, changes)
- {
+ foreach (QCMakeProperty prop, changes) {
QString type;
- switch(prop.Type)
- {
+ switch (prop.Type) {
case QCMakeProperty::BOOL:
type = "BOOL";
break;
@@ -1196,16 +1139,13 @@ void CMakeSetupDialog::showUserChanges()
case QCMakeProperty::STRING:
type = "STRING";
break;
- }
+ }
QString value;
- if(prop.Type == QCMakeProperty::BOOL)
- {
+ if (prop.Type == QCMakeProperty::BOOL) {
value = prop.Value.toBool() ? "1" : "0";
- }
- else
- {
+ } else {
value = prop.Value.toString();
- }
+ }
QString line("%1:%2=");
line = line.arg(prop.Key);
@@ -1213,7 +1153,7 @@ void CMakeSetupDialog::showUserChanges()
command += QString("-D%1\"%2\" ").arg(line).arg(value);
cache += QString("%1%2\n").arg(line).arg(value);
- }
+ }
textedit->append(tr("Commandline options:"));
textedit->append(command);
@@ -1230,20 +1170,20 @@ void CMakeSetupDialog::setSearchFilter(const QString& str)
this->CacheValues->setSearchFilter(str);
}
-void CMakeSetupDialog::doOutputContextMenu(const QPoint &pt)
+void CMakeSetupDialog::doOutputContextMenu(const QPoint& pt)
{
- QMenu *menu = this->Output->createStandardContextMenu();
+ QMenu* menu = this->Output->createStandardContextMenu();
menu->addSeparator();
- menu->addAction(tr("Find..."),
- this, SLOT(doOutputFindDialog()), QKeySequence::Find);
- menu->addAction(tr("Find Next"),
- this, SLOT(doOutputFindNext()), QKeySequence::FindNext);
- menu->addAction(tr("Find Previous"),
- this, SLOT(doOutputFindPrev()), QKeySequence::FindPrevious);
+ menu->addAction(tr("Find..."), this, SLOT(doOutputFindDialog()),
+ QKeySequence::Find);
+ menu->addAction(tr("Find Next"), this, SLOT(doOutputFindNext()),
+ QKeySequence::FindNext);
+ menu->addAction(tr("Find Previous"), this, SLOT(doOutputFindPrev()),
+ QKeySequence::FindPrevious);
menu->addSeparator();
- menu->addAction(tr("Goto Next Error"),
- this, SLOT(doOutputErrorNext()), QKeySequence(Qt::Key_F8));
+ menu->addAction(tr("Goto Next Error"), this, SLOT(doOutputErrorNext()),
+ QKeySequence(Qt::Key_F8));
menu->exec(this->Output->mapToGlobal(pt));
delete menu;
@@ -1254,24 +1194,20 @@ void CMakeSetupDialog::doOutputFindDialog()
QStringList strings(this->FindHistory);
QString selection = this->Output->textCursor().selectedText();
- if (!selection.isEmpty() &&
- !selection.contains(QChar::ParagraphSeparator) &&
- !selection.contains(QChar::LineSeparator))
- {
+ if (!selection.isEmpty() && !selection.contains(QChar::ParagraphSeparator) &&
+ !selection.contains(QChar::LineSeparator)) {
strings.push_front(selection);
- }
+ }
bool ok;
QString search = QInputDialog::getItem(this, tr("Find in Output"),
tr("Find:"), strings, 0, true, &ok);
- if (ok && !search.isEmpty())
- {
- if (!this->FindHistory.contains(search))
- {
+ if (ok && !search.isEmpty()) {
+ if (!this->FindHistory.contains(search)) {
this->FindHistory.push_front(search);
- }
- doOutputFindNext();
}
+ doOutputFindNext();
+ }
}
void CMakeSetupDialog::doRegexExplorerDialog()
@@ -1287,37 +1223,33 @@ void CMakeSetupDialog::doOutputFindPrev()
void CMakeSetupDialog::doOutputFindNext(bool directionForward)
{
- if (this->FindHistory.isEmpty())
- {
- doOutputFindDialog(); //will re-call this function again
+ if (this->FindHistory.isEmpty()) {
+ doOutputFindDialog(); // will re-call this function again
return;
- }
+ }
QString search = this->FindHistory.front();
QTextCursor textCursor = this->Output->textCursor();
QTextDocument* document = this->Output->document();
QTextDocument::FindFlags flags;
- if (!directionForward)
- {
+ if (!directionForward) {
flags |= QTextDocument::FindBackward;
- }
+ }
textCursor = document->find(search, textCursor, flags);
- if (textCursor.isNull())
- {
+ if (textCursor.isNull()) {
// first search found nothing, wrap around and search again
textCursor = this->Output->textCursor();
textCursor.movePosition(directionForward ? QTextCursor::Start
: QTextCursor::End);
textCursor = document->find(search, textCursor, flags);
- }
+ }
- if (textCursor.hasSelection())
- {
+ if (textCursor.hasSelection()) {
this->Output->setTextCursor(textCursor);
- }
+ }
}
void CMakeSetupDialog::doOutputErrorNext()
@@ -1326,36 +1258,31 @@ void CMakeSetupDialog::doOutputErrorNext()
bool atEnd = false;
// move cursor out of current error-block
- if (textCursor.blockCharFormat() == this->ErrorFormat)
- {
+ if (textCursor.blockCharFormat() == this->ErrorFormat) {
atEnd = !textCursor.movePosition(QTextCursor::NextBlock);
- }
+ }
// move cursor to next error-block
- while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd)
- {
+ while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd) {
atEnd = !textCursor.movePosition(QTextCursor::NextBlock);
- }
+ }
- if (atEnd)
- {
+ if (atEnd) {
// first search found nothing, wrap around and search again
atEnd = !textCursor.movePosition(QTextCursor::Start);
// move cursor to next error-block
- while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd)
- {
+ while (textCursor.blockCharFormat() != this->ErrorFormat && !atEnd) {
atEnd = !textCursor.movePosition(QTextCursor::NextBlock);
- }
}
+ }
- if (!atEnd)
- {
+ if (!atEnd) {
textCursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
QTextCharFormat selectionFormat;
selectionFormat.setBackground(Qt::yellow);
- QTextEdit::ExtraSelection extraSelection = {textCursor, selectionFormat};
+ QTextEdit::ExtraSelection extraSelection = { textCursor, selectionFormat };
this->Output->setExtraSelections(QList<QTextEdit::ExtraSelection>()
<< extraSelection);
@@ -1365,7 +1292,7 @@ void CMakeSetupDialog::doOutputErrorNext()
// remove the selection to see the extraSelection
textCursor.setPosition(textCursor.anchor());
this->Output->setTextCursor(textCursor);
- }
+ }
}
void CMakeSetupDialog::doWarningMessagesDialog()
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index f9624d1..2a4ea7a 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -78,7 +78,7 @@ protected slots:
bool doConfigureInternal();
bool doGenerateInternal();
void exitLoop(int);
- void doOutputContextMenu(const QPoint &);
+ void doOutputContextMenu(const QPoint&);
void doOutputFindDialog();
void doOutputFindNext(bool directionForward = true);
void doOutputFindPrev();
@@ -88,8 +88,14 @@ protected slots:
void doWarningMessagesDialog();
protected:
-
- enum State { Interrupting, ReadyConfigure, ReadyGenerate, Configuring, Generating };
+ enum State
+ {
+ Interrupting,
+ ReadyConfigure,
+ ReadyGenerate,
+ Configuring,
+ Generating
+ };
void enterState(State s);
void closeEvent(QCloseEvent*);
diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h
index ee89886..bdb1962 100644
--- a/Source/QtDialog/Compilers.h
+++ b/Source/QtDialog/Compilers.h
@@ -11,12 +11,11 @@ class Compilers : public QWidget, public Ui::Compilers
{
Q_OBJECT
public:
- Compilers(QWidget* p=NULL) :
- QWidget(p)
+ Compilers(QWidget* p = NULL)
+ : QWidget(p)
{
this->setupUi(this);
}
};
#endif
-
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx
index 5c0af2b..ca5e3b5 100644
--- a/Source/QtDialog/FirstConfigure.cxx
+++ b/Source/QtDialog/FirstConfigure.cxx
@@ -8,7 +8,6 @@
#include <QSettings>
#include <QVBoxLayout>
-
StartCompilerSetup::StartCompilerSetup(QWidget* p)
: QWizardPage(p)
{
@@ -23,10 +22,14 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
l->addSpacing(6);
- this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this);
- this->CompilerSetupOptions[1] = new QRadioButton(tr("Specify native compilers"), this);
- this->CompilerSetupOptions[2] = new QRadioButton(tr("Specify toolchain file for cross-compiling"), this);
- this->CompilerSetupOptions[3] = new QRadioButton(tr("Specify options for cross-compiling"), this);
+ this->CompilerSetupOptions[0] =
+ new QRadioButton(tr("Use default native compilers"), this);
+ this->CompilerSetupOptions[1] =
+ new QRadioButton(tr("Specify native compilers"), this);
+ this->CompilerSetupOptions[2] =
+ new QRadioButton(tr("Specify toolchain file for cross-compiling"), this);
+ this->CompilerSetupOptions[3] =
+ new QRadioButton(tr("Specify options for cross-compiling"), this);
l->addWidget(this->CompilerSetupOptions[0]);
l->addWidget(this->CompilerSetupOptions[1]);
l->addWidget(this->CompilerSetupOptions[2]);
@@ -34,17 +37,17 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p)
this->CompilerSetupOptions[0]->setChecked(true);
- QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)),
- this, SLOT(onSelectionChanged(bool)));
- QObject::connect(this->CompilerSetupOptions[1], SIGNAL(toggled(bool)),
- this, SLOT(onSelectionChanged(bool)));
- QObject::connect(this->CompilerSetupOptions[2], SIGNAL(toggled(bool)),
- this, SLOT(onSelectionChanged(bool)));
- QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)),
- this, SLOT(onSelectionChanged(bool)));
+ QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)), this,
+ SLOT(onSelectionChanged(bool)));
+ QObject::connect(this->CompilerSetupOptions[1], SIGNAL(toggled(bool)), this,
+ SLOT(onSelectionChanged(bool)));
+ QObject::connect(this->CompilerSetupOptions[2], SIGNAL(toggled(bool)), this,
+ SLOT(onSelectionChanged(bool)));
+ QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this,
+ SLOT(onSelectionChanged(bool)));
QObject::connect(GeneratorOptions,
- SIGNAL(currentIndexChanged(QString const&)),
- this, SLOT(onGeneratorChanged(QString const&)));
+ SIGNAL(currentIndexChanged(QString const&)), this,
+ SLOT(onGeneratorChanged(QString const&)));
}
QFrame* StartCompilerSetup::CreateToolsetWidgets()
@@ -74,16 +77,14 @@ void StartCompilerSetup::setGenerators(
QStringList generator_list;
std::vector<cmake::GeneratorInfo>::const_iterator it;
- for (it = gens.begin(); it != gens.end(); ++it)
- {
+ for (it = gens.begin(); it != gens.end(); ++it) {
generator_list.append(QString::fromLocal8Bit(it->name.c_str()));
- if (it->supportsToolset)
- {
+ if (it->supportsToolset) {
this->GeneratorsSupportingToolset.append(
QString::fromLocal8Bit(it->name.c_str()));
- }
}
+ }
this->GeneratorOptions->addItems(generator_list);
}
@@ -91,8 +92,7 @@ void StartCompilerSetup::setGenerators(
void StartCompilerSetup::setCurrentGenerator(const QString& gen)
{
int idx = this->GeneratorOptions->findText(gen);
- if(idx != -1)
- {
+ if (idx != -1) {
this->GeneratorOptions->setCurrentIndex(idx);
}
}
@@ -129,29 +129,26 @@ bool StartCompilerSetup::crossCompilerSetup() const
void StartCompilerSetup::onSelectionChanged(bool on)
{
- if(on)
+ if (on)
selectionChanged();
}
void StartCompilerSetup::onGeneratorChanged(QString const& name)
{
- if (GeneratorsSupportingToolset.contains(name))
- {
+ if (GeneratorsSupportingToolset.contains(name)) {
ToolsetFrame->show();
- }
- else
- {
+ } else {
ToolsetFrame->hide();
- }
+ }
}
int StartCompilerSetup::nextId() const
{
- if(compilerSetup())
+ if (compilerSetup())
return NativeSetup;
- if(crossCompilerSetup())
+ if (crossCompilerSetup())
return CrossSetup;
- if(crossCompilerToolChainFile())
+ if (crossCompilerToolChainFile())
return ToolchainSetup;
return -1;
}
@@ -199,7 +196,6 @@ void NativeCompilerSetup::setFortranCompiler(const QString& s)
this->FortranCompiler->setText(s);
}
-
CrossCompilerSetup::CrossCompilerSetup(QWidget* p)
: QWizardPage(p)
{
@@ -208,7 +204,8 @@ CrossCompilerSetup::CrossCompilerSetup(QWidget* p)
QWidget::setTabOrder(systemVersion, systemProcessor);
QWidget::setTabOrder(systemProcessor, CrossCompilers->CCompiler);
QWidget::setTabOrder(CrossCompilers->CCompiler, CrossCompilers->CXXCompiler);
- QWidget::setTabOrder(CrossCompilers->CXXCompiler, CrossCompilers->FortranCompiler);
+ QWidget::setTabOrder(CrossCompilers->CXXCompiler,
+ CrossCompilers->FortranCompiler);
QWidget::setTabOrder(CrossCompilers->FortranCompiler, crossFindRoot);
QWidget::setTabOrder(crossFindRoot, crossProgramMode);
QWidget::setTabOrder(crossProgramMode, crossLibraryMode);
@@ -273,7 +270,6 @@ void CrossCompilerSetup::setSystem(const QString& t)
this->systemName->setText(t);
}
-
QString CrossCompilerSetup::getVersion() const
{
return this->systemVersion->text();
@@ -284,7 +280,6 @@ void CrossCompilerSetup::setVersion(const QString& t)
this->systemVersion->setText(t);
}
-
QString CrossCompilerSetup::getProcessor() const
{
return this->systemProcessor->text();
@@ -358,11 +353,9 @@ void ToolchainCompilerSetup::setToolchainFile(const QString& t)
this->ToolchainFile->setText(t);
}
-
-
FirstConfigure::FirstConfigure()
{
- //this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true);
+ // this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true);
this->mStartCompilerSetupPage = new StartCompilerSetup(this);
this->setPage(Start, this->mStartCompilerSetupPage);
QObject::connect(this->mStartCompilerSetupPage, SIGNAL(selectionChanged()),
@@ -409,24 +402,38 @@ void FirstConfigure::loadFromSettings()
// restore compiler setup
settings.beginGroup("Settings/Compiler");
- this->mNativeCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString());
- this->mNativeCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString());
- this->mNativeCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString());
+ this->mNativeCompilerSetupPage->setCCompiler(
+ settings.value("CCompiler").toString());
+ this->mNativeCompilerSetupPage->setCXXCompiler(
+ settings.value("CXXCompiler").toString());
+ this->mNativeCompilerSetupPage->setFortranCompiler(
+ settings.value("FortranCompiler").toString());
settings.endGroup();
// restore cross compiler setup
settings.beginGroup("Settings/CrossCompiler");
- this->mCrossCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString());
- this->mCrossCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString());
- this->mCrossCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString());
- this->mToolchainCompilerSetupPage->setToolchainFile(settings.value("ToolChainFile").toString());
- this->mCrossCompilerSetupPage->setSystem(settings.value("SystemName").toString());
- this->mCrossCompilerSetupPage->setVersion(settings.value("SystemVersion").toString());
- this->mCrossCompilerSetupPage->setProcessor(settings.value("SystemProcessor").toString());
- this->mCrossCompilerSetupPage->setFindRoot(settings.value("FindRoot").toString());
- this->mCrossCompilerSetupPage->setProgramMode(settings.value("ProgramMode", 0).toInt());
- this->mCrossCompilerSetupPage->setLibraryMode(settings.value("LibraryMode", 0).toInt());
- this->mCrossCompilerSetupPage->setIncludeMode(settings.value("IncludeMode", 0).toInt());
+ this->mCrossCompilerSetupPage->setCCompiler(
+ settings.value("CCompiler").toString());
+ this->mCrossCompilerSetupPage->setCXXCompiler(
+ settings.value("CXXCompiler").toString());
+ this->mCrossCompilerSetupPage->setFortranCompiler(
+ settings.value("FortranCompiler").toString());
+ this->mToolchainCompilerSetupPage->setToolchainFile(
+ settings.value("ToolChainFile").toString());
+ this->mCrossCompilerSetupPage->setSystem(
+ settings.value("SystemName").toString());
+ this->mCrossCompilerSetupPage->setVersion(
+ settings.value("SystemVersion").toString());
+ this->mCrossCompilerSetupPage->setProcessor(
+ settings.value("SystemProcessor").toString());
+ this->mCrossCompilerSetupPage->setFindRoot(
+ settings.value("FindRoot").toString());
+ this->mCrossCompilerSetupPage->setProgramMode(
+ settings.value("ProgramMode", 0).toInt());
+ this->mCrossCompilerSetupPage->setLibraryMode(
+ settings.value("LibraryMode", 0).toInt());
+ this->mCrossCompilerSetupPage->setIncludeMode(
+ settings.value("IncludeMode", 0).toInt());
settings.endGroup();
}
@@ -442,24 +449,35 @@ void FirstConfigure::saveToSettings()
// save compiler setup
settings.beginGroup("Settings/Compiler");
- settings.setValue("CCompiler", this->mNativeCompilerSetupPage->getCCompiler());
- settings.setValue("CXXCompiler", this->mNativeCompilerSetupPage->getCXXCompiler());
- settings.setValue("FortranCompiler", this->mNativeCompilerSetupPage->getFortranCompiler());
+ settings.setValue("CCompiler",
+ this->mNativeCompilerSetupPage->getCCompiler());
+ settings.setValue("CXXCompiler",
+ this->mNativeCompilerSetupPage->getCXXCompiler());
+ settings.setValue("FortranCompiler",
+ this->mNativeCompilerSetupPage->getFortranCompiler());
settings.endGroup();
// save cross compiler setup
settings.beginGroup("Settings/CrossCompiler");
- settings.setValue("CCompiler", this->mCrossCompilerSetupPage->getCCompiler());
- settings.setValue("CXXCompiler", this->mCrossCompilerSetupPage->getCXXCompiler());
- settings.setValue("FortranCompiler", this->mCrossCompilerSetupPage->getFortranCompiler());
+ settings.setValue("CCompiler",
+ this->mCrossCompilerSetupPage->getCCompiler());
+ settings.setValue("CXXCompiler",
+ this->mCrossCompilerSetupPage->getCXXCompiler());
+ settings.setValue("FortranCompiler",
+ this->mCrossCompilerSetupPage->getFortranCompiler());
settings.setValue("ToolChainFile", this->getCrossCompilerToolChainFile());
settings.setValue("SystemName", this->mCrossCompilerSetupPage->getSystem());
- settings.setValue("SystemVersion", this->mCrossCompilerSetupPage->getVersion());
- settings.setValue("SystemProcessor", this->mCrossCompilerSetupPage->getProcessor());
+ settings.setValue("SystemVersion",
+ this->mCrossCompilerSetupPage->getVersion());
+ settings.setValue("SystemProcessor",
+ this->mCrossCompilerSetupPage->getProcessor());
settings.setValue("FindRoot", this->mCrossCompilerSetupPage->getFindRoot());
- settings.setValue("ProgramMode", this->mCrossCompilerSetupPage->getProgramMode());
- settings.setValue("LibraryMode", this->mCrossCompilerSetupPage->getLibraryMode());
- settings.setValue("IncludeMode", this->mCrossCompilerSetupPage->getIncludeMode());
+ settings.setValue("ProgramMode",
+ this->mCrossCompilerSetupPage->getProgramMode());
+ settings.setValue("LibraryMode",
+ this->mCrossCompilerSetupPage->getLibraryMode());
+ settings.setValue("IncludeMode",
+ this->mCrossCompilerSetupPage->getIncludeMode());
settings.endGroup();
}
@@ -495,44 +513,34 @@ QString FirstConfigure::getSystemName() const
QString FirstConfigure::getCCompiler() const
{
- if(this->compilerSetup())
- {
+ if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCCompiler();
- }
- else if(this->crossCompilerSetup())
- {
+ } else if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCCompiler();
- }
+ }
return QString();
}
QString FirstConfigure::getCXXCompiler() const
{
- if(this->compilerSetup())
- {
+ if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCXXCompiler();
- }
- else if(this->crossCompilerSetup())
- {
+ } else if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCXXCompiler();
- }
+ }
return QString();
}
QString FirstConfigure::getFortranCompiler() const
{
- if(this->compilerSetup())
- {
+ if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getFortranCompiler();
- }
- else if(this->crossCompilerSetup())
- {
+ } else if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getFortranCompiler();
- }
+ }
return QString();
}
-
QString FirstConfigure::getSystemVersion() const
{
return this->mCrossCompilerSetupPage->getVersion();
@@ -548,12 +556,7 @@ QString FirstConfigure::getCrossRoot() const
return this->mCrossCompilerSetupPage->getFindRoot();
}
-const QString CrossModes[] =
-{
- "BOTH",
- "ONLY",
- "NEVER"
-};
+const QString CrossModes[] = { "BOTH", "ONLY", "NEVER" };
QString FirstConfigure::getCrossProgramMode() const
{
@@ -569,4 +572,3 @@ QString FirstConfigure::getCrossIncludeMode() const
{
return CrossModes[this->mCrossCompilerSetupPage->getIncludeMode()];
}
-
diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h
index 3c574d4..c467ddb 100644
--- a/Source/QtDialog/FirstConfigure.h
+++ b/Source/QtDialog/FirstConfigure.h
@@ -23,125 +23,126 @@ enum FirstConfigurePages
Done
};
-//! the first page that gives basic options for what compilers setup to choose from
+//! the first page that gives basic options for what compilers setup to choose
+//! from
class StartCompilerSetup : public QWizardPage
{
Q_OBJECT
- public:
- StartCompilerSetup(QWidget* p);
- ~StartCompilerSetup();
- void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
- void setCurrentGenerator(const QString& gen);
- QString getGenerator() const;
- QString getToolset() const;
-
- bool defaultSetup() const;
- bool compilerSetup() const;
- bool crossCompilerSetup() const;
- bool crossCompilerToolChainFile() const;
-
- int nextId() const;
-
- signals:
- void selectionChanged();
-
- protected slots:
- void onSelectionChanged(bool);
- void onGeneratorChanged(QString const& name);
-
- protected:
- QComboBox* GeneratorOptions;
- QRadioButton* CompilerSetupOptions[4];
- QFrame* ToolsetFrame;
- QLineEdit* Toolset;
- QLabel* ToolsetLabel;
- QStringList GeneratorsSupportingToolset;
-
- private:
- QFrame* CreateToolsetWidgets();
+public:
+ StartCompilerSetup(QWidget* p);
+ ~StartCompilerSetup();
+ void setGenerators(std::vector<cmake::GeneratorInfo> const& gens);
+ void setCurrentGenerator(const QString& gen);
+ QString getGenerator() const;
+ QString getToolset() const;
+
+ bool defaultSetup() const;
+ bool compilerSetup() const;
+ bool crossCompilerSetup() const;
+ bool crossCompilerToolChainFile() const;
+
+ int nextId() const;
+
+signals:
+ void selectionChanged();
+
+protected slots:
+ void onSelectionChanged(bool);
+ void onGeneratorChanged(QString const& name);
+
+protected:
+ QComboBox* GeneratorOptions;
+ QRadioButton* CompilerSetupOptions[4];
+ QFrame* ToolsetFrame;
+ QLineEdit* Toolset;
+ QLabel* ToolsetLabel;
+ QStringList GeneratorsSupportingToolset;
+
+private:
+ QFrame* CreateToolsetWidgets();
};
//! the page that gives basic options for native compilers
class NativeCompilerSetup : public QWizardPage, protected Ui::Compilers
{
Q_OBJECT
- public:
- NativeCompilerSetup(QWidget* p);
- ~NativeCompilerSetup();
+public:
+ NativeCompilerSetup(QWidget* p);
+ ~NativeCompilerSetup();
- QString getCCompiler() const;
- void setCCompiler(const QString&);
+ QString getCCompiler() const;
+ void setCCompiler(const QString&);
- QString getCXXCompiler() const;
- void setCXXCompiler(const QString&);
+ QString getCXXCompiler() const;
+ void setCXXCompiler(const QString&);
- QString getFortranCompiler() const;
- void setFortranCompiler(const QString&);
+ QString getFortranCompiler() const;
+ void setFortranCompiler(const QString&);
- int nextId() const { return -1; }
+ int nextId() const { return -1; }
};
//! the page that gives options for cross compilers
class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler
{
Q_OBJECT
- public:
- CrossCompilerSetup(QWidget* p);
- ~CrossCompilerSetup();
-
- QString getSystem() const;
- void setSystem(const QString&);
-
- QString getVersion() const;
- void setVersion(const QString&);
-
- QString getProcessor() const;
- void setProcessor(const QString&);
-
- QString getCCompiler() const;
- void setCCompiler(const QString&);
+public:
+ CrossCompilerSetup(QWidget* p);
+ ~CrossCompilerSetup();
- QString getCXXCompiler() const;
- void setCXXCompiler(const QString&);
+ QString getSystem() const;
+ void setSystem(const QString&);
- QString getFortranCompiler() const;
- void setFortranCompiler(const QString&);
+ QString getVersion() const;
+ void setVersion(const QString&);
- QString getFindRoot() const;
- void setFindRoot(const QString&);
+ QString getProcessor() const;
+ void setProcessor(const QString&);
- enum CrossMode
- {
- BOTH,
- ONLY,
- NEVER
- };
+ QString getCCompiler() const;
+ void setCCompiler(const QString&);
- int getProgramMode() const;
- void setProgramMode(int);
- int getLibraryMode() const;
- void setLibraryMode(int);
- int getIncludeMode() const;
- void setIncludeMode(int);
+ QString getCXXCompiler() const;
+ void setCXXCompiler(const QString&);
- int nextId() const { return -1; }
+ QString getFortranCompiler() const;
+ void setFortranCompiler(const QString&);
+
+ QString getFindRoot() const;
+ void setFindRoot(const QString&);
+
+ enum CrossMode
+ {
+ BOTH,
+ ONLY,
+ NEVER
+ };
+
+ int getProgramMode() const;
+ void setProgramMode(int);
+ int getLibraryMode() const;
+ void setLibraryMode(int);
+ int getIncludeMode() const;
+ void setIncludeMode(int);
+
+ int nextId() const { return -1; }
};
//! the page that gives options for a toolchain file
class ToolchainCompilerSetup : public QWizardPage
{
Q_OBJECT
- public:
- ToolchainCompilerSetup(QWidget* p);
- ~ToolchainCompilerSetup();
+public:
+ ToolchainCompilerSetup(QWidget* p);
+ ~ToolchainCompilerSetup();
- QString toolchainFile() const;
- void setToolchainFile(const QString&);
+ QString toolchainFile() const;
+ void setToolchainFile(const QString&);
- int nextId() const { return -1; }
+ int nextId() const { return -1; }
- protected:
- QCMakeFilePathEditor* ToolchainFile;
+protected:
+ QCMakeFilePathEditor* ToolchainFile;
};
//! the wizard with the pages
@@ -183,8 +184,6 @@ protected:
NativeCompilerSetup* mNativeCompilerSetupPage;
CrossCompilerSetup* mCrossCompilerSetupPage;
ToolchainCompilerSetup* mToolchainCompilerSetupPage;
-
};
#endif // FirstConfigure_h
-
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 28be341..c84e153 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -20,7 +20,7 @@
#include "cmSystemTools.h"
#ifdef Q_OS_WIN
-#include "qt_windows.h" // For SetErrorMode
+#include "qt_windows.h" // For SetErrorMode
#endif
QCMake::QCMake(QObject* p)
@@ -48,26 +48,24 @@ QCMake::QCMake(QObject* p)
this->CMakeInstance->GetRegisteredGenerators(generators);
std::vector<cmake::GeneratorInfo>::const_iterator it;
- for(it = generators.begin(); it != generators.end(); ++it)
- {
+ for (it = generators.begin(); it != generators.end(); ++it) {
// Skip the generator "KDevelop3", since there is also
// "KDevelop3 - Unix Makefiles", which is the full and official name.
// The short name is actually only still there since this was the name
// in CMake 2.4, to keep "command line argument compatibility", but
// this is not necessary in the GUI.
- if (it->name == "KDevelop3")
- {
+ if (it->name == "KDevelop3") {
continue;
- }
+ }
this->AvailableGenerators.push_back(*it);
- }
+ }
}
QCMake::~QCMake()
{
delete this->CMakeInstance;
- //cmDynamicLoader::FlushCache();
+ // cmDynamicLoader::FlushCache();
}
void QCMake::loadCache(const QString& dir)
@@ -77,80 +75,73 @@ void QCMake::loadCache(const QString& dir)
void QCMake::setSourceDirectory(const QString& _dir)
{
- QString dir =
- QString::fromLocal8Bit(cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
- if(this->SourceDirectory != dir)
- {
+ QString dir = QString::fromLocal8Bit(
+ cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
+ if (this->SourceDirectory != dir) {
this->SourceDirectory = QDir::fromNativeSeparators(dir);
emit this->sourceDirChanged(this->SourceDirectory);
- }
+ }
}
void QCMake::setBinaryDirectory(const QString& _dir)
{
- QString dir =
- QString::fromLocal8Bit(cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
- if(this->BinaryDirectory != dir)
- {
+ QString dir = QString::fromLocal8Bit(
+ cmSystemTools::GetActualCaseForPath(_dir.toLocal8Bit().data()).c_str());
+ if (this->BinaryDirectory != dir) {
this->BinaryDirectory = QDir::fromNativeSeparators(dir);
emit this->binaryDirChanged(this->BinaryDirectory);
cmState* state = this->CMakeInstance->GetState();
this->setGenerator(QString());
this->setToolset(QString());
- if(!this->CMakeInstance->LoadCache(
- this->BinaryDirectory.toLocal8Bit().data()))
- {
+ if (!this->CMakeInstance->LoadCache(
+ this->BinaryDirectory.toLocal8Bit().data())) {
QDir testDir(this->BinaryDirectory);
- if(testDir.exists("CMakeCache.txt"))
- {
- cmSystemTools::Error("There is a CMakeCache.txt file for the current binary "
- "tree but cmake does not have permission to read it. "
- "Please check the permissions of the directory you are trying to run CMake on.");
- }
+ if (testDir.exists("CMakeCache.txt")) {
+ cmSystemTools::Error(
+ "There is a CMakeCache.txt file for the current binary "
+ "tree but cmake does not have permission to read it. "
+ "Please check the permissions of the directory you are trying to "
+ "run CMake on.");
}
+ }
QCMakePropertyList props = this->properties();
emit this->propertiesChanged(props);
const char* homeDir = state->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
- if (homeDir)
- {
+ if (homeDir) {
setSourceDirectory(QString::fromLocal8Bit(homeDir));
- }
+ }
const char* gen = state->GetCacheEntryValue("CMAKE_GENERATOR");
- if (gen)
- {
- const char* extraGen = state
- ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
- std::string curGen = cmExternalMakefileProjectGenerator::
- CreateFullGeneratorName(gen, extraGen? extraGen : "");
+ if (gen) {
+ const char* extraGen =
+ state->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
+ std::string curGen =
+ cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
+ gen, extraGen ? extraGen : "");
this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
- }
+ }
const char* toolset = state->GetCacheEntryValue("CMAKE_GENERATOR_TOOLSET");
- if (toolset)
- {
+ if (toolset) {
this->setToolset(QString::fromLocal8Bit(toolset));
- }
}
+ }
}
-
void QCMake::setGenerator(const QString& gen)
{
- if(this->Generator != gen)
- {
+ if (this->Generator != gen) {
this->Generator = gen;
emit this->generatorChanged(this->Generator);
- }
+ }
}
void QCMake::setToolset(const QString& toolset)
{
- if(this->Toolset != toolset)
- {
+ if (this->Toolset != toolset) {
this->Toolset = toolset;
emit this->toolsetChanged(this->Toolset);
- }
+ }
}
void QCMake::configure()
@@ -159,10 +150,13 @@ void QCMake::configure()
UINT lastErrorMode = SetErrorMode(0);
#endif
- this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data());
- this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data());
+ this->CMakeInstance->SetHomeDirectory(
+ this->SourceDirectory.toLocal8Bit().data());
+ this->CMakeInstance->SetHomeOutputDirectory(
+ this->BinaryDirectory.toLocal8Bit().data());
this->CMakeInstance->SetGlobalGenerator(
- this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data()));
+ this->CMakeInstance->CreateGlobalGenerator(
+ this->Generator.toLocal8Bit().data()));
this->CMakeInstance->SetGeneratorPlatform("");
this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data());
this->CMakeInstance->LoadCache();
@@ -210,82 +204,59 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
// set the value of properties
cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
- for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
- it != cacheKeys.end(); ++it)
- {
+ for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
+ it != cacheKeys.end(); ++it) {
cmState::CacheEntryType t = state->GetCacheEntryType(*it);
- if(t == cmState::INTERNAL ||
- t == cmState::STATIC)
- {
+ if (t == cmState::INTERNAL || t == cmState::STATIC) {
continue;
- }
+ }
QCMakeProperty prop;
prop.Key = QString::fromLocal8Bit(it->c_str());
int idx = props.indexOf(prop);
- if(idx == -1)
- {
+ if (idx == -1) {
toremove.append(QString::fromLocal8Bit(it->c_str()));
- }
- else
- {
+ } else {
prop = props[idx];
- if(prop.Value.type() == QVariant::Bool)
- {
+ if (prop.Value.type() == QVariant::Bool) {
state->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
- }
- else
- {
+ } else {
state->SetCacheEntryValue(*it,
- prop.Value.toString().toLocal8Bit().data());
- }
- props.removeAt(idx);
+ prop.Value.toString().toLocal8Bit().data());
}
-
+ props.removeAt(idx);
}
+ }
// remove some properites
- foreach(QString s, toremove)
- {
+ foreach (QString s, toremove) {
this->CMakeInstance->UnwatchUnusedCli(s.toLocal8Bit().data());
state->RemoveCacheEntry(s.toLocal8Bit().data());
- }
+ }
// add some new properites
- foreach(QCMakeProperty s, props)
- {
+ foreach (QCMakeProperty s, props) {
this->CMakeInstance->WatchUnusedCli(s.Key.toLocal8Bit().data());
- if(s.Type == QCMakeProperty::BOOL)
- {
- this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
- s.Value.toBool() ? "ON" : "OFF",
- s.Help.toLocal8Bit().data(),
- cmState::BOOL);
- }
- else if(s.Type == QCMakeProperty::STRING)
- {
- this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
- s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(),
- cmState::STRING);
- }
- else if(s.Type == QCMakeProperty::PATH)
- {
- this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
- s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(),
- cmState::PATH);
- }
- else if(s.Type == QCMakeProperty::FILEPATH)
- {
- this->CMakeInstance->AddCacheEntry(s.Key.toLocal8Bit().data(),
- s.Value.toString().toLocal8Bit().data(),
- s.Help.toLocal8Bit().data(),
- cmState::FILEPATH);
- }
+ if (s.Type == QCMakeProperty::BOOL) {
+ this->CMakeInstance->AddCacheEntry(
+ s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF",
+ s.Help.toLocal8Bit().data(), cmState::BOOL);
+ } else if (s.Type == QCMakeProperty::STRING) {
+ this->CMakeInstance->AddCacheEntry(
+ s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
+ s.Help.toLocal8Bit().data(), cmState::STRING);
+ } else if (s.Type == QCMakeProperty::PATH) {
+ this->CMakeInstance->AddCacheEntry(
+ s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
+ s.Help.toLocal8Bit().data(), cmState::PATH);
+ } else if (s.Type == QCMakeProperty::FILEPATH) {
+ this->CMakeInstance->AddCacheEntry(
+ s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(),
+ s.Help.toLocal8Bit().data(), cmState::FILEPATH);
}
+ }
this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
}
@@ -297,50 +268,39 @@ QCMakePropertyList QCMake::properties() const
cmState* state = this->CMakeInstance->GetState();
std::vector<std::string> cacheKeys = state->GetCacheEntryKeys();
for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
- i != cacheKeys.end(); ++i)
- {
+ i != cacheKeys.end(); ++i) {
cmState::CacheEntryType t = state->GetCacheEntryType(*i);
- if(t == cmState::INTERNAL ||
- t == cmState::STATIC ||
- t == cmState::UNINITIALIZED)
- {
+ if (t == cmState::INTERNAL || t == cmState::STATIC ||
+ t == cmState::UNINITIALIZED) {
continue;
- }
+ }
const char* cachedValue = state->GetCacheEntryValue(*i);
QCMakeProperty prop;
prop.Key = QString::fromLocal8Bit(i->c_str());
- prop.Help = QString::fromLocal8Bit(
- state->GetCacheEntryProperty(*i, "HELPSTRING"));
+ prop.Help =
+ QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING"));
prop.Value = QString::fromLocal8Bit(cachedValue);
prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
- if(t == cmState::BOOL)
- {
+ if (t == cmState::BOOL) {
prop.Type = QCMakeProperty::BOOL;
prop.Value = cmSystemTools::IsOn(cachedValue);
- }
- else if(t == cmState::PATH)
- {
+ } else if (t == cmState::PATH) {
prop.Type = QCMakeProperty::PATH;
- }
- else if(t == cmState::FILEPATH)
- {
+ } else if (t == cmState::FILEPATH) {
prop.Type = QCMakeProperty::FILEPATH;
- }
- else if(t == cmState::STRING)
- {
+ } else if (t == cmState::STRING) {
prop.Type = QCMakeProperty::STRING;
const char* stringsProperty =
- state->GetCacheEntryProperty(*i, "STRINGS");
- if (stringsProperty)
- {
+ state->GetCacheEntryProperty(*i, "STRINGS");
+ if (stringsProperty) {
prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
- }
}
+ }
ret.append(prop);
- }
+ }
return ret;
}
@@ -363,14 +323,11 @@ bool QCMake::interruptCallback(void* cd)
void QCMake::progressCallback(const char* msg, float percent, void* cd)
{
QCMake* self = reinterpret_cast<QCMake*>(cd);
- if(percent >= 0)
- {
+ if (percent >= 0) {
emit self->progressChanged(QString::fromLocal8Bit(msg), percent);
- }
- else
- {
+ } else {
emit self->outputMessage(QString::fromLocal8Bit(msg));
- }
+ }
QCoreApplication::processEvents();
}
@@ -385,14 +342,14 @@ void QCMake::messageCallback(const char* msg, const char* /*title*/,
void QCMake::stdoutCallback(const char* msg, size_t len, void* cd)
{
QCMake* self = reinterpret_cast<QCMake*>(cd);
- emit self->outputMessage(QString::fromLocal8Bit(msg,int(len)));
+ emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
QCoreApplication::processEvents();
}
void QCMake::stderrCallback(const char* msg, size_t len, void* cd)
{
QCMake* self = reinterpret_cast<QCMake*>(cd);
- emit self->outputMessage(QString::fromLocal8Bit(msg,int(len)));
+ emit self->outputMessage(QString::fromLocal8Bit(msg, int(len)));
QCoreApplication::processEvents();
}
@@ -443,11 +400,10 @@ void QCMake::reloadCache()
void QCMake::setDebugOutput(bool flag)
{
- if(flag != this->CMakeInstance->GetDebugOutput())
- {
+ if (flag != this->CMakeInstance->GetDebugOutput()) {
this->CMakeInstance->SetDebugOutputOn(flag);
emit this->debugOutputChanged(flag);
- }
+ }
}
bool QCMake::getDebugOutput() const
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index 5cae06d..a818c6b 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -16,8 +16,8 @@
#include "cmake.h"
#ifdef _MSC_VER
-#pragma warning ( disable : 4127 )
-#pragma warning ( disable : 4512 )
+#pragma warning(disable : 4127)
+#pragma warning(disable : 4512)
#endif
#include <vector>
@@ -34,7 +34,13 @@
/// Value is of type String or Bool
struct QCMakeProperty
{
- enum PropertyType { BOOL, PATH, FILEPATH, STRING };
+ enum PropertyType
+ {
+ BOOL,
+ PATH,
+ FILEPATH,
+ STRING
+ };
QString Key;
QVariant Value;
QStringList Strings;
@@ -42,13 +48,13 @@ struct QCMakeProperty
PropertyType Type;
bool Advanced;
bool operator==(const QCMakeProperty& other) const
- {
+ {
return this->Key == other.Key;
- }
+ }
bool operator<(const QCMakeProperty& other) const
- {
+ {
return this->Key < other.Key;
- }
+ }
};
// list of properties
@@ -65,7 +71,7 @@ class QCMake : public QObject
{
Q_OBJECT
public:
- QCMake(QObject* p=0);
+ QCMake(QObject* p = 0);
~QCMake();
public slots:
/// load the cache file in a directory
@@ -84,7 +90,8 @@ public slots:
void generate();
/// set the property values
void setProperties(const QCMakePropertyList&);
- /// interrupt the configure or generate process (if connecting, make a direct connection)
+ /// interrupt the configure or generate process (if connecting, make a direct
+ /// connection)
void interrupt();
/// delete the cache in binary directory
void deleteCache();
@@ -128,7 +135,8 @@ public:
bool getDebugOutput() const;
signals:
- /// signal when properties change (during read from disk or configure process)
+ /// signal when properties change (during read from disk or configure
+ /// process)
void propertiesChanged(const QCMakePropertyList& vars);
/// signal when the generator changes
void generatorChanged(const QString& gen);
@@ -157,8 +165,8 @@ protected:
static bool interruptCallback(void*);
static void progressCallback(const char* msg, float percent, void* cd);
- static void messageCallback(const char* msg, const char* title,
- bool&, void* cd);
+ static void messageCallback(const char* msg, const char* title, bool&,
+ void* cd);
static void stdoutCallback(const char* msg, size_t len, void* cd);
static void stderrCallback(const char* msg, size_t len, void* cd);
bool WarnUninitializedMode;
@@ -174,4 +182,3 @@ protected:
};
#endif // QCMake_h
-
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index f64a78a..cc1f4aa 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -27,46 +27,44 @@
class QCMakeSearchFilter : public QSortFilterProxyModel
{
public:
- QCMakeSearchFilter(QObject* o) : QSortFilterProxyModel(o) {}
+ QCMakeSearchFilter(QObject* o)
+ : QSortFilterProxyModel(o)
+ {
+ }
+
protected:
bool filterAcceptsRow(int row, const QModelIndex& p) const
- {
+ {
QStringList strs;
const QAbstractItemModel* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
// if there are no children, get strings for column 0 and 1
- if(!m->hasChildren(idx))
- {
+ if (!m->hasChildren(idx)) {
strs.append(m->data(idx).toString());
idx = m->index(row, 1, p);
strs.append(m->data(idx).toString());
- }
- else
- {
+ } else {
// get strings for children entries to compare with
// instead of comparing with the parent
int num = m->rowCount(idx);
- for(int i=0; i<num; i++)
- {
+ for (int i = 0; i < num; i++) {
QModelIndex tmpidx = m->index(i, 0, idx);
strs.append(m->data(tmpidx).toString());
tmpidx = m->index(i, 1, idx);
strs.append(m->data(tmpidx).toString());
- }
}
+ }
// check all strings for a match
- foreach(QString str, strs)
- {
- if(str.contains(this->filterRegExp()))
- {
+ foreach (QString str, strs) {
+ if (str.contains(this->filterRegExp())) {
return true;
- }
}
+ }
return false;
- }
+ }
};
// filter for searches
@@ -74,7 +72,10 @@ class QCMakeAdvancedFilter : public QSortFilterProxyModel
{
public:
QCMakeAdvancedFilter(QObject* o)
- : QSortFilterProxyModel(o), ShowAdvanced(false) {}
+ : QSortFilterProxyModel(o)
+ , ShowAdvanced(false)
+ {
+ }
void setShowAdvanced(bool f)
{
@@ -84,37 +85,32 @@ public:
bool showAdvanced() const { return this->ShowAdvanced; }
protected:
-
bool ShowAdvanced;
bool filterAcceptsRow(int row, const QModelIndex& p) const
- {
+ {
const QAbstractItemModel* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
// if there are no children
- if(!m->hasChildren(idx))
- {
+ if (!m->hasChildren(idx)) {
bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool();
- if(!adv || (adv && this->ShowAdvanced))
- {
+ if (!adv || (adv && this->ShowAdvanced)) {
return true;
- }
- return false;
}
+ return false;
+ }
// check children
int num = m->rowCount(idx);
- for(int i=0; i<num; i++)
- {
+ for (int i = 0; i < num; i++) {
bool accept = this->filterAcceptsRow(i, idx);
- if(accept)
- {
+ if (accept) {
return true;
- }
}
- return false;
}
+ return false;
+ }
};
QCMakeCacheView::QCMakeCacheView(QWidget* p)
@@ -147,10 +143,9 @@ QCMakeCacheView::QCMakeCacheView(QWidget* p)
bool QCMakeCacheView::event(QEvent* e)
{
- if(e->type() == QEvent::Show)
- {
- this->header()->setDefaultSectionSize(this->viewport()->width()/2);
- }
+ if (e->type() == QEvent::Show) {
+ this->header()->setDefaultSectionSize(this->viewport()->width() / 2);
+ }
return QTreeView::event(e);
}
@@ -160,17 +155,14 @@ QCMakeCacheModel* QCMakeCacheView::cacheModel() const
}
QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
- Qt::KeyboardModifiers mod)
+ Qt::KeyboardModifiers mod)
{
// want home/end to go to begin/end of rows, not columns
- if(act == MoveHome)
- {
+ if (act == MoveHome) {
return this->model()->index(0, 1);
- }
- else if(act == MoveEnd)
- {
- return this->model()->index(this->model()->rowCount()-1, 1);
- }
+ } else if (act == MoveEnd) {
+ return this->model()->index(this->model()->rowCount() - 1, 1);
+ }
return QTreeView::moveCursor(act, mod);
}
@@ -195,10 +187,10 @@ void QCMakeCacheView::setSearchFilter(const QString& s)
}
QCMakeCacheModel::QCMakeCacheModel(QObject* p)
- : QStandardItemModel(p),
- EditEnabled(true),
- NewPropertyCount(0),
- View(FlatView)
+ : QStandardItemModel(p)
+ , EditEnabled(true)
+ , NewPropertyCount(0)
+ , View(FlatView)
{
this->ShowNewProperties = true;
QStringList labels;
@@ -234,47 +226,39 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
{
QSet<QCMakeProperty> newProps, newProps2;
- if(this->ShowNewProperties)
- {
+ if (this->ShowNewProperties) {
newProps = props.toSet();
newProps2 = newProps;
QSet<QCMakeProperty> oldProps = this->properties().toSet();
oldProps.intersect(newProps);
newProps.subtract(oldProps);
newProps2.subtract(newProps);
- }
- else
- {
+ } else {
newProps2 = props.toSet();
- }
+ }
bool b = this->blockSignals(true);
this->clear();
this->NewPropertyCount = newProps.size();
- if(View == FlatView)
- {
+ if (View == FlatView) {
QCMakePropertyList newP = newProps.toList();
QCMakePropertyList newP2 = newProps2.toList();
qSort(newP);
qSort(newP2);
int row_count = 0;
- foreach(QCMakeProperty p, newP)
- {
+ foreach (QCMakeProperty p, newP) {
this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, true);
row_count++;
}
- foreach(QCMakeProperty p, newP2)
- {
+ foreach (QCMakeProperty p, newP2) {
this->insertRow(row_count);
this->setPropertyData(this->index(row_count, 0), p, false);
row_count++;
}
- }
- else if(this->View == GroupView)
- {
+ } else if (this->View == GroupView) {
QMap<QString, QCMakePropertyList> newPropsTree;
this->breakProperties(newProps, newPropsTree);
QMap<QString, QCMakePropertyList> newPropsTree2;
@@ -282,35 +266,33 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
QStandardItem* root = this->invisibleRootItem();
- foreach(QString key, newPropsTree.keys())
- {
+ foreach (QString key, newPropsTree.keys()) {
QCMakePropertyList props2 = newPropsTree[key];
QList<QStandardItem*> parentItems;
parentItems.append(
- new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key)
- );
+ new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key));
parentItems.append(new QStandardItem());
- parentItems[0]->setData(QBrush(QColor(255,100,100)), Qt::BackgroundColorRole);
- parentItems[1]->setData(QBrush(QColor(255,100,100)), Qt::BackgroundColorRole);
+ parentItems[0]->setData(QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundColorRole);
+ parentItems[1]->setData(QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundColorRole);
parentItems[0]->setData(1, GroupRole);
parentItems[1]->setData(1, GroupRole);
root->appendRow(parentItems);
int num = props2.size();
- for(int i=0; i<num; i++)
- {
+ for (int i = 0; i < num; i++) {
QCMakeProperty prop = props2[i];
QList<QStandardItem*> items;
items.append(new QStandardItem());
items.append(new QStandardItem());
parentItems[0]->appendRow(items);
this->setPropertyData(this->indexFromItem(items[0]), prop, true);
- }
}
+ }
- foreach(QString key, newPropsTree2.keys())
- {
+ foreach (QString key, newPropsTree2.keys()) {
QCMakePropertyList props2 = newPropsTree2[key];
QStandardItem* parentItem =
@@ -319,16 +301,15 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
parentItem->setData(1, GroupRole);
int num = props2.size();
- for(int i=0; i<num; i++)
- {
+ for (int i = 0; i < num; i++) {
QCMakeProperty prop = props2[i];
QList<QStandardItem*> items;
items.append(new QStandardItem());
items.append(new QStandardItem());
parentItem->appendRow(items);
this->setPropertyData(this->indexFromItem(items[0]), prop, false);
- }
}
+ }
}
this->blockSignals(b);
@@ -348,8 +329,7 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
QCMakePropertyList oldProps;
int numNew = this->NewPropertyCount;
int numTotal = props.count();
- for(int i=numNew; i<numTotal; i++)
- {
+ for (int i = numNew; i < numTotal; i++) {
oldProps.append(props[i]);
}
@@ -362,7 +342,7 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
}
void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
- const QCMakeProperty& prop, bool isNew)
+ const QCMakeProperty& prop, bool isNew)
{
QModelIndex idx2 = idx1.sibling(idx1.row(), 1);
@@ -371,46 +351,42 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
this->setData(idx1, prop.Type, QCMakeCacheModel::TypeRole);
this->setData(idx1, prop.Advanced, QCMakeCacheModel::AdvancedRole);
- if(prop.Type == QCMakeProperty::BOOL)
- {
+ if (prop.Type == QCMakeProperty::BOOL) {
int check = prop.Value.toBool() ? Qt::Checked : Qt::Unchecked;
this->setData(idx2, check, Qt::CheckStateRole);
- }
- else
- {
+ } else {
this->setData(idx2, prop.Value, Qt::DisplayRole);
}
this->setData(idx2, prop.Help, QCMakeCacheModel::HelpRole);
- if (!prop.Strings.isEmpty())
- {
+ if (!prop.Strings.isEmpty()) {
this->setData(idx1, prop.Strings, QCMakeCacheModel::StringsRole);
}
- if(isNew)
- {
- this->setData(idx1, QBrush(QColor(255,100,100)), Qt::BackgroundColorRole);
- this->setData(idx2, QBrush(QColor(255,100,100)), Qt::BackgroundColorRole);
+ if (isNew) {
+ this->setData(idx1, QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundColorRole);
+ this->setData(idx2, QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundColorRole);
}
}
void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1,
- QCMakeProperty& prop) const
+ QCMakeProperty& prop) const
{
QModelIndex idx2 = idx1.sibling(idx1.row(), 1);
prop.Key = this->data(idx1, Qt::DisplayRole).toString();
prop.Help = this->data(idx1, HelpRole).toString();
- prop.Type = static_cast<QCMakeProperty::PropertyType>(this->data(idx1, TypeRole).toInt());
+ prop.Type = static_cast<QCMakeProperty::PropertyType>(
+ this->data(idx1, TypeRole).toInt());
prop.Advanced = this->data(idx1, AdvancedRole).toBool();
- prop.Strings = this->data(idx1, QCMakeCacheModel::StringsRole).toStringList();
- if(prop.Type == QCMakeProperty::BOOL)
- {
+ prop.Strings =
+ this->data(idx1, QCMakeCacheModel::StringsRole).toStringList();
+ if (prop.Type == QCMakeProperty::BOOL) {
int check = this->data(idx2, Qt::CheckStateRole).toInt();
prop.Value = check == Qt::Checked;
- }
- else
- {
+ } else {
prop.Value = this->data(idx2, Qt::DisplayRole).toString();
}
}
@@ -418,43 +394,36 @@ void QCMakeCacheModel::getPropertyData(const QModelIndex& idx1,
QString QCMakeCacheModel::prefix(const QString& s)
{
QString prefix = s.section('_', 0, 0);
- if(prefix == s)
- {
+ if (prefix == s) {
prefix = QString();
- }
+ }
return prefix;
}
-void QCMakeCacheModel::breakProperties(const QSet<QCMakeProperty>& props,
- QMap<QString, QCMakePropertyList>& result)
+void QCMakeCacheModel::breakProperties(
+ const QSet<QCMakeProperty>& props, QMap<QString, QCMakePropertyList>& result)
{
QMap<QString, QCMakePropertyList> tmp;
// return a map of properties grouped by prefixes, and sorted
- foreach(QCMakeProperty p, props)
- {
+ foreach (QCMakeProperty p, props) {
QString prefix = QCMakeCacheModel::prefix(p.Key);
tmp[prefix].append(p);
- }
+ }
// sort it and re-org any properties with only one sub item
QCMakePropertyList reorgProps;
QMap<QString, QCMakePropertyList>::iterator iter;
- for(iter = tmp.begin(); iter != tmp.end();)
- {
- if(iter->count() == 1)
- {
+ for (iter = tmp.begin(); iter != tmp.end();) {
+ if (iter->count() == 1) {
reorgProps.append((*iter)[0]);
iter = tmp.erase(iter);
- }
- else
- {
+ } else {
qSort(*iter);
++iter;
- }
}
- if(reorgProps.count())
- {
+ }
+ if (reorgProps.count()) {
tmp[QString()] += reorgProps;
- }
+ }
result = tmp;
}
@@ -462,27 +431,21 @@ QCMakePropertyList QCMakeCacheModel::properties() const
{
QCMakePropertyList props;
- if(!this->rowCount())
- {
+ if (!this->rowCount()) {
return props;
- }
+ }
QList<QModelIndex> idxs;
- idxs.append(this->index(0,0));
+ idxs.append(this->index(0, 0));
// walk the entire model for property entries
// this works regardless of a flat view or a tree view
- while(!idxs.isEmpty())
- {
+ while (!idxs.isEmpty()) {
QModelIndex idx = idxs.last();
- if(this->hasChildren(idx) && this->rowCount(idx))
- {
- idxs.append(this->index(0,0, idx));
- }
- else
- {
- if(!data(idx, GroupRole).toInt())
- {
+ if (this->hasChildren(idx) && this->rowCount(idx)) {
+ idxs.append(this->index(0, 0, idx));
+ } else {
+ if (!data(idx, GroupRole).toInt()) {
// get data
QCMakeProperty prop;
this->getPropertyData(idx, prop);
@@ -490,17 +453,17 @@ QCMakePropertyList QCMakeCacheModel::properties() const
}
// go to the next in the tree
- while(!idxs.isEmpty() && (
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
- (idxs.last().row()+1) >= rowCount(idxs.last().parent()) ||
+ while (!idxs.isEmpty() &&
+ (
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && \
+ QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
+ (idxs.last().row() + 1) >= rowCount(idxs.last().parent()) ||
#endif
- !idxs.last().sibling(idxs.last().row()+1, 0).isValid()))
- {
+ !idxs.last().sibling(idxs.last().row() + 1, 0).isValid())) {
idxs.removeLast();
}
- if(!idxs.isEmpty())
- {
- idxs.last() = idxs.last().sibling(idxs.last().row()+1, 0);
+ if (!idxs.isEmpty()) {
+ idxs.last() = idxs.last().sibling(idxs.last().row() + 1, 0);
}
}
}
@@ -509,8 +472,9 @@ QCMakePropertyList QCMakeCacheModel::properties() const
}
bool QCMakeCacheModel::insertProperty(QCMakeProperty::PropertyType t,
- const QString& name, const QString& description,
- const QVariant& value, bool advanced)
+ const QString& name,
+ const QString& description,
+ const QVariant& value, bool advanced)
{
QCMakeProperty prop;
prop.Key = name;
@@ -519,9 +483,9 @@ bool QCMakeCacheModel::insertProperty(QCMakeProperty::PropertyType t,
prop.Type = t;
prop.Advanced = advanced;
- //insert at beginning
+ // insert at beginning
this->insertRow(0);
- this->setPropertyData(this->index(0,0), prop, true);
+ this->setPropertyData(this->index(0, 0), prop, true);
this->NewPropertyCount++;
return true;
}
@@ -541,33 +505,31 @@ int QCMakeCacheModel::newPropertyCount() const
return this->NewPropertyCount;
}
-Qt::ItemFlags QCMakeCacheModel::flags (const QModelIndex& idx) const
+Qt::ItemFlags QCMakeCacheModel::flags(const QModelIndex& idx) const
{
Qt::ItemFlags f = QStandardItemModel::flags(idx);
- if(!this->EditEnabled)
- {
+ if (!this->EditEnabled) {
f &= ~Qt::ItemIsEditable;
return f;
- }
- if(QCMakeProperty::BOOL == this->data(idx, TypeRole).toInt())
- {
+ }
+ if (QCMakeProperty::BOOL == this->data(idx, TypeRole).toInt()) {
f |= Qt::ItemIsUserCheckable;
- }
+ }
return f;
}
QModelIndex QCMakeCacheModel::buddy(const QModelIndex& idx) const
{
- if(!this->hasChildren(idx) &&
- this->data(idx, TypeRole).toInt() != QCMakeProperty::BOOL)
- {
+ if (!this->hasChildren(idx) &&
+ this->data(idx, TypeRole).toInt() != QCMakeProperty::BOOL) {
return this->index(idx.row(), 1, idx.parent());
}
return idx;
}
QCMakeCacheModelDelegate::QCMakeCacheModelDelegate(QObject* p)
- : QItemDelegate(p), FileDialogFlag(false)
+ : QItemDelegate(p)
+ , FileDialogFlag(false)
{
}
@@ -577,91 +539,77 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f)
}
QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p,
- const QStyleOptionViewItem&, const QModelIndex& idx) const
+ const QStyleOptionViewItem&,
+ const QModelIndex& idx) const
{
QModelIndex var = idx.sibling(idx.row(), 0);
int type = var.data(QCMakeCacheModel::TypeRole).toInt();
- if(type == QCMakeProperty::BOOL)
- {
+ if (type == QCMakeProperty::BOOL) {
return NULL;
- }
- else if(type == QCMakeProperty::PATH)
- {
+ } else if (type == QCMakeProperty::PATH) {
QCMakePathEditor* editor =
- new QCMakePathEditor(p,
- var.data(Qt::DisplayRole).toString());
+ new QCMakePathEditor(p, var.data(Qt::DisplayRole).toString());
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
- SLOT(setFileDialogFlag(bool)));
+ SLOT(setFileDialogFlag(bool)));
return editor;
- }
- else if(type == QCMakeProperty::FILEPATH)
- {
+ } else if (type == QCMakeProperty::FILEPATH) {
QCMakeFilePathEditor* editor =
- new QCMakeFilePathEditor(p,
- var.data(Qt::DisplayRole).toString());
+ new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString());
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
- SLOT(setFileDialogFlag(bool)));
+ SLOT(setFileDialogFlag(bool)));
return editor;
- }
- else if(type == QCMakeProperty::STRING &&
- var.data(QCMakeCacheModel::StringsRole).isValid())
- {
- QCMakeComboBox* editor =
- new QCMakeComboBox(p, var.data(QCMakeCacheModel::StringsRole).toStringList());
+ } else if (type == QCMakeProperty::STRING &&
+ var.data(QCMakeCacheModel::StringsRole).isValid()) {
+ QCMakeComboBox* editor = new QCMakeComboBox(
+ p, var.data(QCMakeCacheModel::StringsRole).toStringList());
editor->setFrame(false);
return editor;
- }
+ }
QLineEdit* editor = new QLineEdit(p);
editor->setFrame(false);
return editor;
}
-bool QCMakeCacheModelDelegate::editorEvent(QEvent* e, QAbstractItemModel* model,
- const QStyleOptionViewItem& option, const QModelIndex& index)
+bool QCMakeCacheModelDelegate::editorEvent(QEvent* e,
+ QAbstractItemModel* model,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index)
{
Qt::ItemFlags flags = model->flags(index);
- if (!(flags & Qt::ItemIsUserCheckable) || !(option.state & QStyle::State_Enabled)
- || !(flags & Qt::ItemIsEnabled))
- {
+ if (!(flags & Qt::ItemIsUserCheckable) ||
+ !(option.state & QStyle::State_Enabled) ||
+ !(flags & Qt::ItemIsEnabled)) {
return false;
- }
+ }
QVariant value = index.data(Qt::CheckStateRole);
- if (!value.isValid())
- {
+ if (!value.isValid()) {
return false;
- }
+ }
- if ((e->type() == QEvent::MouseButtonRelease)
- || (e->type() == QEvent::MouseButtonDblClick))
- {
+ if ((e->type() == QEvent::MouseButtonRelease) ||
+ (e->type() == QEvent::MouseButtonDblClick)) {
// eat the double click events inside the check rect
- if (e->type() == QEvent::MouseButtonDblClick)
- {
+ if (e->type() == QEvent::MouseButtonDblClick) {
return true;
- }
}
- else if (e->type() == QEvent::KeyPress)
- {
- if(static_cast<QKeyEvent*>(e)->key() != Qt::Key_Space &&
- static_cast<QKeyEvent*>(e)->key() != Qt::Key_Select)
- {
+ } else if (e->type() == QEvent::KeyPress) {
+ if (static_cast<QKeyEvent*>(e)->key() != Qt::Key_Space &&
+ static_cast<QKeyEvent*>(e)->key() != Qt::Key_Select) {
return false;
- }
}
- else
- {
+ } else {
return false;
- }
+ }
- Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
- ? Qt::Unchecked : Qt::Checked);
+ Qt::CheckState state =
+ (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked ? Qt::Unchecked
+ : Qt::Checked);
bool success = model->setData(index, state, Qt::CheckStateRole);
- if(success)
- {
+ if (success) {
this->recordChange(model, index);
- }
+ }
return success;
}
@@ -673,29 +621,32 @@ bool QCMakeCacheModelDelegate::eventFilter(QObject* object, QEvent* evt)
// where it doesn't create a QWidget wrapper for the native file dialog
// so the Qt library ends up assuming the focus was lost to something else
- if(evt->type() == QEvent::FocusOut && this->FileDialogFlag)
- {
+ if (evt->type() == QEvent::FocusOut && this->FileDialogFlag) {
return false;
- }
+ }
return QItemDelegate::eventFilter(object, evt);
}
void QCMakeCacheModelDelegate::setModelData(QWidget* editor,
- QAbstractItemModel* model, const QModelIndex& index ) const
+ QAbstractItemModel* model,
+ const QModelIndex& index) const
{
QItemDelegate::setModelData(editor, model, index);
const_cast<QCMakeCacheModelDelegate*>(this)->recordChange(model, index);
}
-QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
+QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option,
+ const QModelIndex& index) const
{
QSize sz = QItemDelegate::sizeHint(option, index);
- QStyle *style = QApplication::style();
+ QStyle* style = QApplication::style();
// increase to checkbox size
QStyleOptionButton opt;
opt.QStyleOption::operator=(option);
- sz = sz.expandedTo(style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, NULL).size());
+ sz = sz.expandedTo(
+ style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, NULL)
+ .size());
return sz;
}
@@ -710,30 +661,27 @@ void QCMakeCacheModelDelegate::clearChanges()
mChanges.clear();
}
-void QCMakeCacheModelDelegate::recordChange(QAbstractItemModel* model, const QModelIndex& index)
+void QCMakeCacheModelDelegate::recordChange(QAbstractItemModel* model,
+ const QModelIndex& index)
{
QModelIndex idx = index;
QAbstractItemModel* mymodel = model;
- while(qobject_cast<QAbstractProxyModel*>(mymodel))
- {
+ while (qobject_cast<QAbstractProxyModel*>(mymodel)) {
idx = static_cast<QAbstractProxyModel*>(mymodel)->mapToSource(idx);
mymodel = static_cast<QAbstractProxyModel*>(mymodel)->sourceModel();
- }
+ }
QCMakeCacheModel* cache_model = qobject_cast<QCMakeCacheModel*>(mymodel);
- if(cache_model && idx.isValid())
- {
+ if (cache_model && idx.isValid()) {
QCMakeProperty prop;
idx = idx.sibling(idx.row(), 0);
cache_model->getPropertyData(idx, prop);
// clean out an old one
QSet<QCMakeProperty>::iterator iter = mChanges.find(prop);
- if(iter != mChanges.end())
- {
+ if (iter != mChanges.end()) {
mChanges.erase(iter);
- }
+ }
// now add the new item
mChanges.insert(prop);
- }
+ }
}
-
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 5631b86..6ad56fb 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -38,7 +38,7 @@ public:
// get whether to show advanced entries
bool showAdvanced() const;
- QSize sizeHint() const { return QSize(200,200); }
+ QSize sizeHint() const { return QSize(200, 200); }
public slots:
// set whether to show advanced entries
@@ -65,14 +65,20 @@ public:
// roles used to retrieve extra data such has help strings, types of
// properties, and the advanced flag
- enum { HelpRole = Qt::ToolTipRole,
- TypeRole = Qt::UserRole,
- AdvancedRole,
- StringsRole,
- GroupRole
- };
-
- enum ViewType { FlatView, GroupView };
+ enum
+ {
+ HelpRole = Qt::ToolTipRole,
+ TypeRole = Qt::UserRole,
+ AdvancedRole,
+ StringsRole,
+ GroupRole
+ };
+
+ enum ViewType
+ {
+ FlatView,
+ GroupView
+ };
public slots:
// set a list of properties. This list will be sorted and grouped according
@@ -92,9 +98,9 @@ public slots:
// insert a new property at a row specifying all the information about the
// property
- bool insertProperty(QCMakeProperty::PropertyType t,
- const QString& name, const QString& description,
- const QVariant& value, bool advanced);
+ bool insertProperty(QCMakeProperty::PropertyType t, const QString& name,
+ const QString& description, const QVariant& value,
+ bool advanced);
// set the view type
void setViewType(ViewType t);
@@ -111,12 +117,11 @@ public:
int newPropertyCount() const;
// return flags (overloaded to modify flag based on EditEnabled flag)
- Qt::ItemFlags flags (const QModelIndex& index) const;
+ Qt::ItemFlags flags(const QModelIndex& index) const;
QModelIndex buddy(const QModelIndex& idx) const;
// get the data in the model for this property
- void getPropertyData(const QModelIndex& idx1,
- QCMakeProperty& prop) const;
+ void getPropertyData(const QModelIndex& idx1, QCMakeProperty& prop) const;
protected:
bool EditEnabled;
@@ -125,17 +130,16 @@ protected:
ViewType View;
// set the data in the model for this property
- void setPropertyData(const QModelIndex& idx1,
- const QCMakeProperty& p, bool isNew);
+ void setPropertyData(const QModelIndex& idx1, const QCMakeProperty& p,
+ bool isNew);
// breaks up he property list into groups
// where each group has the same prefix up to the first underscore
static void breakProperties(const QSet<QCMakeProperty>& props,
- QMap<QString, QCMakePropertyList>& result);
+ QMap<QString, QCMakePropertyList>& result);
// gets the prefix of a string up to the first _
static QString prefix(const QString& s);
-
};
/// Qt delegate class for interaction (or other customization)
@@ -147,18 +151,22 @@ public:
QCMakeCacheModelDelegate(QObject* p);
/// create our own editors for cache properties
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
- const QModelIndex& index ) const;
- bool editorEvent (QEvent* event, QAbstractItemModel* model,
- const QStyleOptionViewItem& option, const QModelIndex& index);
+ const QModelIndex& index) const;
+ bool editorEvent(QEvent* event, QAbstractItemModel* model,
+ const QStyleOptionViewItem& option,
+ const QModelIndex& index);
bool eventFilter(QObject* object, QEvent* event);
- void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const;
- QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ void setModelData(QWidget* editor, QAbstractItemModel* model,
+ const QModelIndex& index) const;
+ QSize sizeHint(const QStyleOptionViewItem& option,
+ const QModelIndex& index) const;
QSet<QCMakeProperty> changes() const;
void clearChanges();
protected slots:
void setFileDialogFlag(bool);
+
protected:
bool FileDialogFlag;
// record a change to an item in the model.
@@ -170,4 +178,3 @@ protected:
};
#endif
-
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));
}
-
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index 759b635..f1e87ce 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -31,6 +31,7 @@ protected slots:
virtual void chooseFile() = 0;
signals:
void fileDialogExists(bool);
+
protected:
void resizeEvent(QResizeEvent* e);
QToolButton* ToolButton;
@@ -69,20 +70,20 @@ class QCMakeComboBox : public QComboBox
{
Q_OBJECT
Q_PROPERTY(QString value READ currentText WRITE setValue USER true);
+
public:
- QCMakeComboBox(QWidget* p, QStringList strings) : QComboBox(p)
+ QCMakeComboBox(QWidget* p, QStringList strings)
+ : QComboBox(p)
{
this->addItems(strings);
}
void setValue(const QString& v)
{
int i = this->findText(v);
- if(i != -1)
- {
+ if (i != -1) {
this->setCurrentIndex(i);
}
}
};
#endif
-
diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx
index dfcf048..d23a08c 100644
--- a/Source/QtDialog/RegexExplorer.cxx
+++ b/Source/QtDialog/RegexExplorer.cxx
@@ -12,16 +12,16 @@
#include "RegexExplorer.h"
-RegexExplorer::RegexExplorer(QWidget* p) : QDialog(p), m_matched(false)
+RegexExplorer::RegexExplorer(QWidget* p)
+ : QDialog(p)
+ , m_matched(false)
{
this->setupUi(this);
- for(int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i)
- {
- matchNumber->addItem(
- QString("Match %1").arg(QString::number(i)),
- QVariant(i));
- }
+ for (int i = 1; i < cmsys::RegularExpression::NSUBEXP; ++i) {
+ matchNumber->addItem(QString("Match %1").arg(QString::number(i)),
+ QVariant(i));
+ }
matchNumber->setCurrentIndex(0);
}
@@ -44,10 +44,9 @@ void RegexExplorer::on_regularExpression_textChanged(const QString& text)
bool validExpression =
stripEscapes(m_regex) && m_regexParser.compile(m_regex);
- if(!validExpression)
- {
+ if (!validExpression) {
m_regexParser.set_invalid();
- }
+ }
setStatusColor(labelRegexValid, validExpression);
@@ -56,8 +55,7 @@ void RegexExplorer::on_regularExpression_textChanged(const QString& text)
void RegexExplorer::on_inputText_textChanged()
{
- if(m_regexParser.is_valid())
- {
+ if (m_regexParser.is_valid()) {
QString plainText = inputText->toPlainText();
#ifdef QT_NO_STL
m_text = plainText.toAscii().constData();
@@ -65,19 +63,16 @@ void RegexExplorer::on_inputText_textChanged()
m_text = plainText.toStdString();
#endif
m_matched = m_regexParser.find(m_text);
- }
- else
- {
+ } else {
m_matched = false;
- }
+ }
setStatusColor(labelRegexMatch, m_matched);
- if(!m_matched)
- {
+ if (!m_matched) {
clearMatch();
return;
- }
+ }
#ifdef QT_NO_STL
QString matchText = m_regexParser.match(0).c_str();
@@ -91,18 +86,16 @@ void RegexExplorer::on_inputText_textChanged()
void RegexExplorer::on_matchNumber_currentIndexChanged(int index)
{
- if(!m_matched)
- {
+ if (!m_matched) {
return;
- }
+ }
QVariant itemData = matchNumber->itemData(index);
int idx = itemData.toInt();
- if(idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP)
- {
+ if (idx < 1 || idx >= cmsys::RegularExpression::NSUBEXP) {
return;
- }
+ }
#ifdef QT_NO_STL
QString match = m_regexParser.match(idx).c_str();
@@ -125,42 +118,29 @@ bool RegexExplorer::stripEscapes(std::string& source)
std::string result;
result.reserve(source.size());
- for(char inc = *in; inc != '\0'; inc = *++in)
- {
- if(inc == '\\')
- {
+ for (char inc = *in; inc != '\0'; inc = *++in) {
+ if (inc == '\\') {
char nextc = in[1];
- if(nextc == 't')
- {
+ if (nextc == 't') {
result.append(1, '\t');
in++;
- }
- else if(nextc == 'n')
- {
+ } else if (nextc == 'n') {
result.append(1, '\n');
in++;
- }
- else if(nextc == 't')
- {
+ } else if (nextc == 't') {
result.append(1, '\t');
in++;
- }
- else if(isalnum(nextc) || nextc == '\0')
- {
+ } else if (isalnum(nextc) || nextc == '\0') {
return false;
- }
- else
- {
+ } else {
result.append(1, nextc);
in++;
- }
- }
- else
- {
- result.append(1, inc);
}
+ } else {
+ result.append(1, inc);
}
+ }
- source = result;
- return true;
+ source = result;
+ return true;
}
diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx
index 4bd541f..3be6798 100644
--- a/Source/QtDialog/WarningMessagesDialog.cxx
+++ b/Source/QtDialog/WarningMessagesDialog.cxx
@@ -13,7 +13,8 @@
#include "WarningMessagesDialog.h"
WarningMessagesDialog::WarningMessagesDialog(QWidget* prnt, QCMake* instance)
- : QDialog(prnt), cmakeInstance(instance)
+ : QDialog(prnt)
+ , cmakeInstance(instance)
{
this->setupUi(this);
this->setInitialValues();
@@ -35,8 +36,8 @@ void WarningMessagesDialog::setInitialValues()
void WarningMessagesDialog::setupSignals()
{
- QObject::connect(this->buttonBox, SIGNAL(accepted()),
- this, SLOT(doAccept()));
+ QObject::connect(this->buttonBox, SIGNAL(accepted()), this,
+ SLOT(doAccept()));
QObject::connect(this->suppressDeveloperWarnings, SIGNAL(stateChanged(int)),
this, SLOT(doSuppressDeveloperWarningsChanged(int)));
@@ -65,35 +66,31 @@ void WarningMessagesDialog::doAccept()
void WarningMessagesDialog::doSuppressDeveloperWarningsChanged(int state)
{
// no warnings implies no errors either
- if (state)
- {
+ if (state) {
this->developerWarningsAsErrors->setChecked(false);
- }
+ }
}
void WarningMessagesDialog::doSuppressDeprecatedWarningsChanged(int state)
{
// no warnings implies no errors either
- if (state)
- {
+ if (state) {
this->deprecatedWarningsAsErrors->setChecked(false);
- }
+ }
}
void WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged(int state)
{
// warnings as errors implies warnings are not suppressed
- if (state)
- {
+ if (state) {
this->suppressDeveloperWarnings->setChecked(false);
- }
+ }
}
void WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged(int state)
{
// warnings as errors implies warnings are not suppressed
- if (state)
- {
+ if (state) {
this->suppressDeprecatedWarnings->setChecked(false);
- }
+ }
}