]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/daynavigatorwidget.cpp
Changed the placement of the date label again.
[toast/confclerk.git] / src / gui / daynavigatorwidget.cpp
index ebe439f43cb3851091e59f3a775c3a69456a2c54..07d13bc5fc5873829fa2d773c0ad706289ab4730 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 2010 Ixonos Plc.
+ * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
+ *
+ * This file is part of ConfClerk.
+ *
+ * ConfClerk is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * ConfClerk is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
+ */
 #include "daynavigatorwidget.h"
 
 #include <QPainter>
 #include "daynavigatorwidget.h"
 
 #include <QPainter>
@@ -23,12 +42,11 @@ void DayNavigatorWidget::setDates(const QDate &aStartDate, const QDate &aEndDate
 {
     Q_ASSERT(aStartDate<=aEndDate);
 
 {
     Q_ASSERT(aStartDate<=aEndDate);
 
-    //qDebug() << "DayNavigatorWidget::setDates(): " << aStartDate << ", " << aEndDate;
     mStartDate = aStartDate;
     mEndDate = aEndDate;
     mCurDate = aStartDate;
 
     mStartDate = aStartDate;
     mEndDate = aEndDate;
     mCurDate = aStartDate;
 
-    QRect rect = mFontMetrics->boundingRect(mCurDate.toString("MMM dd yyyy"));
+    // QRect rect = mFontMetrics->boundingRect(mCurDate.toString("MMM dd yyyy"));
 
     if(mStartDate==mEndDate) // only one day conference
     {
 
     if(mStartDate==mEndDate) // only one day conference
     {
@@ -47,7 +65,6 @@ void DayNavigatorWidget::setDates(const QDate &aStartDate, const QDate &aEndDate
 
 void DayNavigatorWidget::prevDayButtonClicked()
 {
 
 void DayNavigatorWidget::prevDayButtonClicked()
 {
-    //qDebug() << mStartDate << ":" << mCurDate << ":" << mEndDate;
     if(mCurDate>mStartDate)
     {
         mCurDate = mCurDate.addDays(-1);
     if(mCurDate>mStartDate)
     {
         mCurDate = mCurDate.addDays(-1);
@@ -69,7 +86,6 @@ void DayNavigatorWidget::prevDayButtonClicked()
 
 void DayNavigatorWidget::nextDayButtonClicked()
 {
 
 void DayNavigatorWidget::nextDayButtonClicked()
 {
-    //qDebug() << mStartDate << ":" << mCurDate << ":" << mEndDate;
     if(mCurDate<mEndDate)
     {
         mCurDate = mCurDate.addDays(1);
     if(mCurDate<mEndDate)
     {
         mCurDate = mCurDate.addDays(1);
@@ -93,20 +109,12 @@ void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
 {
     Q_UNUSED(aEvent);
 
 {
     Q_UNUSED(aEvent);
 
-    QString selectedDateStr = mCurDate.toString("MMM dd yyyy");
-
+    QString selectedDateStr = mCurDate.toString("dddd\nyyyy-MM-dd");
     QPainter painter(this);
     painter.save();
     QPainter painter(this);
     painter.save();
-    QRect r = selectedDate->geometry();
-    QRect s = mFontMetrics->boundingRect(selectedDateStr);
-    QPoint p = QPoint(
-            r.x() + r.width()/2 - s.height()/2 - mFontMetrics->descent(),
-            - 130
-            );
-
-    painter.translate(r.width()/2, r.height()/2);
+    QRect q(y()-height(), x(), height(), width());
     painter.rotate(270);
     painter.rotate(270);
-    painter.drawText(p.y(), p.x(), selectedDateStr); // y,x,string
+    painter.drawText(q, Qt::AlignCenter, selectedDateStr);
     painter.restore();
 }
 
     painter.restore();
 }