test master
authorMarkus Scharnowski <markus.scharnowski@gmail.com>
Sat, 17 Jul 2010 11:54:40 +0000 (13:54 +0200)
committerMarkus Scharnowski <markus.scharnowski@gmail.com>
Sat, 17 Jul 2010 11:54:40 +0000 (13:54 +0200)
12 files changed:
src/Push-It.pro [new file with mode: 0644]
src/Push-It.pro.user [new file with mode: 0644]
src/aboutdialog.cpp [new file with mode: 0644]
src/aboutdialog.hpp [new file with mode: 0644]
src/fullscreenexitbutton.h [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/showfulllistdialog.cpp [new file with mode: 0644]
src/showfulllistdialog.hpp [new file with mode: 0644]
src/timekeeper.cpp [new file with mode: 0644]
src/timekeeper.h [new file with mode: 0644]

diff --git a/src/Push-It.pro b/src/Push-It.pro
new file mode 100644 (file)
index 0000000..874c138
--- /dev/null
@@ -0,0 +1,35 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-06-27T22:12:43
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+TARGET = Push-It
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+        mainwindow.cpp \
+    timekeeper.cpp \
+    aboutdialog.cpp \
+    showfulllistdialog.cpp
+
+HEADERS  += mainwindow.h \
+    timekeeper.h \
+    aboutdialog.hpp \
+    showfulllistdialog.hpp \
+    fullscreenexitbutton.h
+
+FORMS    +=
+
+CONFIG += mobility
+MOBILITY =
+
+symbian {
+    TARGET.UID3 = 0xe756b212
+    # TARGET.CAPABILITY +=
+    TARGET.EPOCSTACKSIZE = 0x14000
+    TARGET.EPOCHEAPSIZE = 0x020000 0x800000
+}
diff --git a/src/Push-It.pro.user b/src/Push-It.pro.user
new file mode 100644 (file)
index 0000000..8f58cb5
--- /dev/null
@@ -0,0 +1,379 @@
+<!DOCTYPE QtCreatorProject>
+<qtcreator>
+ <data>
+  <variable>ProjectExplorer.Project.ActiveTarget</variable>
+  <value type="int">1</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.EditorSettings</variable>
+  <valuemap type="QVariantMap">
+   <value key="EditorConfiguration.Codec" type="QByteArray">System</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.0</variable>
+  <valuemap type="QVariantMap">
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt in PATH Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt in PATH Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.2" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.6.3 OpenSource Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.3" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.6.3 OpenSource Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-desktop</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">4</value>
+   <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Push-It</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">Push-It.pro</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.1</variable>
+  <valuemap type="QVariantMap">
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Maemo</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.MaemoDeviceTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">true</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString">/usr/local/bin/Push-It</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">false</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString">/usr/local/bin/Push-It</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">6</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
+   <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+    <value key=".ProFile" type="QString">Push-It.pro</value>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">n900</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoRunConfiguration</value>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.Arguments" type="QVariantList"/>
+    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.DebuggingHelpersLastDeployed" type="QVariantMap"/>
+    <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">4</value>
+    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
+     <value key="192.168.2.35" type="QDateTime">2010-07-16T22:25:04</value>
+    </valuemap>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Target.2</variable>
+  <valuemap type="QVariantMap">
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt Simulator</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.QtSimulatorTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-simulator</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">5</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
+     <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
+    </valuemap>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
+     <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
+     <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
+    <value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
+    <valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/markus/workspace/remoteProjects/mine/push-it/Push-It-build-simulator</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">5</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
+   <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Push-It</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">Push-It.pro</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
+   </valuemap>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
+  </valuemap>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.TargetCount</variable>
+  <value type="int">3</value>
+ </data>
+ <data>
+  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+  <value type="int">4</value>
+ </data>
+</qtcreator>
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp
new file mode 100644 (file)
index 0000000..17c14b5
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <QPushButton>
+#include <QTextEdit>
+#include <QHBoxLayout>
+#include <QLabel>
+
+#include "aboutdialog.hpp"
+
+AboutDialog::AboutDialog(QString name, QString customUrl, QWidget *parent) :
+    QDialog(parent)
+{
+  browserGeneral = new QTextBrowser;
+  browserGeneral->setOpenExternalLinks(true);
+  browserDonate = new QTextBrowser;
+  browserDonate->setOpenExternalLinks(true);
+  browserWebsite = new QTextBrowser;
+  browserWebsite->setOpenExternalLinks(true);
+  browserFeedback = new QTextBrowser;
+  browserFeedback->setOpenExternalLinks(true);
+
+  tabs = new QTabWidget;
+  tabs->insertTab(1,browserGeneral,tr("&General"));
+  tabs->insertTab(2,browserDonate,tr("&Donate"));
+  tabs->insertTab(3,browserWebsite,tr("&Website"));
+  tabs->insertTab(4,browserFeedback,tr("&Feedback"));
+
+  QHBoxLayout *layout = new QHBoxLayout();
+  layout->addWidget(tabs);
+
+  setLayout(layout);
+  setBaseSize(700,400);
+  setMinimumWidth(700);
+//  setMinimumHeight(400);
+
+  setProgramName(name);
+  setProgramUrl(customUrl);
+  setGeneralHtmlText();
+  setWebsiteHtmlText();
+  setDonateHtmlText();
+  setFeedbackHtmlText();
+  hide();
+}
+
+AboutDialog::~AboutDialog()
+{
+}
+
+int AboutDialog::setProgramName(QString name)
+{
+  programName = name;
+
+  QString wTitle = "About " + name;
+  setWindowTitle(tr(wTitle.toStdString().c_str()));
+
+  refreshDefaultTexts();
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::setProgramUrl(QString url)
+{
+  programUrl = url;
+  refreshDefaultTexts();
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::setGeneralHtmlText(QString htmlText)
+{
+  if("" == htmlText)
+  {
+    textGeneral =
+        "<p>" + programName + "</p>"
+        "<p>Idea and programming: <a href=\"mailto:markus.scharnowski@gmail.com?subject=Thank you for " + programName +
+        "&body=Hello Markus,\">Markus Scharnowski</a></p>"
+        ;
+  }
+  else
+  {
+    textGeneral = htmlText;
+  }
+
+  browserGeneral->setText(tr(textGeneral.toStdString().c_str()));
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::setDonateHtmlText(QString htmlText)
+{
+  if("" == htmlText)
+  {
+    textDonate =
+        "You like what you have in your hands? You use it on regular basis? Support the devolpment by making a donation."
+        "<p>Donate through "
+        "<a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TPX9PV29D4L9Y\">paypal</a></p>"
+        "<p>Visit the projects <a href=\"https://sites.google.com/site/markusscharnowski/donate\">donation website</a></p>"
+        ;
+  }
+  else
+  {
+    textDonate = htmlText;
+  }
+
+  browserDonate->setText(tr(textDonate.toStdString().c_str()));
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::setWebsiteHtmlText(QString htmlText)
+{
+  if("" == htmlText)
+  {
+    textWebsite =
+        "<p>Visit</p>"
+        "<p>"
+        "<a href=\""+ programUrl + "\">" + programUrl + "</a><br>"
+        "<a href=\"http://sites.google.com/site/markusscharnowski\">http://sites.google.com/site/markusscharnowski</a>"
+        "</p>"
+        ;
+  }
+  else
+  {
+    textWebsite = htmlText;
+  }
+
+  browserWebsite->setText(tr(textWebsite.toStdString().c_str()));
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::setFeedbackHtmlText(QString htmlText)
+{
+  if("" == htmlText)
+  {
+    textFeedback =
+        "<p>Do you have ideas for improving the program? You want a specific functionality? "
+        ""
+        "You have found a bug?</p>"
+        "<p>Email <a href=\"mailto:markus.scharnowski@gmail.com?subject=SW Feedback " + programName +
+        " &body=Hello Markus,\">Feedback</a></p>"
+        ;
+  }
+  else
+  {
+    textFeedback = htmlText;
+  }
+
+  browserFeedback->setText(tr(textFeedback.toStdString().c_str()));
+  return EXIT_SUCCESS;
+}
+
+int AboutDialog::refreshDefaultTexts()
+{
+  setGeneralHtmlText("");
+  setWebsiteHtmlText("");
+  setDonateHtmlText("");
+  setFeedbackHtmlText("");
+  return EXIT_SUCCESS;
+}
diff --git a/src/aboutdialog.hpp b/src/aboutdialog.hpp
new file mode 100644 (file)
index 0000000..d559965
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef ABOUTDIALOG_HPP
+#define ABOUTDIALOG_HPP
+
+#include <QTextBrowser>
+#include <QDialog>
+#include <QTranslator>
+#include <QTabWidget>
+
+class AboutDialog : public QDialog
+{
+  Q_OBJECT
+
+public:
+  explicit AboutDialog(QString name = "", QString customUrl = "", QWidget *parent = 0);
+  ~AboutDialog();
+  int setProgramName(QString name);
+  int setProgramUrl(QString url);
+  int setGeneralHtmlText(QString htmlText = "");
+  int setDonateHtmlText(QString htmlText = "");
+  int setWebsiteHtmlText(QString htmlText = "");
+  int setFeedbackHtmlText(QString htmlText = "");
+  QTabWidget *tabs;
+
+private:
+  int refreshDefaultTexts();
+
+  QTextBrowser *browserGeneral;
+  QTextBrowser *browserDonate;
+  QTextBrowser *browserWebsite;
+  QTextBrowser *browserFeedback;
+
+  QString textGeneral;
+  QString textDonate;
+  QString textFeedback;
+  QString textWebsite;
+
+  QString programName;
+  QString programUrl;
+};
+
+#endif // ABOUTDIALOG_HPP
diff --git a/src/fullscreenexitbutton.h b/src/fullscreenexitbutton.h
new file mode 100644 (file)
index 0000000..5ff5eb2
--- /dev/null
@@ -0,0 +1,104 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ ** All rights reserved.
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
+ **
+ ** This file is part of the examples of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** No Commercial Usage
+ ** This file contains pre-release code and may not be distributed.
+ ** You may use this file in accordance with the terms and conditions
+ ** contained in the Technology Preview License Agreement accompanying
+ ** this package.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file.  Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Nokia gives you certain additional
+ ** rights.  These rights are described in the Nokia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** If you have questions regarding the use of this file, please contact
+ ** Nokia at qt-info@nokia.com.
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef FULLSCREENEXITBUTTON_H
+#define FULLSCREENEXITBUTTON_H
+
+#include <QtGui/qtoolbutton.h>
+#include <QtGui/qevent.h>
+
+class FullScreenExitButton : public QToolButton
+{
+  Q_OBJECT
+public:
+  inline explicit FullScreenExitButton(QWidget *parent);
+
+protected:
+  inline bool eventFilter(QObject *obj, QEvent *ev);
+};
+
+FullScreenExitButton::FullScreenExitButton(QWidget *parent)
+  : QToolButton(parent)
+{
+  Q_ASSERT(parent);
+#ifdef Q_WS_MAEMO_5
+  // set the fullsize icon from Maemo's theme
+  setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
+#endif
+  // ensure that our size is fixed to our ideal size
+  setFixedSize(sizeHint());
+
+  // set the background to 0.5 alpha
+  QPalette pal = palette();
+  QColor backgroundColor = pal.color(backgroundRole());
+  backgroundColor.setAlpha(128);
+  pal.setColor(backgroundRole(), backgroundColor);
+  setPalette(pal);
+
+  // ensure that we're painting our background
+  setAutoFillBackground(true);
+
+  // when we're clicked, tell the parent to exit fullscreen
+  connect(this, SIGNAL(clicked()), parent, SLOT(slotFullscreenExit()));
+
+  // install an event filter to listen for the parent's events
+  parent->installEventFilter(this);
+}
+
+bool FullScreenExitButton::eventFilter(QObject *obj, QEvent *ev)
+{
+  if (obj != parent())
+    return QToolButton::eventFilter(obj, ev);
+
+  QWidget *parent = parentWidget();
+  bool isFullScreen = parent->windowState() & Qt::WindowFullScreen;
+
+  switch (ev->type()) {
+  case QEvent::WindowStateChange:
+    setVisible(isFullScreen);
+    if (isFullScreen)
+      raise();
+    // fall through
+  case QEvent::Resize:
+    if (isVisible())
+      move(parent->width() - width(),
+           parent->height() - height());
+    break;
+  default:
+    break;
+  }
+
+  return QToolButton::eventFilter(obj, ev);
+}
+
+#endif
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644 (file)
index 0000000..bdea66a
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+    <Push-It: One button - stopwatch like - program>
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <QtGui/QApplication>
+#include <QTextCodec>
+#include <iostream>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+  QTextCodec *utfCodec = QTextCodec::codecForName("UTF-8"); //creating new utf-8 codec
+  QTextCodec::setCodecForTr(utfCodec); // setting the utf-8 codec for the tr() tags
+  QTextCodec::setCodecForLocale(utfCodec);
+  QTextCodec::setCodecForCStrings(utfCodec);
+  QApplication a(argc, argv);
+  MainWindow w;
+
+  //  qDebug(QTextCodec::codecForLocale()->name());
+
+#if defined(Q_WS_S60)
+  w.showMaximized();
+#else
+  w.show();
+#endif
+
+  return a.exec();
+}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
new file mode 100644 (file)
index 0000000..84ebb31
--- /dev/null
@@ -0,0 +1,683 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QDataStream>
+#include <QApplication>
+#include <QLayout>
+#include <QInputDialog>
+#include <QTextCodec>
+
+#include <assert.h>
+#include <sstream>
+#include <iomanip>
+#include <iostream>
+
+#include "mainwindow.h"
+#include "aboutdialog.hpp"
+#include "showfulllistdialog.hpp"
+
+#define DEBUG_OUTPUT
+#undef DEBUG_OUTPUT
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent)
+{
+  snprintf(mainButtonStartText,BUFSIZ-1,
+           "&Start\n\n"
+           "If this program is used uncautiously\n"
+           "you could break your device physically.\n"
+           "Always be sure that you use this\n"
+           "software and the corresponding\n"
+           "hardware in a way that the hardware\n"
+           "won't get damaged."
+           );
+  this->setupUi();
+  fsExitButton = new FullScreenExitButton(this);
+  fsExitButton->hide();
+
+  timer = new QTimer(this);
+  connect(timer, SIGNAL(timeout()), this, SLOT(mainButtonTimeoutUpdate()));
+  timerRefreshTimeMs = 100;
+
+  connect(actionReset, SIGNAL(triggered()), this , SLOT(resetProgram()));
+  connect(actionResetFs, SIGNAL(triggered()), this , SLOT(resetProgramAndFullscreen()));
+//  connect(actionResetFs, SIGNAL(triggered()), this , SLOT(actionReset->Trigger));
+  connect(actionSimulated_click, SIGNAL(triggered()), this , SLOT(mainButtonRefresh()));
+  connect(actionPause, SIGNAL(triggered()), this , SLOT(pauseCounting()));
+  connect(actionSave_full_list, SIGNAL(triggered()), this , SLOT(saveToFile()));
+  connect(actionEnable_full_date, SIGNAL(triggered()), this , SLOT(toggleFullDate()));
+  connect(actionEnable_time_and_date, SIGNAL(triggered()), this , SLOT(toggleTimeDate()));
+  connect(actionAbout, SIGNAL(triggered()), this , SLOT(about()));
+  connect(actionShow_full_list, SIGNAL(triggered()), this , SLOT(showFullList()));
+  connect(action_Fullscreen, SIGNAL(triggered()), this, SLOT(showFullScreenHandler()));
+  connect(actionChangeNumberOfLines, SIGNAL(triggered()), this, SLOT(changeNumberOfLines()));
+  connect(actionChangeFontSize, SIGNAL(triggered()), this, SLOT(changeFontSize()));
+
+  connect(this->mainButton, SIGNAL(clicked()), this, SLOT(mainButtonRefresh()));
+
+  changeNumberOfLines(8);
+  changeFontSize(30);
+  resetProgram();
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+int MainWindow::updateTime()
+{
+  hitCount++;
+  if(1 == hitCount)
+  {
+    overallTime.start();
+  }
+  overallTime.update();
+
+  return EXIT_SUCCESS;
+}
+
+void MainWindow::mainButtonRefresh()
+{
+  updateTime();
+  QString latest = generateHistoryString();
+  QString string = completeString.remove(mainButtonStartText);
+  QStringList lines;
+  QString header = getHeaderLine();
+
+  /* timer handling */
+  if(NULL != timer)
+  {
+    if(1 == hitCount)
+    {
+      timer->start(timerRefreshTimeMs);
+    }
+    else if(hitCount > 1)
+    {
+      if(!timer->isActive())
+      {
+        timer->start(timerRefreshTimeMs);
+      }
+    }
+  }
+
+  if(1 == hitCount)
+  {
+    mainButtonRefreshTextOnly();
+    return;
+  }
+  lines = string.split("\n");
+
+  /* add new entry information directly behind the current header
+       wihtout start information if there is any.
+    */
+  if(lines.length() > 0)
+  {
+    if(lines[0].indexOf("#0") > 0)
+    {
+      lines[0].truncate(lines[0].indexOf("#0"));
+    }
+    lines[0].append(latest);
+  }
+
+  string = lines.join("\n").prepend("\n").prepend(header);
+  completeString = string;
+  lines = string.split("\n");
+  /* adjust the total number of lines of the button */
+  if(lines.length() > maximumNumberOfLines)
+  {
+    while(lines.length() > maximumNumberOfLines
+          && lines.length() > 0)
+    {
+      lines.removeLast();
+    }
+  }
+  else if(lines.length() < maximumNumberOfLines)
+  {
+    while(lines.length() < maximumNumberOfLines)
+    {
+      lines.append(" ");
+    }
+  }
+  string = lines.join("\n");
+  this->mainButton->setText(tr(string.toStdString().c_str()));
+  toggleActionPause();
+#ifdef DEBUG_OUTPUT
+  std::cout << "---" << std::endl << string.toStdString() << std::endl << "-" << string.split("\n").length() << "-" << std::endl;
+#endif
+}
+
+QString MainWindow::generateHistoryString()
+{
+  QString result;
+  char tmp[BUFSIZ];
+  std::string previousStr, lastStr, firstStr;
+
+  previousStr = overallTime.getPreviousTimeString();
+  lastStr = overallTime.getLastTimeString();
+  firstStr = overallTime.getStartTimeString();
+
+   snprintf(tmp,BUFSIZ-1,
+      "\n"
+//      "Δ Delta %.3lfs "
+//      "⅀∑ Total %.3lfs "
+      "Δ %.3lfs "
+      "∑ %.3lfs "
+      "Avg %.3lfs"
+      ,
+      overallTime.getDeltaLastToPrev(),
+      overallTime.getDeltaLastToStart(),
+      overallTime.getDeltaLastToStart()/(hitCount-1)
+      );
+
+  result = tr(tmp);
+
+  if(true == timeOutput)
+  {
+    result.prepend(lastStr.c_str());
+  }
+
+  return result;
+}
+
+int MainWindow::resetCounters()
+{
+  hitCount=-1;
+  updateTime();
+  return EXIT_SUCCESS;
+}
+
+int MainWindow::resetUi()
+{
+  this->mainButton->setText(tr(mainButtonStartText));
+  this->actionPause->setText(tr("&Pause"));
+  this->actionEnable_full_date->setDisabled(true);
+
+  completeString = this->mainButton->text();
+  timeOutput = false;
+
+  return EXIT_SUCCESS;
+}
+
+void MainWindow::resetProgram()
+{
+  resetCounters();
+  resetUi();
+  if(timer->isActive())
+  {
+    timer->stop();
+  }
+}
+
+void MainWindow::pauseCounting()
+{
+  overallTime.pause();
+  toggleTimer();
+  toggleActionPause();
+}
+
+int MainWindow::toggleTimer()
+{
+  if(timer->isActive())
+  {
+    timer->stop();;
+  }
+  else
+  {
+    timer->start(timerRefreshTimeMs);
+  }
+  return EXIT_SUCCESS;
+}
+
+void MainWindow::mainButtonTimeoutUpdate()
+{
+  if(!timer->isActive())
+  {
+    assert(0 && "Unintended use");
+    return;
+  }
+  else if(overallTime.isPaused())
+  {
+    timer->stop();
+    return;
+  }
+
+  QString string = this->mainButton->text();
+  QStringList lines = string.split("\n");
+  if(lines.length() >= 1)
+  {
+    lines[0] = getHeaderLine();
+  }
+  else
+  {
+    assert(0 && "Lines are missing");
+  }
+  this->mainButton->setText(tr(lines.join("\n").toStdString().c_str()));
+
+  //update stored string
+  lines = completeString.split("\n");
+  if(lines.length() >= 1)
+  {
+    lines[0] = getHeaderLine();
+  }
+  completeString = lines.join("\n");
+}
+
+QString MainWindow::getHeaderLine()
+{
+  QString headerLine;
+  std::stringstream sstr;
+
+  double runTime = overallTime.getDeltaNowToStart();
+  double time = 0;
+  int hours = 0;
+  int min = 0;
+
+  sstr << "#" << hitCount << " ";
+  sstr << std::setfill('0');
+  hours = (int)(runTime/3600);
+  sstr << hours << ":"; //hour
+  time = runTime - 3600*hours;
+  min = (int)(time/60);
+  sstr << std::setw(2) << min << ":"; //minute
+  time = runTime - 3600*hours - 60*min;
+  sstr.setf(std::ios::fixed);
+  sstr.setf(std::ios::showpoint);
+  sstr.precision(1);
+  sstr << time << " "; //seconds
+  if(true == timeOutput)
+  {
+    sstr << "#0 " << overallTime.getStartTimeString();
+  }
+
+  headerLine = sstr.str().c_str();
+  return headerLine;
+}
+
+void MainWindow::saveToFile()
+{
+  ShowFullListDialog *listHander;
+  listHander = new ShowFullListDialog(0,completeString);
+  listHander->save();
+}
+
+int MainWindow::toggleActionPause()
+{
+  QString str = this->actionPause->text();
+  if(str == "&Pause" && overallTime.isPaused())
+  {
+    this->actionPause->setText(tr("R&esume"));
+  }
+  else
+  {
+    this->actionPause->setText(tr("&Pause"));
+  }
+  return EXIT_SUCCESS;
+}
+
+int MainWindow::updateUiText()
+{
+  toggleActionPause();
+  return EXIT_SUCCESS;
+}
+
+void MainWindow::toggleFullDate()
+{
+  if(overallTime.isDateForStringsEnabled())
+  {
+    overallTime.disableDateForStrings();
+  }
+  else
+  {
+    overallTime.enableDateForStrings();
+  }
+}
+
+void MainWindow::toggleTimeDate()
+{
+  if(this->actionEnable_time_and_date->isChecked())
+  {
+    this->actionEnable_full_date->setEnabled(true);
+    timeOutput = true;
+  }
+  else
+  {
+    this->actionEnable_full_date->setDisabled(true);
+    timeOutput = false;
+  }
+}
+
+void MainWindow::about()
+{
+  AboutDialog *pa = new AboutDialog;
+  QTextBrowser *examples = new QTextBrowser;
+  examples->setOpenExternalLinks(true);
+  examples->setHtml(
+      "<p><b><a href =\"http://sites.google.com/site/markusscharnowski/n/pushit/real-life-examples\">Examples website with videos and pictures.</a></b><p>"
+
+      "<p>Excerpt:</p>"
+
+      "<p><b>Pull ups</b></p>"
+      "<p>Place the phone add the position where you are in the highest position, so you can hit it with your nose. In my case I mount the Nokia N900 above a door with the help of some tesa-strips. I also tried it without tesa-strips but after some pushes on the N900 I was too anxious that it could fall down on the floor. So I recommend some safety mechanism to have fun with your device now and in the future. Every time you pulling yourself up, you touch the screen of the N900 with your nose. So you will always know how many pull ups you have done.</p>"
+
+      "<p><b>Push ups</b></p>"
+      "<p>Place the smartphone just below your nose so you can hit it with the nose when in the lowest position. And then start pushing up.</p>"
+
+      "<p><b>Crunches</b></p>"
+      "Doing crunches is a tiny bit more tricky. You have to go into your crunching position (laying on your back, feet up) and place your phone behind your head. Positioned well, you will be able to touch your phone with one of your thumbs every time you are going down (assuming you fold your hands behind your head when doing crunches)."
+
+      "<p><b>Lower back exercise</b></p>"
+      "<p>Place the phone just below your nose so you can hit it with the nose. I don't know how this exercise is called - if you know it, please let me know it too.<br>"
+      "To execute this exercise I lay myself on some pillows on a bench. My legs will get support by a table. The exercise itself is moving you upper body down to the phone and up again till your back is strait like when your are standing on your feet.</p>"
+      );
+
+  pa->setProgramName(windowTitle());
+  pa->setProgramUrl("http://sites.google.com/site/markusscharnowski/n/pushit");
+  pa->tabs->insertTab(5,examples,tr("&Examples"));
+  pa->setMinimumHeight(400);
+
+  pa->show();
+}
+
+void MainWindow::showFullList()
+{
+  ShowFullListDialog *ps = new ShowFullListDialog(0,completeString);
+  ps->show();
+}
+
+void MainWindow::showFullScreenHandler()
+{
+  bool isFullScreen = windowState() & Qt::WindowFullScreen;
+  if (isFullScreen)
+  {
+    showNormal();
+//    this->action_Fullscreen->setText(tr("&Fullscreen"));
+  }
+  else
+  {
+    showFullScreen();
+    fsExitButton->show();
+//    this->action_Fullscreen->setText(tr("&Disable Fullscreen"));
+  }
+}
+
+void MainWindow::slotFullscreenExit()
+{
+  action_Fullscreen->trigger();
+}
+
+void MainWindow::setupUi()
+{
+  if (this->objectName().isEmpty())
+  {
+    this->setObjectName(QString::fromUtf8("MainWindow"));
+  }
+  setBaseSize(800,480);
+  resize(800,480);
+
+  /* main button */
+  mainButton = new QPushButton;
+  mainButton->setObjectName(QString::fromUtf8("mainButton"));
+  QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+  mainButton->setSizePolicy(sizePolicy);
+
+  QFont font1;
+  font1.setPointSize(26);
+  font1.setBold(true);
+  font1.setWeight(75);
+
+  mainButton->setFont(font1);
+  mainButton->setAutoFillBackground(true);
+  mainButton->setDefault(true);
+  mainButton->setFlat(true);
+  mainButton->setStyleSheet("text-align:center;");;
+
+  /* default font */
+  QFont font;
+  font.setPointSize(12);
+  this->setFont(font);
+
+  /* central widget */
+  centralWidget = new QWidget(this);
+  centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
+  this->setCentralWidget(centralWidget);
+
+  QHBoxLayout *mainLayout = new QHBoxLayout;
+  mainLayout->addWidget(mainButton);
+  centralWidget->setLayout(mainLayout);
+
+  /* actions for te menu */
+  actionReset = new QAction(this);
+  actionReset->setObjectName(QString::fromUtf8("actionReset"));
+
+  actionResetFs = new QAction(this);
+  actionResetFs->setObjectName(QString::fromUtf8("actionResetFs"));
+
+  actionSimulated_click = new QAction(this);
+  actionSimulated_click->setObjectName(QString::fromUtf8("actionSimulated_click"));
+
+  actionPause = new QAction(this);
+  actionPause->setObjectName(QString::fromUtf8("actionPause"));
+
+  actionShow_full_list = new QAction(this);
+  actionShow_full_list->setObjectName(QString::fromUtf8("actionShow_full_list"));
+
+  actionSave_full_list = new QAction(this);
+  actionSave_full_list->setObjectName(QString::fromUtf8("actionSave_full_list"));
+
+  actionAbout = new QAction(this);
+  actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
+
+  actionEnable_full_date = new QAction(this);
+  actionEnable_full_date->setObjectName(QString::fromUtf8("actionEnable_full_date"));
+  actionEnable_full_date->setCheckable(true);
+
+  actionEnable_time_and_date = new QAction(this);
+  actionEnable_time_and_date->setObjectName(QString::fromUtf8("actionEnable_time_and_date"));
+  actionEnable_time_and_date->setCheckable(true);
+
+  action_Fullscreen = new QAction(this);
+  action_Fullscreen->setObjectName(QString::fromUtf8("action_Fullscreen"));
+  action_Fullscreen->setCheckable(true);
+
+  actionChangeNumberOfLines = new QAction(this);
+  actionChangeNumberOfLines->setObjectName(QString::fromUtf8("actionChangeNumberOfLines"));
+
+  actionChangeFontSize = new QAction(this);
+  actionChangeFontSize->setObjectName(QString::fromUtf8("actionChangeFontSize"));
+
+  /* menu */
+  menuBar = new QMenuBar(this);
+  menuBar->setObjectName(QString::fromUtf8("menuBar"));
+  menuBar->setGeometry(QRect(0, 0, 800, 25));
+  menuPush_It_Menu = new QMenu(menuBar);
+  menuPush_It_Menu->setObjectName(QString::fromUtf8("menuPush_It_Menu"));
+  menuHelp = new QMenu(menuBar);
+  menuHelp->setObjectName(QString::fromUtf8("menuHelp"));
+  menuData = new QMenu(menuBar);
+  menuData->setObjectName(QString::fromUtf8("menuData"));
+  menuView = new QMenu(menuBar);
+  menuView->setObjectName(QString::fromUtf8("menuView"));
+  this->setMenuBar(menuBar);
+
+  menuBar->addAction(menuPush_It_Menu->menuAction());
+  menuBar->addAction(menuView->menuAction());
+  menuBar->addAction(menuData->menuAction());
+  menuBar->addAction(menuHelp->menuAction());
+  menuPush_It_Menu->addAction(actionReset);
+  menuPush_It_Menu->addAction(actionPause);
+  menuPush_It_Menu->addAction(actionSimulated_click);
+  menuHelp->addAction(actionAbout);
+  menuData->addAction(actionEnable_time_and_date);
+  menuData->addAction(actionEnable_full_date);
+  menuData->addSeparator();
+  menuData->addAction(actionSave_full_list);
+  menuData->addAction(actionShow_full_list);
+  menuView->addAction(action_Fullscreen);
+  menuView->addAction(actionResetFs);
+  menuView->addAction(actionChangeNumberOfLines);
+  menuView->addAction(actionChangeFontSize);
+
+  retranslateUi();
+
+  QMetaObject::connectSlotsByName(this);
+} // setupUi
+
+void MainWindow::retranslateUi()
+{
+  this->setWindowTitle(QApplication::translate("MainWindow", "Push It!", 0, QApplication::UnicodeUTF8));
+  actionReset->setText(QApplication::translate("MainWindow", "&Reset", 0, QApplication::UnicodeUTF8));
+  actionResetFs->setText(QApplication::translate("MainWindow", "&Reset+Fullscreen", 0, QApplication::UnicodeUTF8));
+  actionSimulated_click->setText(QApplication::translate("MainWindow", "Push &it!", 0, QApplication::UnicodeUTF8));
+  actionPause->setText(QApplication::translate("MainWindow", "&Pause", 0, QApplication::UnicodeUTF8));
+  actionShow_full_list->setText(QApplication::translate("MainWindow", "Show full &list", 0, QApplication::UnicodeUTF8));
+  actionSave_full_list->setText(QApplication::translate("MainWindow", "&Save full list", 0, QApplication::UnicodeUTF8));
+  actionAbout->setText(QApplication::translate("MainWindow", "&About", 0, QApplication::UnicodeUTF8));
+  actionEnable_full_date->setText(QApplication::translate("MainWindow", "Enable &full date", 0, QApplication::UnicodeUTF8));
+  actionEnable_time_and_date->setText(QApplication::translate("MainWindow", "Enable &time and date", 0, QApplication::UnicodeUTF8));
+  action_Fullscreen->setText(QApplication::translate("MainWindow", "&Fullscreen", 0, QApplication::UnicodeUTF8));
+  actionChangeNumberOfLines->setText(QApplication::translate("MainWindow", "&Lines", 0, QApplication::UnicodeUTF8));
+  actionChangeFontSize->setText(QApplication::translate("MainWindow", "Font &size", 0, QApplication::UnicodeUTF8));
+  mainButton->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
+  menuPush_It_Menu->setTitle(QApplication::translate("MainWindow", "&Counter", 0, QApplication::UnicodeUTF8));
+  menuHelp->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8));
+  menuData->setTitle(QApplication::translate("MainWindow", "&Data", 0, QApplication::UnicodeUTF8));
+  menuView->setTitle(QApplication::translate("MainWindow", "&View", 0, QApplication::UnicodeUTF8));
+} // retranslateUi
+
+void MainWindow::changeNumberOfLines(int number)
+{
+  int maxLines = 1000;
+  bool ok = true;
+  if(number == 0)
+  {
+    number = QInputDialog::getInt(this, tr("Lines"),
+                                  tr("Number of lines to be displayed:"),
+                                  maximumNumberOfLines, 0, maxLines, 1,
+                                  &ok);
+  }
+
+  if(false == ok)
+  {
+    return;
+  }
+  else if (number > 0 && number < maxLines)
+  {
+    maximumNumberOfLines = number;
+  }
+  else
+  {
+    QString text;
+    text.sprintf("Invalid entry. Try something like \"4\" (max %i).",maxLines);
+    QMessageBox::information(this, tr("Invalid entry"),
+                             tr(text.toStdString().c_str()));
+    return;
+  }
+
+  QString actionText = actionChangeNumberOfLines->text();
+  actionText = "&Lines (";
+  actionText += QString::number(maximumNumberOfLines);
+  actionText += ")";
+  actionChangeNumberOfLines->setText(actionText);
+  mainButtonRefreshTextOnly();
+}
+
+void MainWindow::changeFontSize(int size)
+{
+  int maxSize = 100;
+  bool ok = false;
+  QFont font = mainButton->font();
+  if(size == 0)
+  {
+    size = QInputDialog::getInt(this, tr("Font size"),
+                                  tr("Font size:"),
+                                  font.pointSize(), 0, maxSize, 1,
+                                  &ok);
+  }
+  else
+  {
+    ok = true;
+  }
+
+  if(false == ok)
+  {
+    return;
+  }
+  else if (size > 0 && size < maxSize)
+  {
+    font.setPointSize(size);
+    mainButton->setFont(font);
+  }
+  else
+  {
+    QString text;
+    text.sprintf("Invalid entry. Try something like \"28\" (max %i).",maxSize);
+    QMessageBox::information(this, tr("Invalid entry"),
+                             tr(text.toStdString().c_str()));
+    return;
+  }
+
+  QString actionText = actionChangeFontSize->text();
+  actionText = "Font &size (";
+  actionText += QString::number(size);
+  actionText += ")";
+  actionChangeFontSize->setText(actionText);
+  mainButtonRefreshTextOnly();
+}
+
+/*
+function to use when the text itself is not changed but the number of lines or
+the formatting of the text
+*/
+void MainWindow::mainButtonRefreshTextOnly()
+{
+  QString string = completeString;
+  QStringList lines;
+
+  if(1 == hitCount)
+  {
+    string = getHeaderLine();
+  }
+
+  lines = string.split("\n");
+
+  /* adjust the total number of lines of the button */
+  if(lines.length() > maximumNumberOfLines)
+  {
+    while(lines.length() > maximumNumberOfLines
+          && lines.length() > 0)
+    {
+      lines.removeLast();
+    }
+  }
+  else if(lines.length() < maximumNumberOfLines)
+  {
+    while(lines.length() < maximumNumberOfLines)
+    {
+      lines.append(" ");
+    }
+  }
+
+  string = lines.join("\n");
+  this->mainButton->setText(tr(string.toStdString().c_str()));
+}
+
+void MainWindow::resetProgramAndFullscreen()
+{
+  resetProgram();
+  action_Fullscreen->trigger();
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
new file mode 100644 (file)
index 0000000..a1fd84f
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QTimer>
+#include <QPushButton>
+#include <QAction>
+#include <QMenuBar>
+#include "fullscreenexitbutton.h"
+#include "timekeeper.h"
+#include <stdio.h>
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+  public slots:
+    void mainButtonRefresh();
+    void mainButtonRefreshTextOnly();
+    void resetProgram();
+    void resetProgramAndFullscreen();
+    void pauseCounting();
+    void mainButtonTimeoutUpdate();
+    void saveToFile();
+    void toggleFullDate();
+    void toggleTimeDate();
+    void about();
+    void showFullList();
+    void showFullScreenHandler();
+    void slotFullscreenExit();
+    void changeNumberOfLines(int number = 0);
+    void changeFontSize(int size = 0);
+
+private:
+    int resetCounters();
+    int resetUi();
+    int updateTime();
+    int toggleTimer();
+    int toggleActionPause();
+    int updateUiText();
+
+    void setupUi();
+    void retranslateUi();
+
+    QAction *actionReset;
+    QAction *actionResetFs;
+    QAction *actionSimulated_click;
+    QAction *actionPause;
+    QAction *actionShow_full_list;
+    QAction *actionSave_full_list;
+    QAction *actionAbout;
+    QAction *actionEnable_full_date;
+    QAction *actionEnable_time_and_date;
+    QAction *action_Fullscreen;
+    QAction *actionChangeNumberOfLines;
+    QAction *actionChangeFontSize;
+    QWidget *centralWidget;
+    QPushButton *mainButton;
+    QMenuBar *menuBar;
+    QMenu *menuPush_It_Menu;
+    QMenu *menuHelp;
+    QMenu *menuData;
+    QMenu *menuView;
+    FullScreenExitButton *fsExitButton;
+
+    QString generateHistoryString();
+    QString getHeaderLine();
+
+    class timeKeeper overallTime;
+
+    char mainButtonStartText[BUFSIZ];
+    QTimer *timer;
+    QString completeString;
+    int hitCount;
+    int timerRefreshTimeMs;
+    bool timeOutput;
+    int maximumNumberOfLines;
+};
+
+#endif // MAINWINDOW_H
diff --git a/src/showfulllistdialog.cpp b/src/showfulllistdialog.cpp
new file mode 100644 (file)
index 0000000..ee80f7f
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <QPushButton>
+#include <QTextBrowser>
+#include <QHBoxLayout>
+#include <QFileDialog>
+#include <QMessageBox>
+
+#include <iostream>
+#include <fstream>
+
+#include "showfulllistdialog.hpp"
+
+ShowFullListDialog::ShowFullListDialog(QWidget *parent, QString text) :
+    QDialog(parent)
+{
+  QPushButton *doneButton = new QPushButton(tr("&Done"));
+  QPushButton *saveButton = new QPushButton(tr("&Save"));
+  QPushButton *saveEditedButton = new QPushButton(tr("S&ave edited version"));
+  textEdit = new QTextBrowser;
+  textEdit->setReadOnly(false);
+  textEdit->setText(text);
+  initialString = text;
+
+  QVBoxLayout *layout = new QVBoxLayout;
+  layout->addWidget(doneButton);
+  layout->addWidget(saveButton);
+  layout->addWidget(saveEditedButton);
+  layout->addStretch();
+
+  QHBoxLayout *mainLayout = new QHBoxLayout;
+  mainLayout->addLayout(layout);
+  mainLayout->addWidget(textEdit);
+
+  connect(doneButton, SIGNAL(clicked()), this, SLOT(deleteLater()));
+  connect(saveButton, SIGNAL(clicked()), this, SLOT(save()));
+  connect(saveEditedButton, SIGNAL(clicked()), this, SLOT(saveEdited()));
+
+  setLayout(mainLayout);
+  setWindowTitle(tr("History"));
+  setBaseSize(700,400);
+  setMinimumWidth(600);
+  setMinimumHeight(400);
+  hide();
+}
+
+ShowFullListDialog::~ShowFullListDialog()
+{
+}
+
+int ShowFullListDialog::saveToFile(QString string)
+{
+  QString fileName = QFileDialog::getSaveFileName(0,
+                                                  tr("Save to"), "",
+                                                  tr("Push-It textfile (*.pushit);;All Files (*.*)"));
+  if (fileName.isEmpty())
+  {
+    return EXIT_FAILURE;
+  }
+  else
+  {
+    std::ofstream myfile;
+    myfile.open(fileName.toStdString().c_str());
+    if (!myfile.is_open())
+    {
+      QMessageBox::information(0, tr("Unable to open file"),
+                               tr("Unable to open file"));
+      return EXIT_FAILURE;
+    }
+    myfile << string.toStdString();
+    myfile.close();
+  }
+  return EXIT_SUCCESS;
+}
+
+void ShowFullListDialog::save()
+{
+  saveToFile(initialString);
+}
+
+void ShowFullListDialog::saveEdited()
+{
+  saveToFile(textEdit->toPlainText());
+}
diff --git a/src/showfulllistdialog.hpp b/src/showfulllistdialog.hpp
new file mode 100644 (file)
index 0000000..1c86912
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef SHOWFULLLISTDIALOG_HPP
+#define SHOWFULLLISTDIALOG_HPP
+
+#include <QDialog>
+#include <QTextBrowser>
+
+class ShowFullListDialog : public QDialog
+{
+    Q_OBJECT
+
+public slots:
+  void save();
+  void saveEdited();
+
+public:
+  explicit ShowFullListDialog(QWidget *parent = 0, QString text = "");
+  ~ShowFullListDialog();
+
+private:
+  int saveToFile(QString string);
+
+  QTextBrowser *textEdit;
+  QString initialString;
+};
+
+#endif // SHOWFULLLISTDIALOG_HPP
diff --git a/src/timekeeper.cpp b/src/timekeeper.cpp
new file mode 100644 (file)
index 0000000..6d7dc9e
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "timekeeper.h"
+#include <sstream>
+#include <iomanip>
+
+using namespace std;
+
+timeKeeper::timeKeeper()
+{
+  start();
+  isRunning = false;
+}
+
+int timeKeeper::start()
+{
+  gettimeofday(&tvPrev,NULL);
+  gettimeofday(&tvLast,NULL);
+  gettimeofday(&tvStart,NULL);
+  gettimeofday(&tvStop,NULL);
+  timeStart = time(NULL);
+  timeStop  = timeStart;
+  timePrev  = timeStart;
+  timeLast  = timeStart;
+  pauseTimeSec = 0;
+  pauseTotalTimeSec = 0;
+  isRunning = true;
+  isPauseActive = false;
+  wasLastPauseLogged = true;
+  disableDateForStrings();
+  return EXIT_SUCCESS;
+}
+
+int timeKeeper::stop()
+{
+  if(false == isRunning)
+  {
+    return EXIT_FAILURE;
+  }
+
+  stopPause();
+  timeStop = time(NULL);
+  timeLast = timeStop;
+  gettimeofday(&tvLast,NULL);
+  gettimeofday(&tvStop,NULL);
+  isRunning = false;
+
+  return EXIT_SUCCESS;
+}
+
+int timeKeeper::update()
+{
+  if(false == isRunning)
+  {
+    return EXIT_FAILURE;
+  }
+
+  stopPause();
+  timePrev = timeLast;
+  timeLast = time(NULL);
+
+  tvPrev = tvLast;
+  gettimeofday(&tvLast,NULL);
+
+  return EXIT_SUCCESS;
+}
+
+double timeKeeper::getDelta(struct timeval tvLater, struct timeval tvEarlier)
+{
+  double tvTime = (double)(tvLater.tv_sec - tvEarlier.tv_sec);
+
+  tvTime = tvTime*1e6+(double)(tvLater.tv_usec - tvEarlier.tv_usec);
+  tvTime /=1e6;
+
+  return tvTime;
+}
+
+double timeKeeper::getDeltaLastToStart()
+{
+  double retval = 0;
+
+  if(false == isRunning)
+  {
+    retval = getDelta(tvStop,tvStart);
+  }
+  else
+  {
+    retval = getDelta(tvLast,tvStart);
+  }
+  retval -= pauseTotalTimeSec;
+
+  return retval;
+}
+
+double timeKeeper::getDeltaNowToStart()
+{
+  double retval = 0;
+  struct timeval now;
+
+  gettimeofday(&now,NULL);
+
+  if(false == isRunning)
+  {
+    retval = getDelta(tvStop,tvStart);
+  }
+  else
+  {
+    retval = getDelta(now,tvStart);
+  }
+  retval -= pauseTotalTimeSec;
+
+  return retval;
+}
+
+double timeKeeper::getDeltaLastToPrev()
+{
+  double retval = 0;
+
+  if(false == isRunning)
+  {
+    return -1;
+  }
+
+  retval = getDelta(tvLast,tvPrev);
+
+  if(false == wasLastPauseLogged)
+  {
+    retval -= pauseTimeSec;
+    wasLastPauseLogged = true;
+  }
+
+  return retval;
+}
+
+double timeKeeper::getDeltalNowToPrev()
+{
+  double retval = 0;
+  struct timeval now;
+
+  gettimeofday(&now,NULL);
+
+  if(false == isRunning)
+  {
+    retval = getDelta(tvStop,tvPrev);
+  }
+  else
+  {
+    retval = getDelta(now,tvPrev);
+  }
+  retval -= pauseTotalTimeSec;
+
+  return retval;
+}
+
+string timeKeeper::makeString(time_t timer)
+{
+  stringstream sstr;
+  struct tm *helper=NULL;
+
+  helper=localtime(&timer);
+  sstr << setfill('0');
+  if(true == dateForStrings)
+  {
+    sstr << setw(2) << 1900+helper->tm_year << "-";
+    sstr << setw(2) << helper->tm_mon << "-";
+    sstr << setw(2) << helper->tm_mday << " ";
+  }
+  sstr << setw(2) << helper->tm_hour << ":";
+  sstr << setw(2) << helper->tm_min << ":";
+  sstr << setw(2) << helper->tm_sec;
+
+  return sstr.str();
+}
+
+string timeKeeper::getStartTimeString()
+{
+  return makeString(timeStart);
+}
+
+string timeKeeper::getPreviousTimeString()
+{
+  return makeString(timePrev);
+}
+
+string timeKeeper::getLastTimeString()
+{
+  return makeString(timeLast);
+}
+
+string timeKeeper::getNowTimeString()
+{
+  time_t timeNow = time(NULL);
+  return makeString(timeNow);
+}
+
+int timeKeeper::pause()
+{
+  if(false == isRunning)
+  {
+    return EXIT_FAILURE;
+  }
+
+  startPause();
+
+  return EXIT_SUCCESS;
+}
+
+int timeKeeper::startPause()
+{
+  if(true == isPauseActive)
+  {
+    return stopPause();
+  }
+  gettimeofday(&tvPauseStart,NULL);
+  isPauseActive = true;
+
+  return EXIT_SUCCESS;
+}
+
+int timeKeeper::stopPause()
+{
+  if(false == isPauseActive)
+  {
+    return EXIT_FAILURE;
+  }
+
+  gettimeofday(&tvPauseStop,NULL);
+  pauseTimeSec = getDelta(tvPauseStop,tvPauseStart);
+  pauseTotalTimeSec += pauseTimeSec;
+  wasLastPauseLogged = false;
+  isPauseActive = false;
+
+  return EXIT_SUCCESS;
+}
+
+int timeKeeper::isPaused()
+{
+  return isPauseActive;
+}
+
+/*
+Date string handling
+*/
+bool timeKeeper::enableDateForStrings()
+{
+  dateForStrings = true;
+  return dateForStrings;
+}
+
+bool timeKeeper::disableDateForStrings()
+{
+  dateForStrings = false;
+  return dateForStrings;
+}
+
+bool timeKeeper::isDateForStringsEnabled()
+{
+  return dateForStrings;
+}
diff --git a/src/timekeeper.h b/src/timekeeper.h
new file mode 100644 (file)
index 0000000..831d643
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+    Copyright (C) <2010>  <Markus Scharnowski markus.scharnowski@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program 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 General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef TIMEKEEPER_H
+#define TIMEKEEPER_H
+#include <time.h>
+#include <sys/time.h>
+#include <cstdlib>
+#include <string>
+
+class timeKeeper
+{
+public:
+    timeKeeper();
+    int resetTimes();
+    int start();
+    int stop();
+    int update();
+    int pause();
+    int isPaused();
+    bool enableDateForStrings();
+    bool disableDateForStrings();
+    bool isDateForStringsEnabled();
+    double getDeltaLastToStart();
+    double getDeltaLastToPrev();
+    double getDeltaNowToStart();
+    double getDeltalNowToPrev();
+    std::string getStartTimeString();
+    std::string getLastTimeString();
+    std::string getNowTimeString();
+    std::string getPreviousTimeString();
+
+private:
+    double getDelta(struct timeval tvLater, struct timeval tvEarlier);
+    std::string makeString(time_t timer);
+    int startPause();
+    int stopPause();
+
+    time_t timeStart;
+    time_t timeStop;
+    struct timeval tvStart;
+    struct timeval tvStop;
+
+    time_t timePrev;
+    time_t timeLast;
+    struct timeval tvPrev;
+    struct timeval tvLast;
+
+    struct timeval tvPauseStart;
+    struct timeval tvPauseStop;
+    double pauseTotalTimeSec;
+    double pauseTimeSec;
+
+    bool isRunning;
+    bool isPauseActive;
+    bool wasLastPauseLogged;
+    bool dateForStrings;
+};
+
+#endif // TIMEKEEPER_H