2007-11-02 18:55:57 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
#include "CMakeSetupDialog.h"
|
|
|
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QProgressBar>
|
|
|
|
#include <QMessageBox>
|
2007-11-03 17:30:52 +03:00
|
|
|
#include <QStatusBar>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <QDialogButtonBox>
|
2007-11-04 02:48:59 +03:00
|
|
|
#include <QCloseEvent>
|
2007-11-05 21:20:54 +03:00
|
|
|
#include <QCoreApplication>
|
2007-11-14 00:25:38 +03:00
|
|
|
#include <QCompleter>
|
|
|
|
#include <QDirModel>
|
2007-11-06 03:26:18 +03:00
|
|
|
#include <QSettings>
|
2007-11-06 09:16:11 +03:00
|
|
|
#include <QMenu>
|
|
|
|
#include <QMenuBar>
|
2007-11-07 03:25:43 +03:00
|
|
|
#include <QDragEnterEvent>
|
|
|
|
#include <QMimeData>
|
|
|
|
#include <QUrl>
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
#include "QCMake.h"
|
|
|
|
#include "QCMakeCacheView.h"
|
2007-11-13 07:54:49 +03:00
|
|
|
#include "AddCacheEntry.h"
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QCMakeThread::QCMakeThread(QObject* p)
|
|
|
|
: QThread(p), CMakeInstance(NULL)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QCMake* QCMakeThread::cmakeInstance() const
|
|
|
|
{
|
|
|
|
return this->CMakeInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMakeThread::processEvents()
|
|
|
|
{
|
|
|
|
QCoreApplication::processEvents();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCMakeThread::run()
|
|
|
|
{
|
|
|
|
this->CMakeInstance = new QCMake;
|
|
|
|
// make the cmake thread to process events it receives from the GUI thread
|
|
|
|
QObject::connect(this->CMakeInstance, SIGNAL(progressChanged(QString, float)),
|
|
|
|
this, SLOT(processEvents()), Qt::DirectConnection);
|
|
|
|
QObject::connect(this->CMakeInstance, SIGNAL(outputMessage(QString)),
|
|
|
|
this, SLOT(processEvents()), Qt::DirectConnection);
|
|
|
|
// emit that this cmake thread is ready for use
|
|
|
|
emit this->cmakeInitialized();
|
|
|
|
this->exec();
|
|
|
|
delete this->CMakeInstance;
|
|
|
|
this->CMakeInstance = NULL;
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
CMakeSetupDialog::CMakeSetupDialog()
|
2007-11-13 01:41:15 +03:00
|
|
|
: ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
|
|
|
// create the GUI
|
2007-11-06 03:26:18 +03:00
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("Settings/StartPath");
|
|
|
|
int h = settings.value("Height", 500).toInt();
|
|
|
|
int w = settings.value("Width", 700).toInt();
|
|
|
|
this->resize(w, h);
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
QWidget* cont = new QWidget(this);
|
|
|
|
this->setupUi(cont);
|
2007-11-08 18:17:37 +03:00
|
|
|
this->Splitter->setStretchFactor(0, 3);
|
2007-11-04 02:48:59 +03:00
|
|
|
this->Splitter->setStretchFactor(1, 1);
|
2007-11-03 17:30:52 +03:00
|
|
|
this->setCentralWidget(cont);
|
2007-11-07 19:31:55 +03:00
|
|
|
this->ProgressBar->reset();
|
2007-11-10 19:36:09 +03:00
|
|
|
this->RemoveEntry->setEnabled(false);
|
2007-11-13 07:54:49 +03:00
|
|
|
this->AddEntry->setEnabled(false);
|
2007-11-06 03:26:18 +03:00
|
|
|
|
2007-11-06 09:16:11 +03:00
|
|
|
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
|
2007-11-07 03:25:43 +03:00
|
|
|
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
|
|
|
|
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()));
|
|
|
|
this->ExitAction = FileMenu->addAction(tr("&Exit"));
|
|
|
|
QObject::connect(this->ExitAction, SIGNAL(triggered(bool)),
|
|
|
|
this, SLOT(close()));
|
|
|
|
|
|
|
|
QMenu* ToolsMenu = this->menuBar()->addMenu(tr("&Tools"));
|
|
|
|
this->ConfigureAction = ToolsMenu->addAction(tr("&Configure"));
|
|
|
|
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()));
|
2007-11-06 09:16:11 +03:00
|
|
|
|
|
|
|
QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
|
2007-11-07 05:27:45 +03:00
|
|
|
QAction* a = HelpMenu->addAction(tr("About"));
|
2007-11-06 09:16:11 +03:00
|
|
|
QObject::connect(a, SIGNAL(triggered(bool)),
|
|
|
|
this, SLOT(doAbout()));
|
|
|
|
a = HelpMenu->addAction(tr("Help"));
|
|
|
|
QObject::connect(a, SIGNAL(triggered(bool)),
|
|
|
|
this, SLOT(doHelp()));
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
this->setAcceptDrops(true);
|
2007-11-13 08:33:22 +03:00
|
|
|
|
|
|
|
// get the saved binary directories
|
|
|
|
QStringList buildPaths = this->loadBuildPaths();
|
|
|
|
this->BinaryDirectory->addItems(buildPaths);
|
2007-11-14 00:25:38 +03:00
|
|
|
|
|
|
|
QCompleter* compBinaryDir = new QCompleter(this);
|
|
|
|
QDirModel* modelBinaryDir = new QDirModel(compBinaryDir);
|
|
|
|
modelBinaryDir->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
|
|
|
|
compBinaryDir->setModel(modelBinaryDir);
|
|
|
|
this->BinaryDirectory->setCompleter(compBinaryDir);
|
|
|
|
QCompleter* compSourceDir = new QCompleter(this);
|
|
|
|
QDirModel* modelSourceDir = new QDirModel(compSourceDir);
|
|
|
|
modelSourceDir->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
|
|
|
|
compSourceDir->setModel(modelSourceDir);
|
|
|
|
this->SourceDirectory->setCompleter(compSourceDir);
|
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
// start the cmake worker thread
|
|
|
|
this->CMakeThread = new QCMakeThread(this);
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread, SIGNAL(cmakeInitialized()),
|
|
|
|
this, SLOT(initialize()), Qt::QueuedConnection);
|
2007-11-02 18:50:17 +03:00
|
|
|
this->CMakeThread->start();
|
2007-11-13 01:41:15 +03:00
|
|
|
|
|
|
|
this->enterState(ReadyConfigure);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::initialize()
|
|
|
|
{
|
|
|
|
// now the cmake worker thread is running, lets make our connections to it
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
2007-11-02 18:50:17 +03:00
|
|
|
SIGNAL(propertiesChanged(const QCMakeCachePropertyList&)),
|
|
|
|
this->CacheValues->cacheModel(),
|
|
|
|
SLOT(setProperties(const QCMakeCachePropertyList&)));
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)),
|
2007-11-02 18:50:17 +03:00
|
|
|
this, SLOT(doConfigure()));
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(configureDone(int)),
|
2007-11-02 18:50:17 +03:00
|
|
|
this, SLOT(finishConfigure(int)));
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(generateDone(int)),
|
2007-11-02 18:50:17 +03:00
|
|
|
this, SLOT(finishGenerate(int)));
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
|
2007-11-06 09:16:11 +03:00
|
|
|
this, SLOT(doGenerate()));
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
|
|
|
|
this, SLOT(doSourceBrowse()));
|
|
|
|
QObject::connect(this->BrowseBinaryDirectoryButton, SIGNAL(clicked(bool)),
|
|
|
|
this, SLOT(doBinaryBrowse()));
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
QObject::connect(this->BinaryDirectory, SIGNAL(editTextChanged(QString)),
|
2007-11-07 18:09:02 +03:00
|
|
|
this, SLOT(onBinaryDirectoryChanged(QString)));
|
2007-11-04 02:48:59 +03:00
|
|
|
QObject::connect(this->SourceDirectory, SIGNAL(textChanged(QString)),
|
2007-11-07 18:09:02 +03:00
|
|
|
this, SLOT(onSourceDirectoryChanged(QString)));
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(sourceDirChanged(QString)),
|
2007-11-02 18:50:17 +03:00
|
|
|
this, SLOT(updateSourceDirectory(QString)));
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(progressChanged(QString, float)),
|
2007-11-02 18:50:17 +03:00
|
|
|
this, SLOT(showProgress(QString,float)));
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
2007-11-09 23:18:49 +03:00
|
|
|
SIGNAL(errorMessage(QString)),
|
|
|
|
this, SLOT(error(QString)));
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(outputMessage(QString)),
|
2007-11-03 17:30:52 +03:00
|
|
|
this->Output, SLOT(append(QString)));
|
2007-11-06 03:26:18 +03:00
|
|
|
|
|
|
|
QObject::connect(this->Advanced, SIGNAL(clicked(bool)),
|
|
|
|
this->CacheValues, SLOT(setShowAdvanced(bool)));
|
|
|
|
QObject::connect(this->Search, SIGNAL(textChanged(QString)),
|
|
|
|
this->CacheValues, SLOT(setSearchFilter(QString)));
|
2007-11-06 08:02:08 +03:00
|
|
|
|
|
|
|
QObject::connect(this->CMakeThread->cmakeInstance(),
|
|
|
|
SIGNAL(generatorChanged(QString)),
|
|
|
|
this, SLOT(updateGeneratorLabel(QString)));
|
|
|
|
this->updateGeneratorLabel(QString());
|
2007-11-07 03:25:43 +03:00
|
|
|
|
2007-11-09 23:18:49 +03:00
|
|
|
QObject::connect(this->CacheValues->cacheModel(),
|
|
|
|
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
|
|
|
this, SLOT(setCacheModified()));
|
2007-11-10 19:36:09 +03:00
|
|
|
|
|
|
|
QObject::connect(this->CacheValues->selectionModel(),
|
|
|
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
|
|
|
this, SLOT(selectionChanged()));
|
|
|
|
QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
|
|
|
|
this, SLOT(removeSelectedCacheEntries()));
|
2007-11-13 07:54:49 +03:00
|
|
|
QObject::connect(this->AddEntry, SIGNAL(clicked(bool)),
|
|
|
|
this, SLOT(addCacheEntry()));
|
2007-11-09 23:18:49 +03:00
|
|
|
|
2007-11-07 18:09:02 +03:00
|
|
|
|
|
|
|
if(!this->SourceDirectory->text().isEmpty() ||
|
|
|
|
!this->BinaryDirectory->lineEdit()->text().isEmpty())
|
|
|
|
{
|
|
|
|
this->onSourceDirectoryChanged(this->SourceDirectory->text());
|
|
|
|
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text());
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
CMakeSetupDialog::~CMakeSetupDialog()
|
|
|
|
{
|
2007-11-06 03:26:18 +03:00
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("Settings/StartPath");
|
|
|
|
settings.setValue("Height", this->height());
|
|
|
|
settings.setValue("Width", this->width());
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
// wait for thread to stop
|
|
|
|
this->CMakeThread->quit();
|
|
|
|
this->CMakeThread->wait();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doConfigure()
|
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
if(this->CurrentState == Configuring)
|
|
|
|
{
|
|
|
|
// stop configure
|
|
|
|
doInterrupt();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory();
|
|
|
|
QDir dir(bindir);
|
2007-11-04 02:48:59 +03:00
|
|
|
if(!dir.exists())
|
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
QString message = tr("Build directory does not exist, "
|
|
|
|
"should I create it?\n\n"
|
2007-11-04 02:48:59 +03:00
|
|
|
"Directory: ");
|
2007-11-07 03:25:43 +03:00
|
|
|
message += bindir;
|
2007-11-04 02:48:59 +03:00
|
|
|
QString title = tr("Create Directory");
|
2007-11-05 21:20:54 +03:00
|
|
|
QMessageBox::StandardButton btn;
|
|
|
|
btn = QMessageBox::information(this, title, message,
|
|
|
|
QMessageBox::Yes | QMessageBox::No);
|
2007-11-04 02:48:59 +03:00
|
|
|
if(btn == QMessageBox::No)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dir.mkpath(".");
|
|
|
|
}
|
2007-11-05 21:20:54 +03:00
|
|
|
|
|
|
|
// prompt for generator if one doesn't exist
|
|
|
|
if(this->CMakeThread->cmakeInstance()->generator().isEmpty())
|
|
|
|
{
|
|
|
|
this->promptForGenerator();
|
|
|
|
}
|
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
// remember path
|
|
|
|
this->addBinaryPath(dir.absolutePath());
|
2007-11-07 18:09:02 +03:00
|
|
|
|
2007-11-13 01:41:15 +03:00
|
|
|
this->enterState(Configuring);
|
2007-11-07 18:09:02 +03:00
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
this->Output->clear();
|
2007-11-05 21:20:54 +03:00
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
2007-11-03 17:30:52 +03:00
|
|
|
"setProperties", Qt::QueuedConnection,
|
|
|
|
Q_ARG(QCMakeCachePropertyList,
|
|
|
|
this->CacheValues->cacheModel()->properties()));
|
2007-11-05 21:20:54 +03:00
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
2007-11-03 17:30:52 +03:00
|
|
|
"configure", Qt::QueuedConnection);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
void CMakeSetupDialog::finishConfigure(int err)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
if(0 == err && 0 == this->CacheValues->cacheModel()->newCount())
|
|
|
|
{
|
|
|
|
this->enterState(ReadyGenerate);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->enterState(ReadyConfigure);
|
|
|
|
this->CacheValues->scrollToTop();
|
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
if(err != 0)
|
2007-11-03 17:30:52 +03:00
|
|
|
{
|
|
|
|
QMessageBox::critical(this, tr("Error"),
|
|
|
|
tr("Error in configuration process, project files may be invalid"),
|
|
|
|
QMessageBox::Ok);
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
void CMakeSetupDialog::finishGenerate(int err)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
this->enterState(ReadyGenerate);
|
2007-11-05 21:20:54 +03:00
|
|
|
if(err != 0)
|
2007-11-03 17:30:52 +03:00
|
|
|
{
|
|
|
|
QMessageBox::critical(this, tr("Error"),
|
|
|
|
tr("Error in generation process, project files may be invalid"),
|
|
|
|
QMessageBox::Ok);
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-06 09:16:11 +03:00
|
|
|
void CMakeSetupDialog::doGenerate()
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
if(this->CurrentState == Generating)
|
|
|
|
{
|
|
|
|
// stop generate
|
|
|
|
doInterrupt();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this->enterState(Generating);
|
2007-11-05 21:20:54 +03:00
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
2007-11-03 17:30:52 +03:00
|
|
|
"generate", Qt::QueuedConnection);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
2007-11-04 02:48:59 +03:00
|
|
|
|
|
|
|
void CMakeSetupDialog::closeEvent(QCloseEvent* e)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
// don't close if we're busy
|
2007-11-13 01:41:15 +03:00
|
|
|
if(this->CurrentState == Configuring || this->CurrentState == Generating)
|
2007-11-05 21:20:54 +03:00
|
|
|
{
|
|
|
|
e->ignore();
|
|
|
|
}
|
|
|
|
|
|
|
|
// prompt for close if there are unsaved changes
|
2007-11-09 23:18:49 +03:00
|
|
|
if(this->CacheModified)
|
2007-11-03 17:30:52 +03:00
|
|
|
{
|
|
|
|
QString message = tr("You have changed options but not rebuilt, "
|
|
|
|
"are you sure you want to exit?");
|
|
|
|
QString title = tr("Confirm Exit");
|
2007-11-05 21:20:54 +03:00
|
|
|
QMessageBox::StandardButton btn;
|
|
|
|
btn = QMessageBox::critical(this, title, message,
|
|
|
|
QMessageBox::Yes | QMessageBox::No);
|
2007-11-04 02:48:59 +03:00
|
|
|
if(btn == QMessageBox::No)
|
2007-11-03 17:30:52 +03:00
|
|
|
{
|
2007-11-04 02:48:59 +03:00
|
|
|
e->ignore();
|
2007-11-03 17:30:52 +03:00
|
|
|
}
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doHelp()
|
|
|
|
{
|
2007-11-05 21:20:54 +03:00
|
|
|
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 "
|
|
|
|
"built. It can be the same or a different directory than the source "
|
|
|
|
"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 "
|
|
|
|
"longer red entries.\r\n\r\n4. Once there are no longer red entries, you "
|
2007-11-13 02:06:09 +03:00
|
|
|
"should click the Generate button. This will write the build files to the build "
|
|
|
|
"directory.");
|
2007-11-03 17:30:52 +03:00
|
|
|
|
|
|
|
QDialog dialog;
|
2007-11-05 21:20:54 +03:00
|
|
|
dialog.setWindowTitle(tr("CMakeSetup Help"));
|
2007-11-03 17:30:52 +03:00
|
|
|
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
2007-11-05 21:20:54 +03:00
|
|
|
QLabel* lab = new QLabel(&dialog);
|
|
|
|
l->addWidget(lab);
|
|
|
|
lab->setText(msg);
|
|
|
|
lab->setWordWrap(true);
|
2007-11-03 17:30:52 +03:00
|
|
|
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
|
|
|
|
Qt::Horizontal, &dialog);
|
|
|
|
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
|
|
|
l->addWidget(btns);
|
|
|
|
dialog.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doInterrupt()
|
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
this->enterState(Interrupting);
|
2007-11-07 19:31:55 +03:00
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
|
|
|
"interrupt", Qt::QueuedConnection);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doSourceBrowse()
|
|
|
|
{
|
2007-11-03 17:30:52 +03:00
|
|
|
QString dir = QFileDialog::getExistingDirectory(this,
|
|
|
|
tr("Enter Path to Source"), this->SourceDirectory->text());
|
2007-11-02 18:50:17 +03:00
|
|
|
if(!dir.isEmpty())
|
|
|
|
{
|
2007-11-07 05:27:45 +03:00
|
|
|
this->setSourceDirectory(dir);
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::updateSourceDirectory(const QString& dir)
|
|
|
|
{
|
2007-11-04 02:48:59 +03:00
|
|
|
if(this->SourceDirectory->text() != dir)
|
|
|
|
{
|
2007-11-07 05:27:45 +03:00
|
|
|
this->setSourceDirectory(dir);
|
2007-11-04 02:48:59 +03:00
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doBinaryBrowse()
|
|
|
|
{
|
2007-11-03 17:30:52 +03:00
|
|
|
QString dir = QFileDialog::getExistingDirectory(this,
|
|
|
|
tr("Enter Path to Build"), this->BinaryDirectory->currentText());
|
2007-11-05 21:20:54 +03:00
|
|
|
if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText())
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
|
|
|
this->setBinaryDirectory(dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::setBinaryDirectory(const QString& dir)
|
2007-11-07 18:09:02 +03:00
|
|
|
{
|
|
|
|
this->BinaryDirectory->setEditText(dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::onSourceDirectoryChanged(const QString& dir)
|
|
|
|
{
|
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
|
|
|
"setSourceDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::onBinaryDirectoryChanged(const QString& dir)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-09 23:18:49 +03:00
|
|
|
this->CacheModified = false;
|
2007-11-05 21:20:54 +03:00
|
|
|
this->CacheValues->cacheModel()->clear();
|
|
|
|
this->Output->clear();
|
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
|
|
|
"setBinaryDirectory", Qt::QueuedConnection, Q_ARG(QString, dir));
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-07 05:27:45 +03:00
|
|
|
void CMakeSetupDialog::setSourceDirectory(const QString& dir)
|
|
|
|
{
|
|
|
|
this->SourceDirectory->setText(dir);
|
|
|
|
}
|
|
|
|
|
2007-11-07 19:31:55 +03:00
|
|
|
void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent)
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
2007-11-03 17:30:52 +03:00
|
|
|
this->ProgressBar->setValue(qRound(percent * 100));
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-09 23:18:49 +03:00
|
|
|
void CMakeSetupDialog::error(const QString& message)
|
|
|
|
{
|
|
|
|
this->Output->append(QString("<b><font color=red>%1</font></b>").arg(message));
|
2007-11-03 17:30:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::setEnabledState(bool enabled)
|
|
|
|
{
|
2007-11-07 03:25:43 +03:00
|
|
|
// disable parts of the GUI during configure/generate
|
2007-11-07 18:09:02 +03:00
|
|
|
this->CacheValues->cacheModel()->setEditEnabled(enabled);
|
2007-11-03 17:30:52 +03:00
|
|
|
this->SourceDirectory->setEnabled(enabled);
|
|
|
|
this->BrowseSourceDirectoryButton->setEnabled(enabled);
|
|
|
|
this->BinaryDirectory->setEnabled(enabled);
|
|
|
|
this->BrowseBinaryDirectoryButton->setEnabled(enabled);
|
2007-11-07 03:25:43 +03:00
|
|
|
this->ReloadCacheAction->setEnabled(enabled);
|
|
|
|
this->DeleteCacheAction->setEnabled(enabled);
|
|
|
|
this->ExitAction->setEnabled(enabled);
|
|
|
|
this->ConfigureAction->setEnabled(enabled);
|
2007-11-13 07:54:49 +03:00
|
|
|
this->AddEntry->setEnabled(enabled);
|
2007-11-10 19:36:09 +03:00
|
|
|
this->RemoveEntry->setEnabled(false); // let selection re-enable it
|
2007-11-02 18:50:17 +03:00
|
|
|
}
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
void CMakeSetupDialog::promptForGenerator()
|
|
|
|
{
|
2007-11-07 03:25:43 +03:00
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("Settings/StartPath");
|
|
|
|
QString lastGen = settings.value("LastGenerator").toString();
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
QStringList gens = this->CMakeThread->cmakeInstance()->availableGenerators();
|
|
|
|
QDialog dialog;
|
|
|
|
dialog.setWindowTitle(tr("CMakeSetup choose generator"));
|
|
|
|
QLabel* lab = new QLabel(&dialog);
|
|
|
|
lab->setText(tr("Please select what build system you want CMake to generate files for.\n"
|
|
|
|
"You should select the tool that you will use to build the project.\n"
|
|
|
|
"Press OK once you have made your selection."));
|
|
|
|
QComboBox* combo = new QComboBox(&dialog);
|
|
|
|
combo->addItems(gens);
|
2007-11-07 03:25:43 +03:00
|
|
|
int idx = combo->findText(lastGen);
|
|
|
|
if(idx != -1)
|
|
|
|
{
|
|
|
|
combo->setCurrentIndex(idx);
|
|
|
|
}
|
2007-11-05 21:20:54 +03:00
|
|
|
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
|
|
|
|
Qt::Horizontal, &dialog);
|
|
|
|
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
|
|
|
|
|
|
|
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
|
|
|
l->addWidget(lab);
|
|
|
|
l->addWidget(combo);
|
|
|
|
l->addWidget(btns);
|
|
|
|
dialog.exec();
|
2007-11-07 03:25:43 +03:00
|
|
|
|
|
|
|
lastGen = combo->currentText();
|
|
|
|
settings.setValue("LastGenerator", lastGen);
|
2007-11-05 21:20:54 +03:00
|
|
|
this->CMakeThread->cmakeInstance()->setGenerator(combo->currentText());
|
|
|
|
}
|
2007-11-06 08:02:08 +03:00
|
|
|
|
|
|
|
void CMakeSetupDialog::updateGeneratorLabel(const QString& gen)
|
|
|
|
{
|
2007-11-06 08:04:37 +03:00
|
|
|
QString str = tr("Current Generator: ");
|
2007-11-06 08:02:08 +03:00
|
|
|
if(gen.isEmpty())
|
|
|
|
{
|
|
|
|
str += tr("None");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str += gen;
|
|
|
|
}
|
|
|
|
this->Generator->setText(str);
|
|
|
|
}
|
|
|
|
|
2007-11-06 09:16:11 +03:00
|
|
|
void CMakeSetupDialog::doReloadCache()
|
|
|
|
{
|
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
|
|
|
"reloadCache", Qt::QueuedConnection);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doDeleteCache()
|
|
|
|
{
|
|
|
|
QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(),
|
|
|
|
"deleteCache", Qt::QueuedConnection);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::doAbout()
|
|
|
|
{
|
|
|
|
QString msg = "CMakeSetup\nwww.cmake.org";
|
|
|
|
|
|
|
|
QDialog dialog;
|
|
|
|
dialog.setWindowTitle(tr("About CMakeSetup"));
|
|
|
|
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
|
|
|
QLabel* lab = new QLabel(&dialog);
|
|
|
|
l->addWidget(lab);
|
|
|
|
lab->setText(msg);
|
|
|
|
lab->setWordWrap(true);
|
|
|
|
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
|
|
|
|
Qt::Horizontal, &dialog);
|
|
|
|
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
|
|
|
l->addWidget(btns);
|
|
|
|
dialog.exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::setExitAfterGenerate(bool b)
|
|
|
|
{
|
2007-11-07 03:25:43 +03:00
|
|
|
this->ExitAfterGenerate = b;
|
2007-11-06 09:16:11 +03:00
|
|
|
}
|
|
|
|
|
2007-11-07 03:25:43 +03:00
|
|
|
void CMakeSetupDialog::addBinaryPath(const QString& path)
|
|
|
|
{
|
|
|
|
QString cleanpath = QDir::cleanPath(path);
|
|
|
|
|
2007-11-07 05:27:45 +03:00
|
|
|
// update UI
|
|
|
|
this->BinaryDirectory->blockSignals(true);
|
2007-11-07 03:25:43 +03:00
|
|
|
int idx = this->BinaryDirectory->findText(cleanpath);
|
|
|
|
if(idx != -1)
|
|
|
|
{
|
|
|
|
this->BinaryDirectory->removeItem(idx);
|
|
|
|
}
|
|
|
|
this->BinaryDirectory->insertItem(0, cleanpath);
|
|
|
|
this->BinaryDirectory->setCurrentIndex(0);
|
2007-11-07 05:27:45 +03:00
|
|
|
this->BinaryDirectory->blockSignals(false);
|
|
|
|
|
|
|
|
// save to registry
|
|
|
|
QStringList buildPaths = this->loadBuildPaths();
|
|
|
|
buildPaths.removeAll(cleanpath);
|
2007-11-07 03:25:43 +03:00
|
|
|
buildPaths.prepend(cleanpath);
|
2007-11-07 05:27:45 +03:00
|
|
|
this->saveBuildPaths(buildPaths);
|
2007-11-07 03:25:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::dragEnterEvent(QDragEnterEvent* e)
|
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
if(this->CurrentState != ReadyConfigure ||
|
|
|
|
this->CurrentState != ReadyGenerate)
|
2007-11-07 06:27:09 +03:00
|
|
|
{
|
|
|
|
e->ignore();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-07 05:27:45 +03:00
|
|
|
const QMimeData* dat = e->mimeData();
|
|
|
|
QList<QUrl> urls = dat->urls();
|
2007-11-07 03:25:43 +03:00
|
|
|
QString file = urls.count() ? urls[0].toLocalFile() : QString();
|
|
|
|
if(!file.isEmpty() &&
|
|
|
|
(file.endsWith("CMakeCache.txt", Qt::CaseInsensitive) ||
|
|
|
|
file.endsWith("CMakeLists.txt", Qt::CaseInsensitive) ) )
|
|
|
|
{
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e->ignore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::dropEvent(QDropEvent* e)
|
|
|
|
{
|
2007-11-13 01:41:15 +03:00
|
|
|
if(this->CurrentState != ReadyConfigure ||
|
|
|
|
this->CurrentState != ReadyGenerate)
|
2007-11-07 06:27:09 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2007-11-13 01:41:15 +03:00
|
|
|
|
2007-11-07 05:27:45 +03:00
|
|
|
const QMimeData* dat = e->mimeData();
|
|
|
|
QList<QUrl> urls = dat->urls();
|
2007-11-07 03:25:43 +03:00
|
|
|
QString file = urls.count() ? urls[0].toLocalFile() : QString();
|
|
|
|
if(file.endsWith("CMakeCache.txt", Qt::CaseInsensitive))
|
|
|
|
{
|
|
|
|
QFileInfo info(file);
|
2007-11-07 05:51:08 +03:00
|
|
|
if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath())
|
|
|
|
{
|
|
|
|
this->setBinaryDirectory(info.absolutePath());
|
|
|
|
}
|
2007-11-07 03:25:43 +03:00
|
|
|
}
|
|
|
|
else if(file.endsWith("CMakeLists.txt", Qt::CaseInsensitive))
|
|
|
|
{
|
|
|
|
QFileInfo info(file);
|
2007-11-07 05:51:08 +03:00
|
|
|
if(this->CMakeThread->cmakeInstance()->binaryDirectory() != info.absolutePath())
|
|
|
|
{
|
|
|
|
this->setSourceDirectory(info.absolutePath());
|
|
|
|
this->setBinaryDirectory(info.absolutePath());
|
|
|
|
}
|
2007-11-07 03:25:43 +03:00
|
|
|
}
|
|
|
|
}
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-07 05:27:45 +03:00
|
|
|
QStringList CMakeSetupDialog::loadBuildPaths()
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return buildPaths;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::saveBuildPaths(const QStringList& paths)
|
|
|
|
{
|
|
|
|
QSettings settings;
|
|
|
|
settings.beginGroup("Settings/StartPath");
|
|
|
|
|
|
|
|
int num = paths.count();
|
|
|
|
if(num > 10)
|
|
|
|
{
|
|
|
|
num = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i=0; i<num; i++)
|
|
|
|
{
|
|
|
|
settings.setValue(QString("WhereBuild%1").arg(i), paths[i]);
|
|
|
|
}
|
|
|
|
}
|
2007-11-09 23:18:49 +03:00
|
|
|
|
|
|
|
void CMakeSetupDialog::setCacheModified()
|
|
|
|
{
|
|
|
|
this->CacheModified = true;
|
2007-11-13 01:41:15 +03:00
|
|
|
this->enterState(ReadyConfigure);
|
2007-11-09 23:18:49 +03:00
|
|
|
}
|
|
|
|
|
2007-11-10 19:36:09 +03:00
|
|
|
void CMakeSetupDialog::removeSelectedCacheEntries()
|
|
|
|
{
|
|
|
|
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
|
|
|
|
QList<QPersistentModelIndex> pidxs;
|
|
|
|
foreach(QModelIndex i, idxs)
|
|
|
|
{
|
|
|
|
pidxs.append(i);
|
|
|
|
}
|
|
|
|
foreach(QPersistentModelIndex pi, pidxs)
|
|
|
|
{
|
|
|
|
this->CacheValues->model()->removeRow(pi.row());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMakeSetupDialog::selectionChanged()
|
|
|
|
{
|
|
|
|
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
|
2007-11-13 01:41:15 +03:00
|
|
|
if(idxs.count() &&
|
|
|
|
(this->CurrentState == ReadyConfigure ||
|
|
|
|
this->CurrentState == ReadyGenerate) )
|
2007-11-10 19:36:09 +03:00
|
|
|
{
|
|
|
|
this->RemoveEntry->setEnabled(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->RemoveEntry->setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
2007-11-13 01:41:15 +03:00
|
|
|
|
|
|
|
void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
|
|
|
|
{
|
|
|
|
if(s == this->CurrentState)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this->CurrentState = s;
|
|
|
|
|
|
|
|
if(s == Interrupting)
|
|
|
|
{
|
2007-11-13 01:51:23 +03:00
|
|
|
this->ConfigureButton->setEnabled(false);
|
|
|
|
this->GenerateButton->setEnabled(false);
|
2007-11-13 01:41:15 +03:00
|
|
|
}
|
|
|
|
else if(s == Configuring)
|
|
|
|
{
|
|
|
|
this->Output->clear();
|
|
|
|
this->setEnabledState(false);
|
|
|
|
this->GenerateButton->setEnabled(false);
|
|
|
|
this->GenerateAction->setEnabled(false);
|
|
|
|
this->ConfigureButton->setText(tr("Stop"));
|
|
|
|
}
|
|
|
|
else if(s == Generating)
|
|
|
|
{
|
2007-11-13 01:51:23 +03:00
|
|
|
this->CacheModified = false;
|
2007-11-13 01:41:15 +03:00
|
|
|
this->Output->clear();
|
|
|
|
this->setEnabledState(false);
|
|
|
|
this->ConfigureButton->setEnabled(false);
|
|
|
|
this->GenerateAction->setEnabled(false);
|
|
|
|
this->GenerateButton->setText(tr("Stop"));
|
|
|
|
}
|
|
|
|
else if(s == ReadyConfigure)
|
|
|
|
{
|
|
|
|
this->ProgressBar->reset();
|
|
|
|
this->setEnabledState(true);
|
|
|
|
this->GenerateButton->setEnabled(false);
|
|
|
|
this->GenerateAction->setEnabled(false);
|
|
|
|
this->ConfigureButton->setEnabled(true);
|
|
|
|
this->ConfigureButton->setText(tr("Configure"));
|
|
|
|
this->GenerateButton->setText(tr("Generate"));
|
|
|
|
}
|
|
|
|
else if(s == ReadyGenerate)
|
|
|
|
{
|
|
|
|
this->ProgressBar->reset();
|
|
|
|
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"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-13 07:54:49 +03:00
|
|
|
void CMakeSetupDialog::addCacheEntry()
|
|
|
|
{
|
|
|
|
QDialog dialog(this);
|
|
|
|
dialog.resize(400, 200);
|
|
|
|
dialog.setWindowTitle(tr("CMakeSetup Help"));
|
|
|
|
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
|
|
|
AddCacheEntry* w = new AddCacheEntry(&dialog);
|
|
|
|
QDialogButtonBox* btns = new QDialogButtonBox(
|
|
|
|
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())
|
|
|
|
{
|
|
|
|
QCMakeCacheModel* m = this->CacheValues->cacheModel();
|
|
|
|
m->insertRows(0, 1, QModelIndex());
|
|
|
|
m->setData(m->index(0, 0), w->type(), QCMakeCacheModel::TypeRole);
|
|
|
|
m->setData(m->index(0, 0), w->name(), Qt::DisplayRole);
|
|
|
|
m->setData(m->index(0, 0), w->description(), QCMakeCacheModel::HelpRole);
|
|
|
|
m->setData(m->index(0, 0), 0, QCMakeCacheModel::AdvancedRole);
|
|
|
|
if(w->type() == QCMakeCacheProperty::BOOL)
|
|
|
|
{
|
|
|
|
m->setData(m->index(0, 1), w->value().toBool() ?
|
|
|
|
Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m->setData(m->index(0, 1), w->value(), Qt::DisplayRole);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-11-07 05:27:45 +03:00
|
|
|
|