A little less MainWindow

.. trying to remove it from as many headers as possible.
This commit is contained in:
Mark Liversedge
2013-07-19 18:08:07 +01:00
parent 2f056ea938
commit 5abf1eae97
15 changed files with 31 additions and 31 deletions

View File

@@ -19,10 +19,11 @@
#ifndef _GC_CriticalPowerWindow_h
#define _GC_CriticalPowerWindow_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h" // for isfiltered and filters
#include <QtGui>
#include "MainWindow.h"
#include "Season.h"
#include "RideFile.h"
#ifdef GC_HAVE_LUCENE
#include "SearchFilterBox.h"
#endif

View File

@@ -35,13 +35,13 @@
#ifndef _GC_GcCalendarModel_h
#define _GC_GcCalendarModel_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include <QtGui>
#include <QDebug>
#include "qxtscheduleview.h"
#include "Context.h"
#include "Athlete.h"
#include "MainWindow.h"
#include "RideItem.h"
#include "RideMetadata.h"
#ifdef GC_HAVE_ICAL

View File

@@ -20,7 +20,8 @@
#ifndef _GC_HistogramWindow_h
#define _GC_HistogramWindow_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include "MainWindow.h" // for isfiltered and filters
#include "Context.h"
#include "Athlete.h"
#include "MetricAggregator.h"

View File

@@ -19,10 +19,10 @@
#ifndef _GC_LTMWindow_h
#define _GC_LTMWindow_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h" // for isfiltered and filters
#include <QtGui>
#include <QTimer>
#include "MainWindow.h"
#include "Context.h"
#include "MetricAggregator.h"
#include "Season.h"

View File

@@ -19,11 +19,10 @@
#ifndef _GC_LionFullScreen_h
#define _GC_LionFullScreen_h 1
#include "GoldenCheetah.h"
#include "Context.h"
// QT stuff etc
#include <QtGui>
#include "MainWindow.h"
class LionFullScreen : public QObject
{
@@ -31,7 +30,7 @@ class LionFullScreen : public QObject
public:
LionFullScreen(MainWindow *main);
LionFullScreen(Context *context);
// found in the supplied directory
void toggle();
@@ -40,7 +39,7 @@ class LionFullScreen : public QObject
bool eventFilter(QObject *obj, QEvent *event);
private:
MainWindow *main;
Context *context;
};
#endif // _GC_LionFullScreen_h

View File

