author | zautrix <zautrix> | 2005-04-01 19:24:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 19:24:18 (UTC) |
commit | b1e3bf53b1c4cc46ef0a2ded04338bc38a640161 (patch) (side-by-side diff) | |
tree | 7f6aecc33d464e28d18e07b0663450e917ea594b | |
parent | 1022d8763a5185c74d1fb1fba9857d6e3afd9ff5 (diff) | |
download | kdepimpi-b1e3bf53b1c4cc46ef0a2ded04338bc38a640161.zip kdepimpi-b1e3bf53b1c4cc46ef0a2ded04338bc38a640161.tar.gz kdepimpi-b1e3bf53b1c4cc46ef0a2ded04338bc38a640161.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaview.cpp | 16 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 7 |
2 files changed, 16 insertions, 7 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 99f547a..667ff2a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -109,153 +109,161 @@ void TimeLabels::setCellHeight(int height) */ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) { // if ( globalFlagBlockAgenda ) // return; // bug: the parameters cx, cy, cw, ch are the areas that need to be // redrawn, not the area of the widget. unfortunately, this // code assumes the latter... // now, for a workaround... // these two assignments fix the weird redraw bug mRedrawNeeded = true; if ( mRedrawNeeded ) { cx = contentsX() + frameWidth()*2; cw = contentsWidth() ; // end of workaround int cell = ((int)(cy/mCellHeight)); int y = cell * mCellHeight; QFontMetrics fm = fontMetrics(); QString hour; QString suffix; int timeHeight = fm.ascent(); QFont nFont = p->font(); if (!KGlobal::locale()->use12Clock()) suffix = "00"; if ( timeHeight > mCellHeight ) { timeHeight = mCellHeight-1; int pointS = nFont.pointSize(); while ( pointS > 4 ) { nFont.setPointSize( pointS ); fm = QFontMetrics( nFont ); if ( fm.ascent() < mCellHeight ) break; -- pointS; } fm = QFontMetrics( nFont ); timeHeight = fm.ascent(); } //timeHeight -= (timeHeight/4-2); QFont sFont = nFont; sFont.setPointSize( sFont.pointSize()/2 ); QFontMetrics fmS( sFont ); int sHei = fmS.ascent() ; //sHei -= (sHei/4-2); - int startW = this->width() - 2*frameWidth()-1; + int startW = this->width() - frameWidth()-2; int tw2 = fmS.width(suffix); while (y < cy + ch) { p->drawLine(cx,y,cw,y); hour.setNum(cell); // handle 24h and am/pm time formats if (KGlobal::locale()->use12Clock()) { if (cell > 11) suffix = "pm"; else suffix = "am"; if (cell == 0) hour.setNum(12); if (cell > 12) hour.setNum(cell - 12); tw2 = fmS.width(suffix); } // center and draw the time label int timeWidth = fm.width(hour); int offset = startW - timeWidth - tw2 ; p->setFont( nFont ); p->drawText( offset, y+ timeHeight, hour); p->setFont( sFont ); offset = startW - tw2+1; p->drawText( offset, y+ sHei, suffix); // increment indices y += mCellHeight; cell++; } } else { //qDebug("NO redraw "); } // double buffer not yet implemented //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); //mRedrawNeeded = false; } /** Calculates the minimum width. */ int TimeLabels::minimumWidth() const { return mMiniWidth; } /** updates widget's internal state */ void TimeLabels::updateConfig() { mRedrawNeeded = true; // set the font // config->setGroup("Fonts"); // QFont font = config->readFontEntry("TimeBar Font"); setFont(KOPrefs::instance()->mTimeBarFont); - QString test = "20oo"; + QString test = "20"; if (KGlobal::locale()->use12Clock()) - test = "12mi"; - mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; + test = "12"; + mMiniWidth = fontMetrics().width(test); + if (KGlobal::locale()->use12Clock()) + test = "pm"; + else + test = "00"; + QFont sFont = font(); + sFont.setPointSize( sFont.pointSize()/2 ); + QFontMetrics fmS( sFont ); + mMiniWidth += fmS.width( test ) + frameWidth()*2 +4 ; // update geometry restrictions based on new settings setFixedWidth( mMiniWidth ); // update HourSize mCellHeight = KOPrefs::instance()->mHourSize*4; resizeContents(50,mRows * mCellHeight); } /** update time label positions */ void TimeLabels::positionChanged() { int adjustment = mAgenda->contentsY(); setContentsPos(0, adjustment); } /** */ void TimeLabels::setAgenda(KOAgenda* agenda) { mAgenda = agenda; } void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) { mMouseDownY = e->pos().y(); mOrgCap = topLevelWidget()->caption(); } void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) { int diff = mMouseDownY - e->pos().y(); if ( diff < 10 && diff > -10 ) return; int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; if ( tSize < 4 ) tSize = 4; if ( tSize > 22 ) tSize = 22; tSize = (tSize-2)/2; topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); } void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) { topLevelWidget()->setCaption( mOrgCap ); int diff = mMouseDownY - e->pos().y(); if ( diff < 10 && diff > -10 ) return; int tSize = KOPrefs::instance()->mHourSize + (diff/10); diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index d675517..6cb1f31 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp @@ -633,105 +633,106 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) } recalcId(); doResize(); return; } p = s; s = data->list.next(); } } } /*! Shows a rubber band at position \a p. If \a p is negative, the rubber band is removed. */ void KDGanttMinimizeSplitter::setRubberband( int p ) { #ifdef DESKTOP_VERSION QPainter paint( this ); paint.setPen( gray ); paint.setBrush( gray ); paint.setRasterOp( XorROP ); QRect r = contentsRect(); const int rBord = 3; //Themable???? #if QT_VERSION >= 0x030000 int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); #else int sw = style().splitterWidth(); #endif if ( orient == Horizontal ) { if ( opaqueOldPos >= 0 ) paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), 2*rBord, r.height() ); if ( p >= 0 ) paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); } else { if ( opaqueOldPos >= 0 ) paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, r.width(), 2*rBord ); if ( p >= 0 ) paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); } opaqueOldPos = p; #else if ( !mRubberBand ) { mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); mRubberBand->setFrameStyle( Box | Raised ); - mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); + //mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); + mRubberBand->setPalette( QPalette ( QColor( 178,18,188), QColor( 242,27,255 ) )); } QRect r = contentsRect(); static int rBord = 0; //Themable???? if ( !rBord ) { if (QApplication::desktop()->width() <= 320 ) - rBord = 4; + rBord = 3; else - rBord = 5; + rBord = 4; } int sw = style().splitterWidth(); if ( orient == Horizontal ) { if ( p >= 0 ) { QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); } } else { if ( p >= 0 ) { QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); } } opaqueOldPos = p; if ( ! mRubberBand->isVisible() ) { mRubberBand->show(); } #endif } /*! \reimp */ bool KDGanttMinimizeSplitter::event( QEvent *e ) { if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { recalc( isVisible() ); if ( e->type() == QEvent::Show ) data->firstShow = FALSE; } return QWidget::event( e ); } /*! \obsolete Draws the splitter handle in the rectangle described by \a x, \a y, \a w, \a h using painter \a p. \sa QStyle::drawPrimitive() */ void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, QCOORD x, QCOORD y, QCOORD w, QCOORD h ) { #if 0 // LR style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), (orientation() == Qt::Horizontal ? QStyle::Style_Horizontal : 0)); |