[cmake-commits] clinton committed CMakeSetupDialog.cxx 1.8 1.9
CMakeSetupDialog.h 1.8 1.9 CMakeSetupDialog.ui 1.6 1.7
QCMake.cxx 1.5 1.6 QCMake.h 1.6 1.7
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Nov 6 01:16:13 EST 2007
Update of /cvsroot/CMake/CMake/Source/QtDialog
In directory public:/mounts/ram/cvs-serv16528
Modified Files:
CMakeSetupDialog.cxx CMakeSetupDialog.h CMakeSetupDialog.ui
QCMake.cxx QCMake.h
Log Message:
ENH: Add menus in menu bar.
Add reload & delete cache options.
Add option to quit after generation step (not yet remembered between sessions).
Add Help -> About
Remove Help button (in menu now)
Remove Cancel button (File -> Exit and the Window 'X' button exist)
Index: CMakeSetupDialog.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CMakeSetupDialog.h 6 Nov 2007 05:02:08 -0000 1.8
+++ CMakeSetupDialog.h 6 Nov 2007 06:16:11 -0000 1.9
@@ -39,8 +39,9 @@
protected slots:
void initialize();
void doConfigure();
- void doOk();
+ void doGenerate();
void doHelp();
+ void doAbout();
void doInterrupt();
void finishConfigure(int error);
void finishGenerate(int error);
@@ -48,12 +49,15 @@
void doSourceBrowse();
void doBinaryBrowse();
+ void doReloadCache();
+ void doDeleteCache();
void updateSourceDirectory(const QString& dir);
void setBinaryDirectory(const QString& dir);
void showProgress(const QString& msg, float percent);
void setEnabledState(bool);
void promptForGenerator();
void updateGeneratorLabel(const QString& gen);
+ void setExitAfterGenerate(bool);
protected:
void closeEvent(QCloseEvent*);
@@ -61,6 +65,7 @@
QCMakeThread* CMakeThread;
QProgressBar* ProgressBar;
QToolButton* InterruptButton;
+ bool QuitOnConfigure;
};
// QCMake instance on a thread
Index: CMakeSetupDialog.ui
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.ui,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CMakeSetupDialog.ui 6 Nov 2007 05:04:37 -0000 1.6
+++ CMakeSetupDialog.ui 6 Nov 2007 06:16:11 -0000 1.7
@@ -149,20 +149,6 @@
</widget>
</item>
<item>
- <widget class="QPushButton" name="CancelButton" >
- <property name="text" >
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="HelpButton" >
- <property name="text" >
- <string>Help</string>
- </property>
- </widget>
- </item>
- <item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
Index: QCMake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- QCMake.h 5 Nov 2007 18:20:54 -0000 1.6
+++ QCMake.h 6 Nov 2007 06:16:11 -0000 1.7
@@ -83,6 +83,10 @@
void setProperties(const QCMakeCachePropertyList&);
/// interrupt the configure or generate process
void interrupt();
+ /// delete the cache in binary directory
+ void deleteCache();
+ /// reload the cache in binary directory
+ void reloadCache();
public:
/// get the list of cache properties
Index: QCMake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/QCMake.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- QCMake.cxx 5 Nov 2007 18:20:54 -0000 1.5
+++ QCMake.cxx 6 Nov 2007 06:16:11 -0000 1.6
@@ -248,3 +248,27 @@
return this->AvailableGenerators;
}
+void QCMake::deleteCache()
+{
+ // delete cache
+ this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toAscii().data());
+ // reload to make our cache empty
+ this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toAscii().data());
+ // emit no generator and no properties
+ this->setGenerator(QString());
+ QCMakeCachePropertyList props = this->properties();
+ emit this->propertiesChanged(props);
+}
+
+void QCMake::reloadCache()
+{
+ // emit that the cache was cleaned out
+ QCMakeCachePropertyList props;
+ emit this->propertiesChanged(props);
+ // reload
+ this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toAscii().data());
+ // emit new cache properties
+ props = this->properties();
+ emit this->propertiesChanged(props);
+}
+
Index: CMakeSetupDialog.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetupDialog.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CMakeSetupDialog.cxx 6 Nov 2007 05:04:37 -0000 1.8
+++ CMakeSetupDialog.cxx 6 Nov 2007 06:16:11 -0000 1.9
@@ -26,6 +26,8 @@
#include <QCloseEvent>
#include <QCoreApplication>
#include <QSettings>
+#include <QMenu>
+#include <QMenuBar>
#include "QCMake.h"
#include "QCMakeCacheView.h"
@@ -61,6 +63,7 @@
}
CMakeSetupDialog::CMakeSetupDialog()
+ : QuitOnConfigure(true)
{
// create the GUI
QSettings settings;
@@ -83,7 +86,34 @@
this->statusBar()->addPermanentWidget(this->InterruptButton);
this->statusBar()->addPermanentWidget(this->ProgressBar);
+ QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
+ QAction* a = FileMenu->addAction(tr("&Reload Cache"));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doReloadCache()));
+ a = FileMenu->addAction(tr("&Delete Cache"));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doDeleteCache()));
+ a = FileMenu->addAction(tr("&Exit"));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(close()));
+ a = FileMenu->addAction(tr("Exit after Generation"));
+ a->setCheckable(true);
+ a->setChecked(true); // TODO read from registry
+ QObject::connect(a, SIGNAL(triggered(bool)),
+ this, SLOT(setExitAfterGenerate(bool)));
+ a = FileMenu->addSeparator();
+ // TODO: recent list
+
+ QMenu* ToolsMenu = this->menuBar()->addMenu(tr("&Tools"));
+ a = ToolsMenu->addAction(tr("&Configure"));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doConfigure()));
+ a = ToolsMenu->addAction(tr("&Generate"));
+ QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(doGenerate()));
+ QMenu* HelpMenu = this->menuBar()->addMenu(tr("&Help"));
+ a = HelpMenu->addAction(tr("About"));
+ QObject::connect(a, SIGNAL(triggered(bool)),
+ this, SLOT(doAbout()));
+ a = HelpMenu->addAction(tr("Help"));
+ QObject::connect(a, SIGNAL(triggered(bool)),
+ this, SLOT(doHelp()));
// start the cmake worker thread
this->CMakeThread = new QCMakeThread(this);
@@ -110,10 +140,7 @@
this, SLOT(finishGenerate(int)));
QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)),
- this, SLOT(doOk()));
-
- QObject::connect(this->CancelButton, SIGNAL(clicked(bool)),
- this, SLOT(close()));
+ this, SLOT(doGenerate()));
QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)),
this, SLOT(doSourceBrowse()));
@@ -147,9 +174,6 @@
QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(outputMessage(QString)),
this->Output, SLOT(append(QString)));
-
- QObject::connect(this->HelpButton, SIGNAL(clicked(bool)),
- this, SLOT(doHelp()));
QObject::connect(this->Advanced, SIGNAL(clicked(bool)),
this->CacheValues, SLOT(setShowAdvanced(bool)));
@@ -251,13 +275,13 @@
tr("Error in generation process, project files may be invalid"),
QMessageBox::Ok);
}
- else
+ else if(this->QuitOnConfigure)
{
QApplication::quit();
}
}
-void CMakeSetupDialog::doOk()
+void CMakeSetupDialog::doGenerate()
{
this->InterruptButton->setEnabled(true);
this->setEnabledState(false);
@@ -394,7 +418,6 @@
this->BrowseBinaryDirectoryButton->setEnabled(enabled);
this->ConfigureButton->setEnabled(enabled);
this->GenerateButton->setEnabled(enabled);
- this->CancelButton->setEnabled(enabled);
}
void CMakeSetupDialog::promptForGenerator()
@@ -434,4 +457,41 @@
this->Generator->setText(str);
}
+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)
+{
+ this->QuitOnConfigure = b;
+ // TODO
+ // save to registry
+}
+
More information about the Cmake-commits
mailing list