Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
walokra committed Nov 28, 2014
0 parents commit 16f6b44
Show file tree
Hide file tree
Showing 20 changed files with 2,231 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Final packages
RPMS/*

# Something Qt Creator generates
debugsources.list
documentation.list
debugfiles.list
debuglinks.list

# object files, makefiles, environment-specific Creator settings
*.o
Makefile
*.pro.user
*.pro.user.*
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Link as many dots as you can in thirty moves. Ported from Dotty which is written for Ubuntu Phone by Robert Ancell (https://launchpad.net/dotty). Similar to Dots game for Android/iOS.
6 changes: 6 additions & 0 deletions harbour-colordots.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=silica-qt5
Name=Colordots
Icon=harbour-colordots
Exec=harbour-colordots
Binary file added harbour-colordots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions harbour-colordots.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TARGET = harbour-colordots

# Application version
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += APP_RELEASE=\\\"$$RELEASE\\\"

CONFIG += sailfishapp
QT += xml

SOURCES += \
main.cpp

HEADERS +=

OTHER_FILES = \
rpm/harbour-colordots.spec \
rpm/harbour-colordots.yaml \
rpm/harbour-colordots.changes \
qml/CoverPage.qml \
qml/MainPage.qml \
qml/Settings.qml \
qml/main.qml \
qml/AboutPage.qml \
qml/Dot.qml \
qml/Line.qml \
qml/storage.js

INCLUDEPATH += $$PWD
31 changes: 31 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif

#include <QScopedPointer>
#include <QQuickView>
#include <QQmlEngine>
#include <QGuiApplication>
#include <QQmlContext>
#include <QtQml>

#include <sailfishapp.h>

int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());

app->setApplicationName("Colordots");
app->setOrganizationName("harbour-colordots");
app->setApplicationVersion(APP_VERSION);

view->setSource(SailfishApp::pathTo("qml/main.qml"));
view->rootContext()->setContextProperty("APP_VERSION", APP_VERSION);
view->rootContext()->setContextProperty("APP_RELEASE", APP_RELEASE);

view->show();

return app->exec();

}
116 changes: 116 additions & 0 deletions qml/AboutPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright 2014 Marko Wallin
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation. See http://www.gnu.org/copyleft/gpl.html the full
* text of the license.
*/

import QtQuick 2.1
import Sailfish.Silica 1.0

Page {
id: aboutPage;
allowedOrientations: Orientation.All;

SilicaFlickable {
id: flickable;

anchors.fill: parent;
contentHeight: contentArea.height + 2 * constants.paddingLarge;

PageHeader {
id: header;
title: qsTr("About Colordots");
}

Column {
id: contentArea;
anchors { top: header.bottom; left: parent.left; right: parent.right }
height: childrenRect.height;

anchors.leftMargin: constants.paddingMedium;
anchors.rightMargin: constants.paddingMedium;
spacing: Theme.paddingMedium;

Item {
anchors { left: parent.left; right: parent.right; }
height: aboutText.height;

Label {
id: aboutText;
width: parent.width;
wrapMode: Text.Wrap;
font.pixelSize: constants.fontSizeMedium;
textFormat: Text.StyledText
linkColor: Theme.highlightColor
onLinkActivated: Qt.openUrlExternally(link);
text: qsTr("")
}
}

SectionHeader { text: qsTr("Version") }

Item {
anchors { left: parent.left; right: parent.right; }
height: versionText.height;

Label {
id: versionText;
width: parent.width;
font.pixelSize: constants.fontSizeMedium;
wrapMode: Text.Wrap;
text: APP_VERSION + "-" + APP_RELEASE;
}
}

SectionHeader { text: qsTr("Developed By"); }

ListItem {
id: root;

Image {
id: rotImage;
source: "images/rot_tr_86x86.png";
width: 86;
height: 86;
}
Label {
anchors { left: rotImage.right; leftMargin: constants.paddingLarge;}
text: "Marko Wallin, @walokra"
font.pixelSize: constants.fontSizeLarge
}
}

Label {
anchors { right: parent.right; rightMargin: Theme.paddingLarge; }
textFormat: Text.StyledText;
linkColor: Theme.highlightColor;
font.pixelSize: Theme.fontSizeSmall;
truncationMode: TruncationMode.Fade;
text: qsTr("Bug reports") + ": " + "<a href='https://github.com/walokra/colordots/issues'>Github</a>";
onLinkActivated: Qt.openUrlExternally(link);
}

SectionHeader { text: qsTr("Powered By") }

ListItem {
Image {
id: qtImage;
source: "images/qt_icon.png";
width: 80;
height: 80;
}
Label {
anchors { left: qtImage.right; leftMargin: constants.paddingLarge; }
text: "Qt + QML";
font.pixelSize: constants.fontSizeLarge;
}
}
}

VerticalScrollDecorator { flickable: flickable }
}

}
87 changes: 87 additions & 0 deletions qml/CoverPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright 2014 Marko Wallin
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation. See http://www.gnu.org/copyleft/gpl.html the full
* text of the license.
*/

