[cmake-commits] hoffman committed CMakeLists.txt 1.13 1.14
CMakeSetup.cxx 1.16 1.17 MacInstallDialog.ui NONE 1.1
QMacInstallDialog.cxx NONE 1.1 QMacInstallDialog.h NONE 1.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Feb 19 14:06:12 EST 2008
Update of /cvsroot/CMake/CMake/Source/QtDialog
In directory public:/mounts/ram/cvs-serv1240
Modified Files:
CMakeLists.txt CMakeSetup.cxx
Added Files:
MacInstallDialog.ui QMacInstallDialog.cxx QMacInstallDialog.h
Log Message:
ENH: add mac install symlink option to dialog
--- NEW FILE: MacInstallDialog.ui ---
<ui version="4.0" >
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>525</width>
<height>134</height>
</rect>
</property>
<property name="windowTitle" >
<string>Install Command Line Tools</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="3" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>This will create symbolic links to the command line tools of cmake into the specified install folder.</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="InstallPrefix" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Install Folder:</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="choosePathButton" >
<property name="text" >
<string>Choose...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="skipInstallButton" >
<property name="text" >
<string>Skip Install Command Line </string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="doInstallButton" >
<property name="text" >
<string>Install Command Line Links</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
--- NEW FILE: QMacInstallDialog.cxx ---
#include "QMacInstallDialog.h"
#include "cmSystemTools.h"
#include <iostream>
#include <QFileDialog>
#include "ui_MacInstallDialog.h"
class QMacInstallDialog::QMacInstallDialogInternals : public Ui::Dialog
{
public:
};
QMacInstallDialog::QMacInstallDialog(QWidget*w)
:QDialog(w)
{
this->Internals = new QMacInstallDialogInternals;
this->Internals->setupUi(this);
QObject::connect(this->Internals->choosePathButton, SIGNAL(pressed()),
this, SLOT(ShowBrowser()));
QObject::connect(this->Internals->skipInstallButton, SIGNAL(pressed()),
this, SLOT(SkipInstall()));
QObject::connect(this->Internals->doInstallButton, SIGNAL(pressed()),
this, SLOT(DoInstall()));
this->Internals->InstallPrefix->setText("/usr/bin/");
}
QMacInstallDialog::~QMacInstallDialog()
{
delete this->Internals;
}
void QMacInstallDialog::DoInstall()
{
QDir installDir(this->Internals->InstallPrefix->text());
std::string installTo = installDir.path().toStdString();
QDir cmExecDir(QApplication::applicationDirPath());
cmExecDir.cd("../bin");
QFileInfoList list = cmExecDir.entryInfoList();
for (int i = 0; i < list.size(); ++i)
{
QFileInfo fileInfo = list.at(i);
std::string filename = fileInfo.fileName().toStdString();
std::string file = fileInfo.absoluteFilePath().toStdString();
std::string newName = installTo;
newName += "/";
newName += filename;
std::cout << "ln -s [" << file << "] [";
std::cout << newName << "]\n";
cmSystemTools::CreateSymlink(file.c_str(),
newName.c_str());
}
this->done(0);
}
void QMacInstallDialog::SkipInstall()
{
this->done(0);
}
void QMacInstallDialog::ShowBrowser()
{
QString dir = QFileDialog::getExistingDirectory(this,
tr("Enter Install Prefix"), this->Internals->InstallPrefix->text());
if(!dir.isEmpty())
{
this->Internals->InstallPrefix->setText(dir);
}
}
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeLists.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CMakeLists.txt 18 Feb 2008 15:26:28 -0000 1.13
+++ CMakeLists.txt 19 Feb 2008 19:06:10 -0000 1.14
@@ -25,16 +25,20 @@
QCMake.h
QCMakeCacheView.cxx
QCMakeCacheView.h
+ QMacInstallDialog.cxx
+ QMacInstallDialog.h
)
QT4_WRAP_UI(UI_SRCS
CMakeSetupDialog.ui
AddCacheEntry.ui
+ MacInstallDialog.ui
)
QT4_WRAP_CPP(MOC_SRCS
AddCacheEntry.h
CMakeSetupDialog.h
QCMake.h
QCMakeCacheView.h
+ QMacInstallDialog.h
)
QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc)
Index: CMakeSetup.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/QtDialog/CMakeSetup.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- CMakeSetup.cxx 14 Feb 2008 23:18:10 -0000 1.16
+++ CMakeSetup.cxx 19 Feb 2008 19:06:10 -0000 1.17
@@ -20,6 +20,7 @@
#include <QDir>
#include <QTranslator>
#include <QLocale>
+#include "QMacInstallDialog.h"
#include "CMakeSetupDialog.h"
#include "cmDocumentation.h"
@@ -66,7 +67,17 @@
int main(int argc, char** argv)
{
QApplication app(argc, argv);
-
+
+ // if arg for install
+ for(int i =0; i < argc; i++)
+ {
+ if(strcmp(argv[i], "--mac-install") == 0)
+ {
+ QMacInstallDialog setupdialog(0);
+ setupdialog.exec();
+ return 0;
+ }
+ }
// tell the cmake library where cmake is
QDir cmExecDir(QApplication::applicationDirPath());
#if defined(Q_OS_MAC)
--- NEW FILE: QMacInstallDialog.h ---
#ifndef QMacInstallDialog_h
#define QMacInstallDialog_h
#include <QDialog>
class QMacInstallDialog : public QDialog
{
Q_OBJECT;
public:
QMacInstallDialog(QWidget*w);
~QMacInstallDialog();
private slots:
void ShowBrowser();
void SkipInstall();
void DoInstall();
private:
class QMacInstallDialogInternals;
QMacInstallDialogInternals* Internals;
};
#endif
More information about the Cmake-commits
mailing list