[cig-commits] r11240 - in cs/benchmark/cigma/trunk/scratch: . cg cg/src
luis at geodynamics.org
luis at geodynamics.org
Tue Feb 26 04:51:46 PST 2008
Author: luis
Date: 2008-02-26 04:51:46 -0800 (Tue, 26 Feb 2008)
New Revision: 11240
Added:
cs/benchmark/cigma/trunk/scratch/cg/
cs/benchmark/cigma/trunk/scratch/cg/CMakeLists.txt
cs/benchmark/cigma/trunk/scratch/cg/README
cs/benchmark/cigma/trunk/scratch/cg/src/
cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.cpp
cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.h
cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.ui
cs/benchmark/cigma/trunk/scratch/cg/src/main.cpp
Log:
Cigma GUI utility
Added: cs/benchmark/cigma/trunk/scratch/cg/CMakeLists.txt
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/CMakeLists.txt (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/CMakeLists.txt 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1,86 @@
+# CMakeLists.txt
+#
+# To build the application, run the following commands:
+#
+# mkdir cbuild
+# cd cbuild
+# cmake ../
+# make
+#
+# Here are some reference links:
+#
+# http://wiki.qtcentre.org/index.php?title=Compiling_Qt4_apps_with_CMake
+# http://qtnode.net/wiki/Qt_with_cmake#cmake_for_Qt_4
+#
+
+PROJECT(cg)
+
+
+# ----------------------------------------------------------------------------
+# Require CMake (>= 2.4.0)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
+
+# Verbose - on/off
+SET(CMAKE_VERBOSE_MAKEFILE ON)
+
+# Disallow in-source build
+STRING(COMPARE EQUAL "${cg_SOURCE_DIR}" "${cg_BINARY_DIR}" INSOURCE)
+IF(INSOURCE)
+ MESSAGE(FATAL_ERROR "cg requires an out of source build. Please create a separate binary directory and run cmake there.")
+ENDIF(INSOURCE)
+
+
+# ----------------------------------------------------------------------------
+# Input files
+SET(cg_UIS
+ src/MainWindow.ui
+)
+SET(cg_SOURCES
+ src/main.cpp
+ src/MainWindow.cpp
+)
+SET(cg_MOC_HEADERS
+ src/MainWindow.h
+)
+
+
+# ----------------------------------------------------------------------------
+# Configure Qt4
+FIND_PACKAGE(Qt4 REQUIRED)
+INCLUDE(${QT_USE_FILE})
+
+# Qt4 definitions
+QT4_WRAP_UI(cg_UIS_H ${cg_UIS})
+QT4_WRAP_CPP(cg_MOC_SOURCES ${cg_MOC_HEADERS})
+QT4_AUTOMOC(${cg_SOURCES})
+
+
+# ----------------------------------------------------------------------------
+# Definitions
+ADD_DEFINITIONS(
+ -Wall
+ ${QT_DEFINITIONS}
+)
+
+# Include directories
+INCLUDE_DIRECTORIES(
+ ${CMAKE_BINARY_DIR}
+ ${QT_INCLUDES}
+ src
+)
+
+# The main build target
+ADD_EXECUTABLE(cigma-gui
+ ${cg_SOURCES}
+ ${cg_UIS_H}
+ ${cg_MOC_SOURCES}
+ ${cg_UIS}
+)
+
+# Libraries to be linked to the project
+TARGET_LINK_LIBRARIES(cigma-gui
+ ${QT_LIBRARIES}
+)
+
+
+#EOF
Added: cs/benchmark/cigma/trunk/scratch/cg/README
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/README (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/README 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1 @@
+Cigma GUI Utility
Added: cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.cpp
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.cpp (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.cpp 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1,35 @@
+#include "MainWindow.h"
+
+#include <cstdlib>
+#include <ctime>
+#include <cmath>
+
+// ---------------------------------------------------------------------------
+
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+ setupUi(this);
+
+ connect(actionExit, SIGNAL(triggered()), this, SLOT(fileExit()));
+
+}
+
+
+MainWindow::~MainWindow()
+{
+
+}
+
+
+// ---------------------------------------------------------------------------
+
+
+void MainWindow::fileExit()
+{
+ qApp->exit();
+}
+
+
+// ---------------------------------------------------------------------------
Added: cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.h
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.h (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.h 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1,21 @@
+#ifndef __MAIN_WINDOW_H__
+#define __MAIN_WINDOW_H__
+
+#include <QtGui>
+#include "ui_MainWindow.h"
+
+
+class MainWindow : public QMainWindow, Ui::MainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+public slots:
+ void fileExit();
+
+};
+
+#endif
Added: cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.ui
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.ui (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/src/MainWindow.ui 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1,42 @@
+<ui version="4.0" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" />
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>26</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>File</string>
+ </property>
+ <addaction name="actionExit" />
+ </widget>
+ <addaction name="menuFile" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionExit" >
+ <property name="text" >
+ <string>Exit</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Added: cs/benchmark/cigma/trunk/scratch/cg/src/main.cpp
===================================================================
--- cs/benchmark/cigma/trunk/scratch/cg/src/main.cpp (rev 0)
+++ cs/benchmark/cigma/trunk/scratch/cg/src/main.cpp 2008-02-26 12:51:46 UTC (rev 11240)
@@ -0,0 +1,10 @@
+#include <QApplication>
+#include "MainWindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ MainWindow *win = new MainWindow;
+ win->show();
+ return app.exec();
+}
More information about the cig-commits
mailing list