Skip to content

Commit

Permalink
fixes for OSX build
Browse files Browse the repository at this point in the history
default exporter fix (gave empty name before)
  • Loading branch information
altera2015 committed Aug 20, 2015
1 parent 01d513d commit 586d5d0
Show file tree
Hide file tree
Showing 21 changed files with 167 additions and 100 deletions.
22 changes: 22 additions & 0 deletions src/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>runningman2.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>ttwatcher</string>
<key>CFBundleIdentifier</key>
<string>ghj.ttwatcher</string>
<key>NOTE</key>
<string></string>
</dict>
</plist>
62 changes: 41 additions & 21 deletions src/aboutdialog.ui

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/downloaddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ DownloadDialog::~DownloadDialog()
delete ui;
}

int DownloadDialog::processWatches()
int DownloadDialog::processWatches(bool manualDownload)
{

// if the window is already visible we don't need to process.
if ( this->isVisible() )
{
qDebug() << "DownloadDialog::processWatches / already visible.";
return QDialog::Rejected;
}

m_ManualDownload = manualDownload;
return exec();
}

Expand All @@ -83,7 +85,7 @@ void DownloadDialog::process()
foreach ( TTWatch * watch, m_TTManager->watches())
{

if ( !m_Settings->autoDownload() )
if ( !m_ManualDownload && !m_Settings->autoDownload() )
{
continue;
}
Expand Down Expand Up @@ -188,7 +190,7 @@ void DownloadDialog::workInfo(const QString &message, bool done)
qApp->processEvents();
if ( done )
{
accept();
QMetaObject::invokeMethod(this, "accept",Qt::QueuedConnection);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/downloaddialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class DownloadDialog : public QDialog
TTManager * m_TTManager;
QNetworkAccessManager m_Manager;
QStringList m_Files;
bool m_ManualDownload;

protected:
void showEvent(QShowEvent *e);

public:
explicit DownloadDialog(Settings * settings, TTManager * ttManager, QWidget *parent = 0);
~DownloadDialog();
int processWatches();
int processWatches(bool manualDownload);
QStringList filesDownloaded() const;
private slots:
void process();
Expand Down
22 changes: 7 additions & 15 deletions src/exportworkingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
#include "singleshot.h"
#include <QDebug>

void ExportWorkingDialog::showEvent(QShowEvent *e)
{
QDialog::showEvent(e);

ui->logWidget->clear();

// we have to run process a bit after showEvent is done, otherwise
// we might call accepted while still in showEvent,
// which apparently fails.
SingleShot::go([this]{
process();
}, 250, true, this);
}

ExportWorkingDialog::ExportWorkingDialog(ActivityPtr activity, WatchExportersPtr exporters, const QString &exporterName, QWidget *parent) :
QDialog(parent),
Expand All @@ -29,6 +16,10 @@ ExportWorkingDialog::ExportWorkingDialog(ActivityPtr activity, WatchExportersPtr

connect(m_Exporters.data(), SIGNAL(allExportsFinished()), this, SLOT(onExportingFinished()));
connect(m_Exporters.data(), SIGNAL(exportFinished(bool,QString,QUrl)), this, SLOT(onExportFinished(bool,QString,QUrl)));
connect(&m_Timer, SIGNAL(timeout()), this, SLOT(process()), Qt::QueuedConnection);
m_Timer.setSingleShot(true);
m_Timer.start(100);

}

ExportWorkingDialog::~ExportWorkingDialog()
Expand Down Expand Up @@ -56,12 +47,13 @@ void ExportWorkingDialog::workInfo(const QString &message, bool done)
{
qDebug() << "ExportWorkingDialog::workInfo" << message<< done;
ui->logWidget->addItem(message);
qApp->processEvents();
qApp->processEvents(QEventLoop::AllEvents);
if ( done )
{
if ( !m_HadError )
{
accept();
// on OSX we can't call accept , dont know why.
QMetaObject::invokeMethod(this, "accept",Qt::QueuedConnection);
}
else
{
Expand Down
4 changes: 3 additions & 1 deletion src/exportworkingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QDialog>
#include "watchexporters.h"
#include "activity.h"
#include <QTimer>

namespace Ui {
class ExportWorkingDialog;
Expand All @@ -16,8 +17,9 @@ class ExportWorkingDialog : public QDialog
WatchExportersPtr m_Exporters;
QString m_ExporterName;
bool m_HadError;
QTimer m_Timer;

void showEvent(QShowEvent *e);
// void showEvent(QShowEvent *e);

public:
explicit ExportWorkingDialog(ActivityPtr activity, WatchExportersPtr exporters, const QString &exporterName, QWidget *parent = 0);
Expand Down
2 changes: 1 addition & 1 deletion src/exportworkingdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Downloading...</string>
<string>Exporting...</string>
</property>
</widget>
</item>
Expand Down
1 change: 1 addition & 0 deletions src/hidmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,

/* Check the VID/PID against the arguments */
if ((vendor_id == 0x0 && product_id == 0x0) ||
(vendor_id == dev_vid && product_id == 0x0) ||
(vendor_id == dev_vid && product_id == dev_pid)) {
struct hid_device_info *tmp;
size_t len;
Expand Down
34 changes: 8 additions & 26 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,26 +259,10 @@ void MainWindow::onElevationLoaded(bool success, ActivityPtr activity)
int zoom = ui->mapWidget->boundsToZoom( bounds );
ui->mapWidget->setCenter(zoom, center.y(), center.x());
ui->mapWidget->repaint();



/*
QFile of(m_Activity->filename() + ".tcx");
if (!of.open(QIODevice::WriteOnly))
{
ui->statusBar->showMessage(tr("Could not save tcx file %1.").arg(m_Activity->filename()+".tcx"));
return;
}
TCXExport e;
e.save(&of, m_Activity);
of.close();*/
}




void MainWindow::dragEnterEvent(QDragEnterEvent *e)
{
if ( !e->mimeData()->hasUrls())
Expand Down Expand Up @@ -324,17 +308,16 @@ void MainWindow::dropEvent(QDropEvent *e)
}
}

void MainWindow::download()
void MainWindow::download(bool manualDownload)
{
DownloadDialog * dd = findChild<DownloadDialog*>();
if ( !dd )
{
dd = new DownloadDialog(&m_Settings, &m_TTManager, this);
}

if ( dd->processWatches() == QDialog::Accepted )
if ( dd->processWatches(manualDownload) == QDialog::Accepted )
{

// place the UI interaction on a slight delay to give the m_FSModel a chance
// to pick up the new files.
SingleShot::go([this, dd](){
Expand All @@ -358,9 +341,9 @@ void MainWindow::download()

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_Axis3(0),
m_Axis4(0)
m_Axis4(0),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

Expand Down Expand Up @@ -524,7 +507,8 @@ bool MainWindow::nativeEventFilter(const QByteArray &eventType, void *message, l
}

return false;

#else
return false;
#endif
}

Expand Down Expand Up @@ -568,8 +552,6 @@ void MainWindow::exportActivity(const QString &exporterName)
ExportWorkingDialog ewd(m_Activity, prefs, exporterName, this);
ewd.exec();



/* if ( !prefs->exportActivity(m_Activity, exporterName) )
{
QMessageBox::warning(this, tr("Warning"), tr("Exporting to %1 has not yet been setup, please go to the settings and configure it first.").arg(exporterName));
Expand Down Expand Up @@ -603,7 +585,7 @@ void MainWindow::onWatchArrivedDelay()
{
return;
}
download();
download(false);
}

void MainWindow::onGraphMouseMove(QMouseEvent *event)
Expand Down Expand Up @@ -780,5 +762,5 @@ void MainWindow::on_actionSettings_triggered()

void MainWindow::on_actionDownload_from_watch_triggered()
{
download();
download(true);
}
2 changes: 1 addition & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MainWindow : public QMainWindow, public QAbstractNativeEventFilter

void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void download();
void download(bool manualDownload);
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
Expand Down
8 changes: 4 additions & 4 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>619</width>
<height>425</height>
<width>706</width>
<height>431</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -116,8 +116,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>619</width>
<height>21</height>
<width>706</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down
Binary file added src/runningman2.icns
Binary file not shown.
1 change: 1 addition & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Settings::Settings(QObject *parent) :
m_LastZoom(13),
m_AutoDownload(false)
{
qDebug()<<Settings::settingsFilename() ;
}

QString Settings::tileUrl() const
Expand Down
41 changes: 40 additions & 1 deletion src/settingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<width>500</width>
<height>404</height>
</rect>
</property>
Expand All @@ -18,6 +18,21 @@
<normaloff>:/icons/settings20.png</normaloff>:/icons/settings20.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
Expand All @@ -31,6 +46,18 @@
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
Expand Down Expand Up @@ -73,6 +100,18 @@
<item>
<widget class="QWidget" name="widget_3" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="enabledChecked">
<property name="text">
Expand Down
6 changes: 3 additions & 3 deletions src/singleshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

SingleShot::SingleShot(Callback cb, int ms, bool autoDelete, QObject *parent) :
QObject(parent),
m_CB(cb),
m_AutoDelete(autoDelete)
m_AutoDelete(autoDelete),
m_CB(cb)
{
connect(&m_Timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
connect(&m_Timer, SIGNAL(timeout()), this, SLOT(onTimeout()), Qt::QueuedConnection);
m_Timer.setSingleShot(true);

if ( ms > 0 )
Expand Down
Loading

0 comments on commit 586d5d0

Please sign in to comment.