Simplify Diary Window

Now only shows monthly view, since;

* qxtscheduleview (weekly) has too many bugs
* rideSummary (ride) is redundant, just add that window to the view

Fixes #546.
This commit is contained in:
Mark Liversedge
2011-12-25 12:09:22 +00:00
parent 96a3d9f49a
commit 71f68d823d
2 changed files with 23 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ DiaryWindow::DiaryWindow(MainWindow *mainWindow) :
prev->setFlat(true);
#endif
#if 0
// viewMode - monthly or weekly
viewMode = new QComboBox;
viewMode->addItem("View Month");
@@ -56,13 +57,16 @@ DiaryWindow::DiaryWindow(MainWindow *mainWindow) :
viewMode->setFixedWidth(120);
viewMode->setCurrentIndex(appsettings->cvalue(mainWindow->cyclist, GC_DIARY_VIEW, "1").toInt());
#endif
controls->addWidget(prev);
controls->addWidget(next);
controls->addStretch();
controls->addWidget(title, Qt::AlignCenter | Qt::AlignVCenter);
controls->addStretch();
#if 0
controls->addWidget(viewMode);
#endif
vlayout->addLayout(controls);
@@ -93,13 +97,14 @@ DiaryWindow::DiaryWindow(MainWindow *mainWindow) :
allViews->addWidget(monthlyView);
allViews->addWidget(weeklyView);
allViews->addWidget(rideSummary);
allViews->setCurrentIndex(viewMode->currentIndex());
//allViews->setCurrentIndex(viewMode->currentIndex());
allViews->setCurrentIndex(0);
vlayout->addWidget(allViews);
connect(viewMode, SIGNAL(currentIndexChanged(int)), allViews, SLOT(setCurrentIndex(int)));
connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setDefaultView(int)));
connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(rideSelected()));
//connect(viewMode, SIGNAL(currentIndexChanged(int)), allViews, SLOT(setCurrentIndex(int)));
//connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setDefaultView(int)));
//connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(rideSelected()));
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
//connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged()));
@@ -147,12 +152,15 @@ DiaryWindow::rideSelected()
weeklyView->setDateRange(when, when.addDays(6));
weeklyView->setViewMode(QxtScheduleView::DayView);
#if 0
// ok update title
switch (viewMode->currentIndex()) {
case 0 : // monthly
#endif
title->setText(QString("%1 %2").arg(QDate::longMonthName(month)).arg(year));
next->show();
prev->show();
#if 0
break;
case 1 : // weekly
title->setText(QString("Week %1 %2").arg(weekNumber).arg(year));
@@ -167,19 +175,23 @@ DiaryWindow::rideSelected()
prev->hide();
break;
}
#endif
}
void
DiaryWindow::prevClicked()
{
#if 0
switch (viewMode->currentIndex()) {
case 0 : // monthly
{
#endif
int month = calendarModel->getMonth();
int year = calendarModel->getYear();
QDate when = QDate(year, month, 1).addDays(-1);
calendarModel->setMonth(when.month(), when.year());
title->setText(QString("%1 %2").arg(QDate::longMonthName(when.month())).arg(when.year()));
#if 0
}
break;
case 1 : // weekly
@@ -192,19 +204,23 @@ DiaryWindow::prevClicked()
}
break;
}
#endif
}
void
DiaryWindow::nextClicked()
{
#if 0
switch (viewMode->currentIndex()) {
case 0 : // monthly
{
#endif
int month = calendarModel->getMonth();
int year = calendarModel->getYear();
QDate when = QDate(year, month, 1).addMonths(1);
calendarModel->setMonth(when.month(), when.year());
title->setText(QString("%1 %2").arg(QDate::longMonthName(when.month())).arg(when.year()));
#if 0
}
break;
case 1 : // weekly
@@ -217,6 +233,7 @@ DiaryWindow::nextClicked()
}
break;
}
#endif
}
void

View File

@@ -55,8 +55,8 @@ class DiaryWindow : public GcWindow
DiaryWindow(MainWindow *);
int view() const { return viewMode->currentIndex(); }
void setView(int x) { viewMode->setCurrentIndex(x); }
int view() const { return 0; /* viewMode->currentIndex(); */ }
void setView(int /* x */ ) { /* viewMode->setCurrentIndex(x); */ }
public slots:
void rideSelected();