Mac OS X Realtime Fixups

A few minor fixups for Mac OS X;

* LionFullScreen.mm compile issues resolved by introducing
  a new define in gcconfig.pri. This will hopefully go when
  issues with Qt and AvailabilityMacros are resolved. See
  DEFINES += GC_HAVE_LION in gcconfig.pri.in

* The buttons on the realtime controls are now set to GTK to
  avoid Qt constraints regarding spacing and format of
  QPushButtons. This will hopefully go when we move the controls
  to a task bar at the bottom of the screen.
This commit is contained in:
Mark Liversedge
2011-11-05 23:21:28 +00:00
parent 609b1452a5
commit 2a380ddfa1
8 changed files with 31 additions and 29 deletions

View File

@@ -16,15 +16,9 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _GC_LionFullScreen_h
#define _GC_LionFullScreen_h 1
// What versions are supported by this SDK?
#ifdef Q_OS_MAC
#include <AvailabilityMacros.h>
#endif
#include "GoldenCheetah.h"
// QT stuff etc

View File

@@ -18,9 +18,12 @@
#include "LionFullScreen.h"
// which version of the SDK?
#include <Availability.h>
LionFullScreen::LionFullScreen(MainWindow *main) : QObject(main), main(main)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
#ifdef GC_HAVE_LION
// lets enable fullscreen stuff
NSView *nsview = (NSView *) main->winId();
NSWindow *nswindow = [nsview window];
@@ -34,7 +37,7 @@ LionFullScreen::LionFullScreen(MainWindow *main) : QObject(main), main(main)
bool
LionFullScreen::eventFilter(QObject *obj, QEvent *event)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
#ifdef GC_HAVE_LION
if (obj != main) return false;
// Ctrl-Cmd-F toggles
@@ -64,7 +67,7 @@ LionFullScreen::eventFilter(QObject *obj, QEvent *event)
void
LionFullScreen::toggle()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
#ifdef GC_HAVE_LION
// toggle full screen back
NSView *nsview = (NSView *) main->winId();
NSWindow *nswindow = [nsview window];

View File

@@ -73,7 +73,7 @@
#include "HomeWindow.h"
#include "GcBubble.h"
#if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
#include "LionFullScreen.h"
#endif
#ifndef Q_OS_MAC
@@ -130,7 +130,7 @@ MainWindow::MainWindow(const QDir &home) :
QVariant unit = appsettings->value(this, GC_UNIT);
useMetricUnits = (unit.toString() == "Metric");
#if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
fullScreen = new LionFullScreen(this);
#endif
#ifndef Q_OS_MAC

View File

@@ -133,7 +133,7 @@ class MainWindow : public QMainWindow
void setBubble(QString text, QPoint pos = QPoint(), Qt::Orientation o = Qt::Horizontal);
#if (defined Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
LionFullScreen *fullScreen;
#endif
#ifndef Q_OS_MAC

View File

@@ -116,11 +116,6 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
allWorkouts->setText(0, tr("Workout Library"));
workoutTree->expandItem(allWorkouts);
buttonPanel = new QFrame;
buttonPanel->setLineWidth(1);
buttonPanel->setFrameStyle(QFrame::NoFrame);
buttonPanel->setContentsMargins(0,0,0,0);
QVBoxLayout *panel = new QVBoxLayout;
panel->setSpacing(0);
panel->setContentsMargins(0,0,0,0);
@@ -153,13 +148,15 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
pauseButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
stopButton = new QPushButton(tr("Stop"), this);
stopButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
plusButton = new QPushButton(tr(">>"), this);
plusButton = new QPushButton(tr(">"), this);
plusButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
plusButton->setFixedWidth(20);
minusButton = new QPushButton(tr("<<"), this);
minusButton = new QPushButton(tr("<"), this);
minusButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
minusButton->setFixedWidth(20);
QVBoxLayout *updownLayout = new QVBoxLayout;
updownLayout->setSpacing(0);
updownLayout->setContentsMargins(0,0,0,0);
updownLayout->addWidget(plusButton);
updownLayout->addWidget(minusButton);
intensitySlider = new QSlider(Qt::Vertical, this);
@@ -167,6 +164,19 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
intensitySlider->setMaximum(150);
intensitySlider->setValue(100);
#ifdef Q_OS_MAC
// the mac styling of buttons is freaking annoying
// It overrides any attempt to compact, which is
// exactly what we need to do, so instead we use
// the plastique style on them to get around it
QCleanlooksStyle *style = new QCleanlooksStyle();
startButton->setStyle(style);
pauseButton->setStyle(style);
stopButton->setStyle(style);
plusButton->setStyle(style);
minusButton->setStyle(style);
#endif
recordSelector = new QCheckBox(this);
recordSelector->setText(tr("Save workout data"));
recordSelector->setChecked(Qt::Checked);
@@ -175,10 +185,9 @@ TrainTool::TrainTool(MainWindow *parent, const QDir &home) : GcWindow(parent), h
buttons->addWidget(startButton);
buttons->addWidget(pauseButton);
buttons->addWidget(stopButton);
buttons->addLayout(updownLayout);
panel->addLayout(buttons);
buttonPanel->setLayout(panel);
mainLayout->addWidget(buttonPanel);
mainLayout->addLayout(panel);
mainLayout->addLayout(updownLayout);
mainLayout->addWidget(intensitySlider);
trainSplitter = new QSplitter;

View File

@@ -169,7 +169,6 @@ class TrainTool : public GcWindow
QTreeWidgetItem *media;
// those buttons
QFrame *buttonPanel;
QPushButton *startButton,
*pauseButton,
*stopButton,

View File

@@ -22,11 +22,6 @@ D2XX_INCLUDE = /usr/local/include/D2XX
# QMAKE_DEL_FILE = rm -f
#}
#if you have PHONON compiled in and working
#uncomment the below, for video playback support
#in the training and racing view
#GC_HAVE_PHONON = true
# If you want Twitter support you must install liboauth
# http://liboauth.sourceforge.net/
# Set the path to where liboauth.a was installed
@@ -142,5 +137,8 @@ macx {
# Uncomment this line to build a OS X universal binary:
#CONFIG+=x86 ppc
# Uncomment this line if you have SDK 10.7 or higher
DEFINES += -DGC_HAVE_LION
}

View File

@@ -123,7 +123,6 @@ qwt3d {
# Video playback using Quicktime Framework
# Lion fullscreen playback
macx {
#LIBS += -lobjc -framework Cocoa -framework IOKit -framework AppKit -framework QTKit
LIBS += -lobjc -framework Carbon -framework IOKit -framework AppKit -framework QTKit
HEADERS += QtMacSegmentedButton.h QtMacVideoWindow.h LionFullScreen.h
SOURCES += QtMacSegmentedButton.mm QtMacVideoWindow.mm LionFullScreen.mm