summaryrefslogtreecommitdiff
path: root/metawatch
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-09-02 20:53:05 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-09-02 20:53:05 +0200
commit2f631362b54180252d0daa34f359338860a8782b (patch)
tree86148bee6e0b09e2c68a8166fc2b6143f22d7949 /metawatch
parent3e5440a3e1d4f23180b8e6795ae1c29f9964379d (diff)
downloadsowatch-2f631362b54180252d0daa34f359338860a8782b.tar.gz
sowatch-2f631362b54180252d0daa34f359338860a8782b.zip
fixing a few warnings
Diffstat (limited to 'metawatch')
-rw-r--r--metawatch/metawatch.cpp1
-rw-r--r--metawatch/metawatch.h3
-rw-r--r--metawatch/metawatchdigitalsimulator.cpp14
-rw-r--r--metawatch/metawatchdigitalsimulator.h3
-rw-r--r--metawatch/metawatchdigitalsimulatorform.cpp23
-rw-r--r--metawatch/metawatchdigitalsimulatorform.h10
-rw-r--r--metawatch/metawatchdigitalsimulatorform.ui250
7 files changed, 192 insertions, 112 deletions
diff --git a/metawatch/metawatch.cpp b/metawatch/metawatch.cpp
index a4692e5..d02e726 100644
--- a/metawatch/metawatch.cpp
+++ b/metawatch/metawatch.cpp
@@ -368,6 +368,7 @@ uint MetaWatch::nvalSize(NvalValue value)
return 1;
case TimeFormat:
case DateFormat:
+ case DisplaySeconds:
return 1;
}
return 0;
diff --git a/metawatch/metawatch.h b/metawatch/metawatch.h
index 9e62960..8946884 100644
--- a/metawatch/metawatch.h
+++ b/metawatch/metawatch.h
@@ -74,8 +74,7 @@ public:
IdleBufferConfiguration = 0x2,
TimeFormat = 0x2009,
DateFormat = 0x200a,
- DisplaySeconds = 0x200b,
- Language = 0x200c
+ DisplaySeconds = 0x200b
};
enum Mode {
diff --git a/metawatch/metawatchdigitalsimulator.cpp b/metawatch/metawatchdigitalsimulator.cpp
index 5c399bd..e5cd74b 100644
--- a/metawatch/metawatchdigitalsimulator.cpp
+++ b/metawatch/metawatchdigitalsimulator.cpp
@@ -19,10 +19,12 @@ MetaWatchDigitalSimulator::MetaWatchDigitalSimulator(ConfigKey *config, QObject
_form->showNormal();
connect(_form, SIGNAL(buttonPressed(int)), SIGNAL(buttonPressed(int)));
connect(_form, SIGNAL(buttonReleased(int)), SIGNAL(buttonReleased(int)));
+ connect(_form, SIGNAL(destroyed()), SLOT(handleFormDestroyed()));
}
MetaWatchDigitalSimulator::~MetaWatchDigitalSimulator()
{
+ _connected = false;
delete _form;
}
@@ -101,7 +103,7 @@ void MetaWatchDigitalSimulator::vibrate(bool on)
void MetaWatchDigitalSimulator::retryConnect()
{
if (!_connected && _form) {
- qDebug() << "connected";
+ qDebug() << "simulator connected";
_connected = true;
_currentMode = IdleMode;
@@ -118,3 +120,13 @@ void MetaWatchDigitalSimulator::send(const Message &msg)
// Do not send messages
Q_UNUSED(msg);
}
+
+void MetaWatchDigitalSimulator::handleFormDestroyed()
+{
+ if (_connected) {
+ _connected = false;
+ qDebug() << "simulator disconnected";
+ emit disconnected();
+ _form = 0;
+ }
+}
diff --git a/metawatch/metawatchdigitalsimulator.h b/metawatch/metawatchdigitalsimulator.h
index 6f5c130..de2efdd 100644
--- a/metawatch/metawatchdigitalsimulator.h
+++ b/metawatch/metawatchdigitalsimulator.h
@@ -29,6 +29,9 @@ public:
void retryConnect();
void send(const Message& msg);
+private slots:
+ void handleFormDestroyed();
+
private:
MetaWatchDigitalSimulatorForm* _form;
QPixmap _pixmap[3];
diff --git a/metawatch/metawatchdigitalsimulatorform.cpp b/metawatch/metawatchdigitalsimulatorform.cpp
index fc3c890..04d6482 100644
--- a/metawatch/metawatchdigitalsimulatorform.cpp
+++ b/metawatch/metawatchdigitalsimulatorform.cpp
@@ -1,10 +1,13 @@
+#include <QtCore/QDebug>
+#include <QtGui/QFileDialog>
+
#include "metawatchdigitalsimulatorform.h"
#include "ui_metawatchdigitalsimulatorform.h"
using namespace sowatch;
MetaWatchDigitalSimulatorForm::MetaWatchDigitalSimulatorForm(QWidget* parent) :
- QWidget(parent),
+ QMainWindow(parent),
ui(new Ui::MetaWatchDigitalSimulatorForm)
{
ui->setupUi(this);
@@ -80,3 +83,21 @@ void MetaWatchDigitalSimulatorForm::btnFReleased()
{
emit buttonReleased(5);
}
+
+void MetaWatchDigitalSimulatorForm::on_actionCaptureScreen_triggered()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save capture"), QString(), tr("Images (*.png)"));
+ if (fileName.isEmpty()) {
+ return;
+ }
+ if (!fileName.endsWith(".png")) {
+ fileName.append(".png");
+ }
+ qDebug() << "Saving to" << fileName;
+ ui->lblDisplay->pixmap()->save(fileName, "PNG");
+}
+
+void MetaWatchDigitalSimulatorForm::on_actionQuit_triggered()
+{
+ QApplication::quit();
+}
diff --git a/metawatch/metawatchdigitalsimulatorform.h b/metawatch/metawatchdigitalsimulatorform.h
index 054a1a8..07f26ea 100644
--- a/metawatch/metawatchdigitalsimulatorform.h
+++ b/metawatch/metawatchdigitalsimulatorform.h
@@ -1,7 +1,7 @@
#ifndef METAWATCHSIMULATORFORM_H
#define METAWATCHSIMULATORFORM_H
-#include <QWidget>
+#include <QtGui/QMainWindow>
namespace Ui {
class MetaWatchDigitalSimulatorForm;
@@ -9,7 +9,7 @@ namespace Ui {
namespace sowatch {
-class MetaWatchDigitalSimulatorForm : public QWidget
+class MetaWatchDigitalSimulatorForm : public QMainWindow
{
Q_OBJECT
@@ -23,7 +23,7 @@ signals:
void buttonPressed(int button);
void buttonReleased(int button);
-protected slots:
+private slots:
void btnAPressed();
void btnAReleased();
void btnBPressed();
@@ -37,6 +37,10 @@ protected slots:
void btnFPressed();
void btnFReleased();
+ void on_actionCaptureScreen_triggered();
+
+ void on_actionQuit_triggered();
+
private:
Ui::MetaWatchDigitalSimulatorForm *ui;
};
diff --git a/metawatch/metawatchdigitalsimulatorform.ui b/metawatch/metawatchdigitalsimulatorform.ui
index 239c342..b1575aa 100644
--- a/metawatch/metawatchdigitalsimulatorform.ui
+++ b/metawatch/metawatchdigitalsimulatorform.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MetaWatchDigitalSimulatorForm</class>
- <widget class="QWidget" name="MetaWatchDigitalSimulatorForm">
+ <widget class="QMainWindow" name="MetaWatchDigitalSimulatorForm">
<property name="geometry">
<rect>
<x>0</x>
@@ -13,110 +13,150 @@
<property name="windowTitle">
<string>MetaWatch Digital Simulator</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="btnsLeft">
- <item>
- <widget class="QPushButton" name="btnF">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>F</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnE">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>E</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnD">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>D</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="lblDisplay">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="btnsRight">
- <item>
- <widget class="QPushButton" name="btnA">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>A</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnB">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>B</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btnC">
- <property name="maximumSize">
- <size>
- <width>50</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text">
- <string>C</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
+ <widget class="QWidget" name="watch">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="btnsLeft">
+ <item>
+ <widget class="QPushButton" name="btnF">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>F</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnE">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>E</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnD">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>D</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblDisplay">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="btnsRight">
+ <item>
+ <widget class="QPushButton" name="btnA">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>A</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnB">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>B</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnC">
+ <property name="maximumSize">
+ <size>
+ <width>50</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>C</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>262</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuWatch">
+ <property name="title">
+ <string>&amp;Watch</string>
+ </property>
+ <addaction name="actionCaptureScreen"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <addaction name="menuWatch"/>
+ </widget>
+ <action name="actionCaptureScreen">
+ <property name="text">
+ <string>&amp;Capture screen...</string>
+ </property>
+ <property name="toolTip">
+ <string>Capture the current watch screen</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections>