author | zautrix <zautrix> | 2005-03-25 13:47:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-25 13:47:53 (UTC) |
commit | 5a0130ffdbf03fa5b881f856b41d081e91e1958b (patch) (side-by-side diff) | |
tree | c71ac939789927dd9c77f2c6e88b910008db7f9b | |
parent | e3b935f4e24086117213662e670ab26cb2ad8822 (diff) | |
download | kdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.zip kdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.tar.gz kdepimpi-5a0130ffdbf03fa5b881f856b41d081e91e1958b.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/komonthview.cpp | 68 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
2 files changed, 44 insertions, 25 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 38cfda7..12233ee 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -749,28 +749,17 @@ void MonthViewCell::finishUpdateCell() if (mToolTip.count() > 0 ) { mToolTip.sort(); QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); } #endif sort(); //setMyPalette(); setMyPalette(); - QString text; - bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; - if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { - text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; - mLabel->resize( mLabelBigSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); - } else { - mLabel->resize( mLabelSize ); - text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); - } - mLabel->setText( text ); resizeEvent( 0 ); } void MonthViewCell::updateCell() { //qDebug("MonthViewCell::updateCell() "); if ( !mMonthView->isUpdatePossible() ) return; @@ -890,16 +879,31 @@ void MonthViewCell::select() } void MonthViewCell::resizeEvent ( QResizeEvent * e ) { if ( !mMonthView->isUpdatePossible() ) return; //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); deselect(); + mLabel->setMaximumHeight( height() - lineWidth()*2 ); + + QString text; + mLabel->setText( text ); + bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; + if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { + text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; + mLabel->resize( mLabelBigSize ); + text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); + } else { + mLabel->resize( mLabelSize ); + text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); + } + mLabel->setText( text ); + int size = height() - mLabel->height() - lineWidth()-1; //qDebug("LW %d ", lineWidth()); if ( size > 0 ) verticalScrollBar()->setMaximumHeight( size ); size = width() - mLabel->width() -lineWidth()-1; if ( size > 0 ) horizontalScrollBar()->setMaximumWidth( size ); mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); @@ -1443,17 +1447,17 @@ void KOMonthView::updateView() } } } for( i = 0; i < timeSpan+1; ++i ) { (*cells)[i]->finishUpdateCell(); } processSelectionChange(); - qApp->processEvents(); + //qApp->processEvents(); for( i = 0; i < timeSpan+1; ++i ) { (*cells)[i]->repaintfinishUpdateCell(); } (*cells)[0]->setFocus(); #else // old code @@ -1469,28 +1473,28 @@ void KOMonthView::updateView() (*cells)[0]->setFocus(); #endif //qDebug("update time %d ", ti.elapsed()); } void KOMonthView::resizeEvent(QResizeEvent * e) { - qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); + //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); if ( isVisible() ) { - qDebug("KOMonthView::isVisible "); + //qDebug("KOMonthView::isVisible "); slotComputeLayout(); } else mComputeLayoutTimer->start( 100 ); } void KOMonthView::slotComputeLayout() { mComputeLayoutTimer->stop(); - qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); + //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); computeLayout(); clPending = true; if ( mShowWeekView ) mCellsW[0]->setFocus(); else mCells[0]->setFocus(); } @@ -1509,17 +1513,17 @@ void KOMonthView::computeLayoutWeek() int wid = width();//e int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) return; if ( lastWid == width() && lastHei == height() ) { - qDebug("KOListWeekView::No compute layout needed "); + //qDebug("KOListWeekView::No compute layout needed "); return; } lastWid = width(); lastHei = height(); if ( wid < hei ) daysToShow = 2; @@ -1562,49 +1566,55 @@ void KOMonthView::computeLayoutWeek() else mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei; + int max = 0; for ( i = 0; i < mCellsW.count(); ++i) { if ( i > 6 ) { mCellsW[i]->hide(); continue; } w = colWid; if ( ((i) % daysToShow) >= daysToShow-colModulo ) { ++w; } if ( i == (daysToShow-1-rowModulo)*7) ++h; if ( i >= 5 ) { if ( i ==5 ) { - mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); + max = h/2; + mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; } else { if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { ++w; } - mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); + max = h-h/2; + mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } - } else + } else { + max = h; mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } x += w; if ( x + w/2 > wid ) { x = 0; y += h+dayLabelHei ; } + //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); } y= dayLabelHei; h = cellHei ; mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; @@ -1637,23 +1647,23 @@ void KOMonthView::computeLayout() int wid = width();//e int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { return; } if ( lastWid == width() && lastHei == height() ){ - qDebug("KOMonthview::No compute layout needed "); + //qDebug("KOMonthview::No compute layout needed "); return; } lastWid = width(); lastHei = height(); - qDebug("KOMonthView::computeLayout() MMM ------------------- "); + //qDebug("KOMonthView::computeLayout() MMM ------------------- "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; int colWid = wid / daysToShow; int lastCol = wid - ( colWid*6 ); int dayLabelHei = mDayLabels[0]->sizeHint().height(); int cellHei = (hei - dayLabelHei) /6; @@ -1679,44 +1689,52 @@ void KOMonthView::computeLayout() } else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei ; + int max = 0; for ( i = 0; i < mCells.count(); ++i) { //qDebug("iii %d ", i); w = colWid; if ( ((i) % 7) >= 7-colModulo ) { ++w; } if ( i == (6-rowModulo)*7) ++h; if ( combinedSatSun ) { if ( (i)%7 >= daysToShow-1 ) { if ( (i)%7 == daysToShow-1 ) { - mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); + max = h/2; + mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; } else { - mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); + max = h-h/2; + mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } - } else + } else { + max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } } - else + else { + max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); + } x += w; if ( x + w/2 > wid ) { x = 0; y += h; } + //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); } y= dayLabelHei; h = cellHei ; for ( i = 0; i < 6; i++) { if ( i == (6-rowModulo)) ++h; mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); y += h; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index b997c1a..a58f6b8 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -154,16 +154,17 @@ class MonthViewCell : public KNoScrollListBox void insertTodo(Todo *); void updateConfig( bool bigFont = false ); void enableScrollBars( bool ); Incidence *selectedIncidence(); QDate selectedIncidenceDate(); + QPushButton * dateLabel() { return mLabel; } void deselect(); void select(); #ifdef DESKTOP_VERSION static QToolTipGroup *toolTipGroup(); #endif signals: |