import QtQuick 2.1
import Sailfish.Silica 1.0

CoverBackground {
id: cover

onStatusChanged: {
if (status === PageStatus.Activating) {
console.debug("Activating")
moves_label.text = main.n_moves
score_label.text = main.n_cleared
}
}

Image {
anchors.left: parent.left
anchors.leftMargin: Theme.paddingLarge
anchors.bottom: parent.bottom
source: "images/colordots-overlay.svg"
opacity: 0.2
}


Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Theme.paddingSmall
anchors.rightMargin: Theme.paddingSmall
anchors.topMargin: Theme.paddingSmall
anchors.bottomMargin: Theme.paddingSmall
width: parent.width
height: parent.height

property var circle_size: Theme.itemSizeSmall
property int circle_spacing: (width - circle_size * 2) / 3

Rectangle {
id: moves_circle
anchors.top: parent.top
anchors.topMargin: Theme.paddingMedium
x: parent.circle_spacing
width: parent.circle_size
height: parent.circle_size
radius: width / 2
color: "#ad7fa8"
Label {
id: moves_label
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: height * 0.5
color: "white"
}
}

Rectangle {
id: score_circle
anchors.top: parent.top
anchors.topMargin: Theme.paddingMedium
x: parent.width - parent.circle_spacing - width
width: parent.circle_size
height: parent.circle_size
radius: width / 2
color: "#ad7fa8"
Label {
id: score_label
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: height * 0.5
color: "white"
}
}
}

}


27 changes: 27 additions & 0 deletions qml/Dot.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation. See http://www.gnu.org/copyleft/gpl.html the full
* text of the license.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Rectangle {
width: Theme.itemSizeSmall / 2;
property int x_coord
property int y_coord
property real cx
property real cy
x: cx - width / 2
y: cy - height / 2
height: width
radius: width / 2
antialiasing: true
color: "#4e9a06"

Behavior on y { NumberAnimation { duration: 400; easing.type: Easing.OutBounce; easing.amplitude: 0.5; } }
}
56 changes: 56 additions & 0 deletions qml/Line.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation. See http://www.gnu.org/copyleft/gpl.html the full
* text of the license.
*/

import QtQuick 2.0
import Sailfish.Silica 1.0

Rectangle {
property real x1
property real y1

property real x2
property real y2

color: "#4e9a06"
height: Theme.itemSizeExtraSmall;
antialiasing: true

transformOrigin: Item.Left

x: x1
y: y1 - height / 2
width: {
return Math.sqrt (Math.pow ((x2 - x1), 2) + Math.pow ((y2 - y1), 2))
}

rotation: {
var a, m, d
var b = x2 - x1
if (b === 0) {
if (y2 > y1)
return 90
else
return 270
}
a = y2 - y1
m = a / b
d = Math.atan (m) * 180 / Math.PI

if (a < 0 && b < 0)
return d + 180
else if (a >= 0 && b>=0)
return d
else if (a < 0 && b >= 0)
return d
else if (a >= 0 && b < 0)
return d + 180
else
return 0
}
}
Loading

0 comments on commit 16f6b44

Please sign in to comment.