From cf2e0251c58b5e359679f9c2be44895b35dbf58b Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 20 Feb 2013 22:11:54 +0000 Subject: [PATCH] Code Cleanup: Deprecate Train Streaming We no longer support streaming data from the Train View. All the source for this has been moved to deprecated. --- src/TrainTool.cpp | 84 ------------------------ src/TrainTool.h | 7 -- src/{ => deprecated}/GoldenClient.cpp | 0 src/{ => deprecated}/GoldenClient.h | 0 src/{ => deprecated}/ProtocolHandler.cpp | 0 src/{ => deprecated}/ProtocolHandler.h | 0 src/src.pro | 4 -- 7 files changed, 95 deletions(-) rename src/{ => deprecated}/GoldenClient.cpp (100%) rename src/{ => deprecated}/GoldenClient.h (100%) rename src/{ => deprecated}/ProtocolHandler.cpp (100%) rename src/{ => deprecated}/ProtocolHandler.h (100%) diff --git a/src/TrainTool.cpp b/src/TrainTool.cpp index 63ce7ef17..a4fd13ab6 100644 --- a/src/TrainTool.cpp +++ b/src/TrainTool.cpp @@ -324,7 +324,6 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h // set home main = parent; - streamController = NULL; ergFile = NULL; calibrating = false; @@ -359,7 +358,6 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h connect(gui_timer, SIGNAL(timeout()), this, SLOT(guiUpdate())); connect(disk_timer, SIGNAL(timeout()), this, SLOT(diskUpdate())); - connect(stream_timer, SIGNAL(timeout()), this, SLOT(streamUpdate())); connect(load_timer, SIGNAL(timeout()), this, SLOT(loadUpdate())); configChanged(); // will reset the workout tree @@ -621,45 +619,6 @@ TrainTool::mediaTreeWidgetSelectionChanged() * Was realtime window, now local and manages controller and chart updates etc *------------------------------------------------------------------------------*/ -// open a connection to the GoldenServer via a GoldenClient -void TrainTool::setStreamController() -{ - int deviceno = selectedServerNumber(); - - if (deviceno == -1) return; - - // zap the current one - if (streamController != NULL) { - delete streamController; - streamController = NULL; - } - - if (Devices.count() > 0) { - DeviceConfiguration config = Devices.at(deviceno); - streamController = new GoldenClient; - - // connect - QStringList speclist = config.portSpec.split(":", QString::SkipEmptyParts); - bool rc = streamController->connect(speclist[0], // host - speclist[1].toInt(), // port - "9cf638294030cea7b1590a4ca32e7f58", // raceid - appsettings->cvalue(main->cyclist, GC_NICKNAME).toString(), // name - FTP, // CP60 - appsettings->cvalue(main->cyclist, GC_WEIGHT).toDouble()); // weight - - // no connection - if (rc == false) { - streamController->closeAndExit(); - streamController = NULL; - status &= ~RT_STREAMING; - QMessageBox msgBox; - msgBox.setText(QString(tr("Cannot Connect to Server %1 on port %2").arg(speclist[0]).arg(speclist[1]))); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); - } - } -} - void TrainTool::Start() // when start button is pressed { static QIcon playIcon(":images/oxygen/play.png"); @@ -759,9 +718,6 @@ void TrainTool::Start() // when start button is pressed // we're away! status |=RT_RUNNING; - // should we be streaming too? - if (streamController != NULL) status |= RT_STREAMING; - load_period.restart(); session_time.start(); session_elapsed_msec = 0; @@ -898,13 +854,6 @@ void TrainTool::Stop(int deviceStatus) // when stop button is pressed } } - if (status & RT_STREAMING) { - stream_timer->stop(); - streamController->closeAndExit(); - delete streamController; - streamController = NULL; - } - if (status & RT_WORKOUT) { load_timer->stop(); load_msecs = 0; @@ -1126,39 +1075,6 @@ void TrainTool::warnnoConfig() QMessageBox::warning(this, tr("No Devices Configured"), "Please configure a device in Preferences."); } -//---------------------------------------------------------------------- -// STREAMING FUNCTION -//---------------------------------------------------------------------- -void -TrainTool::streamUpdate() -{ - // send over the wire... - if (streamController) { - - // send my data - streamController->sendTelemetry(displayPower, - displayCadence, - displayDistance, - displayHeartRate, - displaySpeed); - - // get standings for everyone else - RaceStatus current = streamController->getStandings(); - - // send out to all the widgets... - notifyRaceStandings(current); - - // has the race finished? - if (current.race_finished == true) { - Stop(0); // all over dude - QMessageBox msgBox; - msgBox.setText(tr("Race Over!")); - msgBox.setIcon(QMessageBox::Information); - msgBox.exec(); - } - } -} - //---------------------------------------------------------------------- // DISK UPDATE FUNCTIONS //---------------------------------------------------------------------- diff --git a/src/TrainTool.h b/src/TrainTool.h index 47c99f4a3..e604cfec7 100644 --- a/src/TrainTool.h +++ b/src/TrainTool.h @@ -21,7 +21,6 @@ #include "GoldenCheetah.h" #include "MainWindow.h" -#include "GoldenClient.h" #include "RealtimeData.h" #include "RealtimePlot.h" #include "DeviceConfiguration.h" @@ -80,7 +79,6 @@ class TrainTool : public GcWindow QStringList listWorkoutFiles(const QDir &) const; QList devices(); // convenience function for iterating over active devices - GoldenClient *streamController; // send out to const QTreeWidgetItem *currentWorkout() { return workout; } const QTreeWidgetItem *currentMedia() { return media; } @@ -94,9 +92,6 @@ class TrainTool : public GcWindow // set labels when ergfile selected etc void setLabels(); - // notify widgets of race update - void notifyRaceStandings(RaceStatus x) { raceStandings(x); } - // was realtimewindow,merged into tool // update charts/dials and manage controller void updateData(RealtimeData &); // to update telemetry by push devices @@ -119,7 +114,6 @@ class TrainTool : public GcWindow void deviceSelected(); void serverSelected(); - void raceStandings(RaceStatus); void start(); void pause(); void stop(); @@ -157,7 +151,6 @@ class TrainTool : public GcWindow // Timed actions void guiUpdate(); // refreshes the telemetry void diskUpdate(); // writes to CSV file - void streamUpdate(); // writes to remote Peer void loadUpdate(); // sets Load on CT like devices // When no config has been setup diff --git a/src/GoldenClient.cpp b/src/deprecated/GoldenClient.cpp similarity index 100% rename from src/GoldenClient.cpp rename to src/deprecated/GoldenClient.cpp diff --git a/src/GoldenClient.h b/src/deprecated/GoldenClient.h similarity index 100% rename from src/GoldenClient.h rename to src/deprecated/GoldenClient.h diff --git a/src/ProtocolHandler.cpp b/src/deprecated/ProtocolHandler.cpp similarity index 100% rename from src/ProtocolHandler.cpp rename to src/deprecated/ProtocolHandler.cpp diff --git a/src/ProtocolHandler.h b/src/deprecated/ProtocolHandler.h similarity index 100% rename from src/ProtocolHandler.h rename to src/deprecated/ProtocolHandler.h diff --git a/src/src.pro b/src/src.pro index 08e504f51..5edc5f8da 100644 --- a/src/src.pro +++ b/src/src.pro @@ -284,7 +284,6 @@ HEADERS += \ GcWindowRegistry.h \ GcWindowTool.h \ GoldenCheetah.h \ - GoldenClient.h \ GoogleMapControl.h \ GpxParser.h \ GpxRideFile.h \ @@ -331,7 +330,6 @@ HEADERS += \ PowerTapDevice.h \ PowerTapUtil.h \ PwxRideFile.h \ - ProtocolHandler.h \ QuarqParser.h \ QuarqRideFile.h \ RawRideFile.h \ @@ -471,7 +469,6 @@ SOURCES += \ GcWindowRegistry.cpp \ GcWindowTool.cpp \ GoldenCheetah.cpp \ - GoldenClient.cpp \ GoogleMapControl.cpp \ GpxParser.cpp \ GpxRideFile.cpp \ @@ -519,7 +516,6 @@ SOURCES += \ PowerHist.cpp \ PowerTapDevice.cpp \ PowerTapUtil.cpp \ - Protocolhandler.cpp \ PwxRideFile.cpp \ QuarqParser.cpp \ QuarqRideFile.cpp \