first commit: set up basic project structure, created simple qt+qml application master
authorZoltan Papp <zoltan.papp@gmx.com>
Mon, 31 Jan 2011 10:07:10 +0000 (12:07 +0200)
committerZoltan Papp <zoltan.papp@gmx.com>
Mon, 31 Jan 2011 10:07:10 +0000 (12:07 +0200)
12 files changed:
.gitignore [new file with mode: 0644]
README [new file with mode: 0644]
common-installs-config.pri [new file with mode: 0644]
common-project-config.pri [new file with mode: 0644]
common-vars.pri [new file with mode: 0644]
quickdice.pro [new file with mode: 0644]
src/main.cpp [new file with mode: 0644]
src/mainwindow.cpp [new file with mode: 0644]
src/mainwindow.h [new file with mode: 0644]
src/src.pro [new file with mode: 0644]
src/test.qml [new file with mode: 0644]
welcome [deleted file]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f26d2f1
--- /dev/null
@@ -0,0 +1,15 @@
+Makefile*
+.moc
+.obj
+lib*.so*
+*.a
+*.prl
+*~
+.project
+.cproject
+*.pro.user*
+core
+core.*
+*-stamp
+src/quickdice
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..5f3882f
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+This is a readme file. It should contain something useful to read =)
diff --git a/common-installs-config.pri b/common-installs-config.pri
new file mode 100644 (file)
index 0000000..4d49820
--- /dev/null
@@ -0,0 +1,88 @@
+###############################################################################
+#
+# This file is part of quickdice.
+#
+# Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+# Contact: Zoltan Papp <zoltan.papp@digia.com>
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+###############################################################################
+
+#------------------------------------------------------------------------------
+# Common installation configuration for all projects.
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# setup the installation prefix
+#------------------------------------------------------------------------------
+!include( common-vars.pri ) : \
+    error( "Unable to include common-vars.pri" )
+
+INSTALL_PREFIX = /usr  # default installation prefix
+
+# default prefix can be overriden by defining PREFIX when running qmake
+isEmpty( PREFIX ) {
+
+    message("====")
+    message("==== NOTE: To override the installation path run: `qmake PREFIX=/custom/path'")
+    message("==== (current installation path is `$${INSTALL_PREFIX}')")
+} else {
+
+    INSTALL_PREFIX = $${PREFIX}
+    message("====")
+    message("==== install prefix set to `$${INSTALL_PREFIX}'")
+}
+
+#------------------------------------------------------------------------------
+# default installation target for applications
+#------------------------------------------------------------------------------
+contains( TEMPLATE, app ) {
+
+    target.path  = $${INSTALL_PREFIX}/bin
+    INSTALLS    += target
+    message("====")
+    message("==== INSTALLS += target")
+}
+
+#------------------------------------------------------------------------------
+# default installation target for libraries
+#------------------------------------------------------------------------------
+contains( TEMPLATE, lib ) {
+
+    target.path  = $${INSTALL_PREFIX}/lib
+    INSTALLS    += target
+    message("====")
+    message("==== INSTALLS += target")
+}
+
+#-----------------------------------------------------------------------------
+# target for header files
+#-----------------------------------------------------------------------------
+!isEmpty( headers.files ) {
+
+    headers.path  = $${INSTALL_PREFIX}/include/$${PROJECT_FULL_NAME}
+    INSTALLS     += headers
+    message("====")
+    message("==== INSTALLS += headers")
+} else {
+
+    message("====")
+    message("==== NOTE: Remember to add your API headers into `headers.files' for installation!")
+}
+
+#------------------------------------------------------------------------------
+# End of File
+#------------------------------------------------------------------------------
+
diff --git a/common-project-config.pri b/common-project-config.pri
new file mode 100644 (file)
index 0000000..bef7a7b
--- /dev/null
@@ -0,0 +1,41 @@
+###############################################################################
+#
+# This file is part of quickdice.
+#
+# Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+# Contact: Zoltan Papp <zoltan.papp@digia.com>
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+###############################################################################
+
+#------------------------------------------------------------------------------
+# Common configuration for all projects.
+#------------------------------------------------------------------------------
+
+CONFIG         += link_pkgconfig
+MOC_DIR         = .moc
+OBJECTS_DIR     = .obj
+RCC_DIR         = resources
+UI_DIR          = ui
+UI_HEADERS_DIR  = ui/include
+UI_SOURCES_DIR  = ui/src
+
+# we don't like warnings...
+QMAKE_CXXFLAGS *= -Werror
+
+#------------------------------------------------------------------------------
+# End of File
+#------------------------------------------------------------------------------
+
diff --git a/common-vars.pri b/common-vars.pri
new file mode 100644 (file)
index 0000000..baf3d67
--- /dev/null
@@ -0,0 +1,43 @@
+###############################################################################
+#
+# This file is part of quickdice.
+#
+# Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+# Contact: Zoltan Papp <zoltan.papp@digia.com>
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+###############################################################################
+
+#------------------------------------------------------------------------------
+# Common variables for all projects.
+#------------------------------------------------------------------------------
+
+#------------------------------------------------------------------------------
+# Project name (used e.g. in include file and doc install path).
+# remember to update debian/* files if you changes this
+#------------------------------------------------------------------------------
+PROJECT_NAME      = quickdice
+PROJECT_FULL_NAME = QuickDice
+
+#------------------------------------------------------------------------------
+# Project version
+# remember to update debian/* files if you changes this
+#-----------------------------------------------------------------------------
+PROJECT_VERSION = 0.0.1
+
+#------------------------------------------------------------------------------
+# End of File
+#------------------------------------------------------------------------------
+
diff --git a/quickdice.pro b/quickdice.pro
new file mode 100644 (file)
index 0000000..9900b55
--- /dev/null
@@ -0,0 +1,39 @@
+###############################################################################
+#
+# This file is part of quickdice.
+#
+# Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+# Contact: Zoltan Papp <zoltan.papp@digia.com>
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+###############################################################################
+
+!include( common-vars.pri ) : \
+    error( "Unable to include common-vars.pri" )
+
+TEMPLATE  = subdirs
+CONFIG   += ordered
+SUBDIRS   = src
+
+#------------------------------------------------------------------------------
+# installation setup
+#------------------------------------------------------------------------------
+!include( common-installs-config.pri ) : \
+    error( "Unable to include common-installs-config.pri!" )
+
+#------------------------------------------------------------------------------
+# End of File
+#------------------------------------------------------------------------------
+
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644 (file)
index 0000000..8fca5d2
--- /dev/null
@@ -0,0 +1,34 @@
+/******************************************************************************
+**
+** This file is part of quickdice.
+**
+** Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+** Contact: Zoltan Papp <zoltan.papp@digia.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License version 2.1 as
+** published by the Free Software Foundation.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+** License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library; if not, write to the Free Software Foundation, Inc.,
+** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+******************************************************************************/
+
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+
+    return a.exec();
+}
+
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
new file mode 100644 (file)
index 0000000..74beed8
--- /dev/null
@@ -0,0 +1,56 @@
+/******************************************************************************
+**
+** This file is part of quickdice.
+**
+** Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+** Contact: Zoltan Papp <zoltan.papp@digia.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License version 2.1 as
+** published by the Free Software Foundation.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+** License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library; if not, write to the Free Software Foundation, Inc.,
+** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+******************************************************************************/
+
+#include "mainwindow.h"
+#include <QtDeclarative/QtDeclarative>
+#include <QtGui/QAction>
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+{
+    QDeclarativeView *view = new QDeclarativeView;
+    setCentralWidget(view);
+
+    QDeclarativeEngine *engine = view->engine();
+    QDeclarativeContext *context = engine->rootContext();
+    context->setContextProperty(QLatin1String("message"),
+                                QLatin1String("Hello World!"));
+    context->setContextProperty(QLatin1String("defaultColor"),
+                                QColor(Qt::lightGray));
+
+    QAction *action = new QAction(this);
+    connect(action,
+            SIGNAL(triggered()),
+            this,
+            SLOT(close()));
+    context->setContextProperty(QLatin1String("action"),
+                                action);
+
+    // FIXME: load it properly from a resource file
+    QString fn = "test.qml";
+    view->setSource(fn);
+}
+
+MainWindow::~MainWindow()
+{
+}
+
diff --git a/src/mainwindow.h b/src/mainwindow.h
new file mode 100644 (file)
index 0000000..04ca51e
--- /dev/null
@@ -0,0 +1,39 @@
+/******************************************************************************
+**
+** This file is part of quickdice.
+**
+** Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+** Contact: Zoltan Papp <zoltan.papp@digia.com>
+**
+** This library is free software; you can redistribute it and/or modify it
+** under the terms of the GNU Lesser General Public License version 2.1 as
+** published by the Free Software Foundation.
+**
+** This library is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+** License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this library; if not, write to the Free Software Foundation, Inc.,
+** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+******************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QtGui/QMainWindow>
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+};
+
+#endif // MAINWINDOW_H
+
diff --git a/src/src.pro b/src/src.pro
new file mode 100644 (file)
index 0000000..20bac34
--- /dev/null
@@ -0,0 +1,72 @@
+###############################################################################
+#
+# This file is part of quickdice.
+#
+# Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
+# Contact: Zoltan Papp <zoltan.papp@digia.com>
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+###############################################################################
+
+!include( ../common-project-config.pri ) : \
+    error( "Unable to include common-project-config.pri" )
+!include( ../common-vars.pri ) : \
+    error( "Unable to include common-vars.pri" )
+
+# -----------------------------------------------------------------------------
+# Target setup
+# -----------------------------------------------------------------------------
+TEMPLATE = app
+TARGET   = $${PROJECT_NAME}
+
+QT      += core \
+           gui \
+           declarative
+
+# -----------------------------------------------------------------------------
+# Dependencies
+# -----------------------------------------------------------------------------
+INCLUDEPATH += .
+
+DEPENDPATH  += $$INCLUDEPATH
+
+# -----------------------------------------------------------------------------
+# Input
+# -----------------------------------------------------------------------------
+HEADERS     += mainwindow.h
+
+SOURCES     += mainwindow.cpp \
+               main.cpp
+
+# TODO: this should be a resource, but for now it will be fine here
+OTHER_FILES += test.qml
+    
+# -----------------------------------------------------------------------------
+# Common installation setup
+# NOTE: remember to set headers.files before this include to have the headers
+#       properly setup.
+# -----------------------------------------------------------------------------
+!include( ../common-installs-config.pri ) : \
+    error( "Unable to include common-installs-config.pri" )
+
+# -----------------------------------------------------------------------------
+# Installation target for the .desktop file
+# -----------------------------------------------------------------------------
+# TODO: desktop file needed
+
+#------------------------------------------------------------------------------
+# End of File
+#------------------------------------------------------------------------------
+
diff --git a/src/test.qml b/src/test.qml
new file mode 100644 (file)
index 0000000..b1af437
--- /dev/null
@@ -0,0 +1,37 @@
+import Qt 4.7
+
+Rectangle {
+    width: 640
+    height: 480
+    color: defaultColor
+
+    Text {
+        id: name
+        text: message
+        anchors.centerIn: parent
+    }
+
+    Rectangle {
+        id: myButton
+        width: 250
+        height: 25
+        color: defaultColor
+
+        MouseArea {
+            anchors.fill: parent
+            onClicked: {
+                console.log("onMyButtonClicked");
+                action.trigger();
+            }
+
+        }
+
+        Text {
+            id: myButtonText
+            text: ">> Close button <<"
+            font.pointSize: 16
+            anchors.centerIn: parent
+        }
+    }
+
+}
diff --git a/welcome b/welcome
deleted file mode 100644 (file)
index e69de29..0000000