diff --git a/src/DiaryWindow.cpp b/src/DiaryWindow.cpp index 7568e78c7..6f72092c7 100644 --- a/src/DiaryWindow.cpp +++ b/src/DiaryWindow.cpp @@ -75,6 +75,7 @@ DiaryWindow::DiaryWindow(MainWindow *mainWindow) : monthlyView->setModel(calendarModel); monthlyView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); monthlyView->verticalHeader()->setResizeMode(QHeaderView::Stretch); + monthlyView->verticalHeader()->hide(); monthlyView->viewport()->installEventFilter(this); monthlyView->setGridStyle(Qt::DotLine); monthlyView->setFrameStyle(QFrame::NoFrame); diff --git a/src/GcCalendarModel.h b/src/GcCalendarModel.h index bcdafce81..55fe7fd6b 100644 --- a/src/GcCalendarModel.h +++ b/src/GcCalendarModel.h @@ -309,7 +309,7 @@ public: if (role == Qt::DisplayRole) { if (orientation == Qt::Horizontal) { - return QDate::longDayName(section+1); + return QDate::shortDayName(section+1); } else { return QString("%1").arg(date(index(section,0)).weekNumber()); } diff --git a/src/GoogleMapControl.cpp b/src/GoogleMapControl.cpp index 7d4293105..4812db36a 100644 --- a/src/GoogleMapControl.cpp +++ b/src/GoogleMapControl.cpp @@ -149,6 +149,7 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran setContentsMargins(0,0,0,0); layout = new QVBoxLayout(); layout->setSpacing(0); + layout->setContentsMargins(2,0,2,2); setLayout(layout); parent = mw; @@ -158,10 +159,20 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); layout->addWidget(view); + // we redraw on resize after a timeout + // to let the user move splitter etc + // without an immediate redraw, since it + // makes the UI unresponsive + delay = new QTimer(this); + delay->setSingleShot(true); + //connect(parent, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); connect(view, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); + connect(delay, SIGNAL(timeout()), this, SLOT(loadRide())); + + first = true; loadingPage = false; newRideToLoad = false; } @@ -169,8 +180,7 @@ GoogleMapControl::GoogleMapControl(MainWindow *mw) : GcWindow(mw), main(mw), ran void GoogleMapControl::rideSelected() { - if (!amVisible()) - return; + if (myRideItem == NULL || !amVisible()) return; RideItem * ride = myRideItem; if (ride == current || !ride || !ride->ride()) @@ -228,15 +238,16 @@ GoogleMapControl::rideSelected() void GoogleMapControl::resizeEvent(QResizeEvent * ) { - static bool first = true; if (!amVisible()) return; if (first == true) { first = false; - } else { - newRideToLoad = true; - loadRide(); + return; } + + newRideToLoad = true; + delay->stop(); + delay->start(1000); } void GoogleMapControl::loadStarted() diff --git a/src/GoogleMapControl.h b/src/GoogleMapControl.h index dc6a8f9db..b21c1dab2 100644 --- a/src/GoogleMapControl.h +++ b/src/GoogleMapControl.h @@ -58,7 +58,6 @@ G_OBJECT QString &intervalName, bool useMetrics); std::string CreateMarkers(); std::string CreateIntervalMarkers(RideItem *ride); - void loadRide(); std::string CreateMarker(int number, double lat, double lon, std::string &html); // the web browser is loading a page, do NOT start another load bool loadingPage; @@ -81,6 +80,7 @@ G_OBJECT void rideSelected(); private slots: + void loadRide(); void loadStarted(); void loadFinished(bool); @@ -91,6 +91,8 @@ G_OBJECT public: GoogleMapControl(MainWindow *); virtual ~GoogleMapControl() { } + QTimer *delay; + bool first; }; #endif diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 3461c495f..5dd09ccba 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -97,15 +97,16 @@ HomeWindow::HomeWindow(MainWindow *mainWindow, QString name, QString /* windowti tabbed->setTabsClosable(false); tabbed->setPalette(palette); tabbed->setDocumentMode(false); + tabbed->setMovable(true); QTabBar *tb = tabbed->findChild(QLatin1String("qt_tabwidget_tabbar")); tb->setShape(QTabBar::RoundedSouth); tb->setDrawBase(false); - tabbed->setStyleSheet("QTabBar { alignment: center; }" + tabbed->setStyleSheet("QTabWidget::tab-bar { alignment: center; }" "QTabWidget::pane { top: 20px; }" #if 0 - "QTabBar::tab:selected { background: #A8A8A8; font: bold; border: 1px; border-color: black; }" - "QTabBar::tab:!selected { background: #A8A8A8;font: normal; }" + "QTabWidget::tab-bar::tab:selected { background: #A8A8A8; font: bold; border: 1px; border-color: black; }" + "QTabWidget::tab-bar::tab:!selected { background: #A8A8A8;font: normal; }" #endif ); @@ -177,6 +178,7 @@ HomeWindow::HomeWindow(MainWindow *mainWindow, QString name, QString /* windowti connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged())); connect(tabbed, SIGNAL(currentChanged(int)), this, SLOT(tabSelected(int))); connect(tabbed, SIGNAL(tabCloseRequested(int)), this, SLOT(removeChart(int))); + connect(tb, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int))); #if 0 connect(styleSelector, SIGNAL(clicked(int,bool)), SLOT(styleChanged(int))); #else @@ -262,6 +264,24 @@ HomeWindow::tabSelected(int index) } } +void +HomeWindow::tabMoved(int to, int from) +{ + // re-order the tabs + GcWindow *orig = charts[to]; + charts[to] = charts[from]; + charts[from] = orig; + + // re-order the controls + QStackedWidget *stack = dynamic_cast(controls()); + stack->blockSignals(true); + QWidget *w = stack->widget(from); + stack->removeWidget(w); + stack->insertWidget(to, w); + stack->setCurrentIndex(to); + stack->blockSignals(false); +} + void HomeWindow::styleChanged(int id) { @@ -386,6 +406,9 @@ void HomeWindow::addChart(GcWindow* newone) { int chartnum = charts.count(); + + active = true; + if (newone) { //GcWindow *newone = GcWindowRegistry::newGcWindow(GcWindows[i].id, mainWindow); @@ -395,7 +418,7 @@ HomeWindow::addChart(GcWindow* newone) QWidget *x = dynamic_cast(newone)->controls(); QWidget *c = (x != NULL) ? x : new QWidget(this); - if (chartCursor >= 0) + if (currentStyle == 2 && chartCursor >= 0) m->insertWidget(chartCursor, c); else m->addWidget(c); @@ -454,13 +477,13 @@ HomeWindow::addChart(GcWindow* newone) newone->setContentsMargins(0,15,0,0); newone->setResizable(true); // we need to show on tab selection! - if (chartCursor >= 0) winFlow->insert(chartCursor, newone); + if (currentStyle == 2 && chartCursor >= 0) winFlow->insert(chartCursor, newone); else winFlow->addWidget(newone); } break; } // add to the list - if (chartCursor >= 0) charts.insert(chartCursor, newone); + if (currentStyle == 2 && chartCursor >= 0) charts.insert(chartCursor, newone); else charts.append(newone); newone->hide(); @@ -470,6 +493,7 @@ HomeWindow::addChart(GcWindow* newone) connect(newone, SIGNAL(resized(GcWindow*)), this, SLOT(windowResized(GcWindow*))); connect(newone, SIGNAL(moved(GcWindow*)), this, SLOT(windowMoved(GcWindow*))); } + active = false; } bool @@ -1122,8 +1146,9 @@ HomeWindow::saveState() file.open(QFile::WriteOnly); file.resize(0); QTextStream out(&file); + out.setCodec("UTF-8"); - out<<"\n"; + out<<"\n"; // iterate over charts foreach (GcWindow *chart, charts) { @@ -1187,6 +1212,7 @@ HomeWindow::restoreState() xmlReader.parse(source); // layout the results + styleSelector->setCurrentIndex(handler.style); foreach(GcWindow *chart, handler.charts) addChart(chart); } @@ -1209,7 +1235,11 @@ bool ViewParser::endElement( const QString&, const QString&, const QString &qNam bool ViewParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs ) { if (name == "layout") { - // XXX do nothing - need to remember style (tab/scroll/tile) ... + for(int i=0; i charts; + int style; // unmarshall bool startDocument(); diff --git a/src/LTMChartParser.cpp b/src/LTMChartParser.cpp index fd7e7e123..ff1c9eb6c 100644 --- a/src/LTMChartParser.cpp +++ b/src/LTMChartParser.cpp @@ -239,6 +239,7 @@ LTMChartParser::serialize(QString filename, QList charts) file.open(QFile::WriteOnly); file.resize(0); QTextStream out(&file); + out.setCodec("UTF-8"); // begin document out << "\n"; diff --git a/src/RideMetadata.cpp b/src/RideMetadata.cpp index 77814280f..b59f4ccba 100644 --- a/src/RideMetadata.cpp +++ b/src/RideMetadata.cpp @@ -637,6 +637,7 @@ RideMetadata::serialize(QString filename, QListkeywordDefinit file.open(QFile::WriteOnly); file.resize(0); QTextStream out(&file); + out.setCodec("UTF-8"); // begin document out << "\n"; diff --git a/src/SeasonParser.cpp b/src/SeasonParser.cpp index 1af8fee03..60fa6baf6 100644 --- a/src/SeasonParser.cpp +++ b/src/SeasonParser.cpp @@ -116,6 +116,7 @@ SeasonParser::serialize(QString filename, QListSeasons) file.open(QFile::WriteOnly); file.resize(0); QTextStream out(&file); + out.setCodec("UTF-8"); // begin document out << "\n";