@@ -17,20 +17,21 @@
*/
#include "LionFullScreen.h"
#include "MainWindow.h"
// which version of the SDK?
#include <Availability.h>
LionFullScreen::LionFullScreen(MainWindow *main) : QObject(main), main(main)
LionFullScreen::LionFullScreen(Context *context) : QObject(context->mainWindow), context(context)
{
#ifdef GC_HAVE_LION
// lets enable fullscreen stuff
NSView *nsview = (NSView *) main->winId();
NSView *nsview = (NSView *) context->mainWindow->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
// watch for ESC key being hit when in full screen
main->installEventFilter(this);
context->mainWindow->installEventFilter(this);
#endif
}
@@ -38,7 +39,7 @@ bool
LionFullScreen::eventFilter(QObject *obj, QEvent *event)
{
#ifdef GC_HAVE_LION
if (obj != main) return false;
if (obj != context->mainWindow) return false;
// Ctrl-Cmd-F toggles
if (event->type() == QEvent::KeyPress &&
@@ -53,7 +54,7 @@ LionFullScreen::eventFilter(QObject *obj, QEvent *event)
if (event->type() == QEvent::KeyPress && static_cast<QKeyEvent *>(event)->key() == Qt::Key_Escape) {
// if in full screen then toggle, otherwise do nothing
NSView *nsview = (NSView *) main->winId();
NSView *nsview = (NSView *) context->mainWindow->winId();
NSWindow *nswindow = [nsview window];
NSUInteger masks = [nswindow styleMask];
if (masks & NSFullScreenWindowMask) toggle();
@@ -69,7 +70,7 @@ LionFullScreen::toggle()
{
#ifdef GC_HAVE_LION
// toggle full screen back
NSView *nsview = (NSView *) main->winId();
NSView *nsview = (NSView *) context->mainWindow->winId();
NSWindow *nswindow = [nsview window];
[nswindow toggleFullScreen:nil];
#endif

View File

@@ -160,10 +160,10 @@ MainWindow::MainWindow(const QDir &home) :
static const QIcon fullIcon(":images/toolbar/main/togglefull.png");
#if (defined Q_OS_MAC) && (defined GC_HAVE_LION)
fullScreen = new LionFullScreen(this);
fullScreen = new LionFullScreen(context);
#endif
#ifndef Q_OS_MAC
fullScreen = new QTFullScreen(this);
fullScreen = new QTFullScreen(context);
#endif
// if no workout directory is configured, default to the

View File

@@ -18,6 +18,7 @@
#include "MergeActivityWizard.h"
#include "Context.h"
#include "MainWindow.h"
/**
* Wizard to merge 2 files from same ride

View File

@@ -19,7 +19,6 @@
#ifndef _MergeActivityWizard_h
#define _MergeActivityWizard_h
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include "RideItem.h"
#include "RideFile.h"
#include "RideFile.h"

View File

@@ -20,8 +20,8 @@
#ifndef _GC_PowerHist_h
#define _GC_PowerHist_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include "RideFile.h"
#include "RideItem.h"
#include "Context.h"
#include "Athlete.h"
#include "Zones.h"

View File

@@ -18,16 +18,16 @@
#include "QTFullScreen.h"
QTFullScreen::QTFullScreen(MainWindow *mainWindow) : QObject(mainWindow), mainWindow(mainWindow), isFull(false)
QTFullScreen::QTFullScreen(Context *context) : QObject(context->mainWindow), context(context), isFull(false)
{
// watch for ESC key being hit when in full screen
mainWindow->installEventFilter(this);
context->mainWindow->installEventFilter(this);
}
bool
QTFullScreen::eventFilter(QObject *obj, QEvent *event)
{
if (obj != mainWindow) return false;
if (obj != context->mainWindow) return false;
// F11 toggle full screen
if (event->type() == QEvent::KeyPress && static_cast<QKeyEvent *>(event)->key() == Qt::Key_F11) {
@@ -39,7 +39,7 @@ QTFullScreen::eventFilter(QObject *obj, QEvent *event)
// if in full screen then toggle, otherwise do nothing
if (isFull) {
mainWindow->showNormal();
context->mainWindow->showNormal();
isFull = false;
}
return false;
@@ -52,9 +52,9 @@ void
QTFullScreen::toggle()
{
if (isFull) {
mainWindow->showNormal();
context->mainWindow->showNormal();
} else {
mainWindow->showFullScreen();
context->mainWindow->showFullScreen();
}
isFull = !isFull;
}

View File

@@ -24,7 +24,6 @@
// QT stuff etc
#include <QtGui>
#include "MainWindow.h"
class QTFullScreen : public QObject
{
@@ -32,7 +31,7 @@ class QTFullScreen : public QObject
public:
QTFullScreen(MainWindow *mainWindow);
QTFullScreen(Context *context);
// found in the supplied directory
void toggle();
@@ -41,7 +40,7 @@ class QTFullScreen : public QObject
bool eventFilter(QObject *obj, QEvent *event);
private:
MainWindow *mainWindow;
Context *context;
bool isFull;
};

View File

@@ -19,7 +19,7 @@
#ifndef _GC_RideSummaryWindow_h
#define _GC_RideSummaryWindow_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include "MainWindow.h" // for isfiltered and filters
#include "Context.h"
#include <QWidget>

View File

@@ -28,7 +28,6 @@
#include <limits>
#include "TrainSidebar.h"
#include "RealtimeController.h"
#include "MainWindow.h"
#include "RideItem.h"
#include "RideFile.h"
@@ -320,7 +319,7 @@ public:
RealtimeRider(Context *context)
{
curPosition = 1;
connect(context->mainWindow,SIGNAL(telemetryUpdate(const RealtimeData &)), this,SLOT(telemetryUpdate(const RealtimeData &)));
connect(context,SIGNAL(telemetryUpdate(const RealtimeData &)), this,SLOT(telemetryUpdate(const RealtimeData &)));
}
};

View File

@@ -19,7 +19,7 @@
#ifndef _GC_TreeMapWindow_h
#define _GC_TreeMapWindow_h 1
#include "GoldenCheetah.h"
#include "MainWindow.h"
#include "MainWindow.h" // or isfiltered and filters
#include <QtGui>
#include <QTimer>