Permalink
Browse files

Added many maemo specific options (Fsys related mostly), fixed varplo…

…t problems with invalid graphics, some initial work towards a Maemo/Meego (Qt Mobility) version.
  • Loading branch information...
1 parent 37437e2 commit eca6ecfd795fdc03d03598ac6c92ac372fb19f67 Clovis Scotti committed Jul 4, 2011
@@ -12,7 +12,7 @@
// #warning Q_OS_SYMBIAN Selected
#else
#ifdef Q_OS_LINUX
- #define FSC_RUNS_FOLDERS_ROOT "/home/cpscotti/"
+ #define FSC_RUNS_FOLDERS_ROOT "~/"
#define FSC_FSYS_SLASH "/"
#define FSC_SETTINGS_FOLDER "NPBSettings/"
// #warning Q_OS_LINUX Selected
@@ -137,8 +137,13 @@ FORMS += \
UI/mainwindow.ui \
UI/liveview.ui
-CONFIG += mobility
MOBILITY = location sensors
+maemo5 {
+ CONFIG += mobility12
+ MOBILITY += connectivity
+} else {
+ CONFIG += mobility
+}
#LIBS += -lQBluetooth
soundFiles.sources = sounds/*.mp3
@@ -196,3 +201,8 @@ RESOURCES += \
#OTHER_FILES += \
# ClassDiagram.txt
+
+maemo5 {
+ target.path = /opt/PushBurton2/bin
+ INSTALLS += target
+}
@@ -115,7 +115,12 @@ void GraphicsReportView::refresh_dirs_graphs()
for(int i=0;i<avDirectories.count();i++)
{
+#ifdef Q_WS_MAEMO_5
+ qDebug() << "In Maemo home = " << QDir::homePath();
+ dirName = QDir::homePath() + QString("/PushSnowboarding/");
+#else
dirName = FSC_RUNS_FOLDERS_ROOT;
+#endif
if(avDirectories[i].length() == 16) // old format
{
@@ -284,7 +289,16 @@ void GraphicsReportView::load_graphs(QString dir)
void GraphicsReportView::load_avDirectories_directories()
{
- QDir dirIf(FSC_RUNS_FOLDERS_ROOT);
+ QString dirName;
+
+#ifdef Q_WS_MAEMO_5
+ qDebug() << "In Maemo home = " << QDir::homePath();
+ dirName = QDir::homePath() + QString("/PushSnowboarding/");
+#else
+ dirName = FSC_RUNS_FOLDERS_ROOT;
+#endif
+
+ QDir dirIf(dirName);
QStringList fileFilter;
fileFilter << FSC_RUNS_FILTER;
@@ -335,6 +349,7 @@ QString GraphicsReportView::name_from_old_format(const QString& inStr)
QString GraphicsReportView::name_from_new_format(const QString& inStr)
{
+ qDebug() << "Name from new format: " << inStr.left(16).right(10);
uint utime = inStr.left(16).right(10).toUInt();
return QDateTime::fromTime_t(utime).toString("hh:mm, ddd, d/M/yy");
}
@@ -199,6 +199,12 @@ void GraphicVarPlot::generate_graph_path()
{
if(*it != invalidOrdValue)
path->lineTo(gWidGraphOffset+i*horTransform, (vertMax-(*it))*vertTransform+gYOffset);
+
+
+// qDebug() << QString("(x,y) = (%1,%2)").arg(
+// QString::number(gWidGraphOffset+i*horTransform),
+// QString::number((vertMax-(*it))*vertTransform+gYOffset));
+
++it;
i++;
}
@@ -49,7 +49,6 @@ int main(int argc, char *argv[])
if(appUi) {
TRAP_IGNORE(appUi->SetOrientationL((CAknAppUi::TAppUiOrientation)CAknAppUi::EAppOrientationPortrait);)
}
-
#endif
QString simulationFname;
@@ -59,6 +58,11 @@ int main(int argc, char *argv[])
}
MainWindow w(simulationFname);
+
+#if defined(Q_WS_MAEMO_5)
+ w.setAttribute(static_cast<Qt::WidgetAttribute>(128), true);
+#endif
+
#if defined(Q_WS_S60)
w.showMaximized();
// w.showFullScreen();
@@ -166,8 +166,12 @@ bool NPushReportAltitude::load_from_dir(QString &dirName)
{
if(xml.name() == "stats")
{
- Altitude_max = xml.attributes().value("max").toString().toDouble();
- Altitude_min = xml.attributes().value("min").toString().toDouble();
+ if(xml.attributes().value("max").toString() != "nan")
+ Altitude_max = xml.attributes().value("max").toString().toDouble();
+
+ if(xml.attributes().value("min").toString() != "nan")
+ Altitude_min = xml.attributes().value("min").toString().toDouble();
+
} else if(xml.name() == "graph") {
read_points_from_xml(xml);
} else {
@@ -186,7 +190,8 @@ void NPushReportAltitude::read_points_from_xml(QXmlStreamReader& xml)
{
while(xml.readNextStartElement()) {
if(xml.name() == "point") {
- graphPoints.push_back(xml.attributes().value("val").toString().toDouble());
+ if(xml.attributes().value("val").toString() != "nan")
+ graphPoints.push_back(xml.attributes().value("val").toString().toDouble());
} else {
xml.skipCurrentElement();
}
@@ -191,7 +191,9 @@ void NPushReportSpeed::read_points_from_xml(QXmlStreamReader& xml)
{
while(xml.readNextStartElement()) {
if(xml.name() == "point") {
- graphPoints.push_back(xml.attributes().value("val").toString().toDouble());
+ double val = xml.attributes().value("val").toString().toDouble();
+ if(val != -1.0)
+ graphPoints.push_back(val);
} else {
xml.skipCurrentElement();
}
@@ -71,6 +71,8 @@ bool PushN8PhoneMag::is_online()
void PushN8PhoneMag::timerEvent(QTimerEvent *)
{
+ if(!is_online())
+ return;
NPushMagTick * newMagTick = new NPushMagTick(magSensor->reading());
if(receivers(SIGNAL(reading_ready(NPushLogTick*))) > 0)
@@ -130,11 +130,19 @@ void UbiqLogSaver::CreateRunDir()
{
dirName = QString(FSC_RUNS_FOLDERS_ROOT)+QString(FSC_RUNS_PREFIX);
+#ifdef Q_WS_MAEMO_5
+ qDebug() << "In Maemo home = " << QDir::homePath();
+ dirName = QDir::homePath() + QString("/PushSnowboarding/") + QString(FSC_RUNS_PREFIX);
+#endif
+
dirName += QString::number(start_time);
dirName += QDateTime::fromTime_t(start_time).toString("_hhmm");
QFSFileEngine fse;
- if(!fse.mkdir(dirName, false))
+ qDebug() << "Trying to create: " << dirName;
+ if(!fse.mkdir(dirName, false)) {
qDebug() << "Could not create run directory";
+ QCoreApplication::exit();
+ }
}

0 comments on commit eca6ecf

Please sign in to comment.