GcWindow::GcWindow(QWidget *parent) : QFrame(parent), dragState(None) { qRegisterMetaType<QWidget*>("controls"); qRegisterMetaType<RideItem*>("ride"); qRegisterMetaType<GcWinID>("type"); qRegisterMetaType<QColor>("color"); qRegisterMetaType<DateRange>("dateRange"); qRegisterMetaType<bool>("nomenu"); setParent(parent); setControls(NULL); setRideItem(NULL); setTitle(""); setContentsMargins(0,0,0,0); setResizable(false); setMouseTracking(true); setProperty("color", Qt::white); setProperty("nomenu", false); // make sure its underneath the toggle button menuButton = new QToolButton(this); menuButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); menuButton->setCursor(Qt::ArrowCursor); menuButton->setPopupMode(QToolButton::InstantPopup); menuButton->setFixedSize(15,20); menu = new QMenu(this); menuButton->setMenu(menu); menu->addAction(tr("Close"), this, SLOT(_closeWindow())); menuButton->hide(); #ifndef Q_OS_MAC // spacing .. menuButton->move(0,0); #endif }
RideSummaryWindow::RideSummaryWindow(MainWindow *mainWindow, bool ridesummary) : GcChartWindow(mainWindow), mainWindow(mainWindow), ridesummary(ridesummary), useCustom(false), useToToday(false) { setInstanceName("Ride Summary Window"); setRideItem(NULL); // allow user to select date range if in summary mode dateSetting = new DateSettingsEdit(this); if (ridesummary) { setControls(NULL); dateSetting->hide(); // not needed, but holds property values } else { QWidget *c = new QWidget; c->setContentsMargins(0,0,0,0); QFormLayout *cl = new QFormLayout(c); cl->setContentsMargins(0,0,0,0); cl->setSpacing(0); setControls(c); cl->addRow(new QLabel(tr("Date range")), dateSetting); } QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setSpacing(0); vlayout->setContentsMargins(10,10,10,10); rideSummary = new QWebView(this); rideSummary->setContentsMargins(0,0,0,0); rideSummary->page()->view()->setContentsMargins(0,0,0,0); rideSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); rideSummary->setAcceptDrops(false); QFont defaultFont; // mainwindow sets up the defaults.. we need to apply rideSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); rideSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); vlayout->addWidget(rideSummary); if (ridesummary) { connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged())); connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(refresh())); connect(mainWindow, SIGNAL(intervalsChanged()), this, SLOT(refresh())); } else {
MetadataWindow::MetadataWindow(Context *context) : GcChartWindow(context), context(context) { setControls(NULL); setRideItem(NULL); setContentsMargins(0,0,0,0); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setSpacing(0); rideMetadata = new RideMetadata(context); QFont font; font.setPointSize(font.pointSize()); rideMetadata->setFont(font); rideMetadata->setContentsMargins(20,0,20,20); vlayout->addWidget(rideMetadata); setChartLayout(vlayout); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged())); }
SummaryWindow::SummaryWindow(Context *context) : GcWindow(context), context(context) { setControls(NULL); setRideItem(NULL); splitter = new QSplitter(Qt::Vertical, this); splitter->setHandleWidth(1); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setSpacing(0); vlayout->setContentsMargins(1,1,1,1); vlayout->addWidget(splitter); rideSummary = new RideSummaryWindow(context); rideMetadata = new RideMetadata(context); splitter->addWidget(rideSummary); splitter->addWidget(rideMetadata); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged())); }