summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-05 14:03:26 (UTC)
committer zautrix <zautrix>2005-04-05 14:03:26 (UTC)
commit637415693af8fe9974b45c355ecfdd0745617ac3 (patch) (unidiff)
treef7d83828754e82b0eeb001a2837f7c3f6865d647
parente1fd021493c30106d2a31449d620ab6eaf96f18f (diff)
downloadkdepimpi-637415693af8fe9974b45c355ecfdd0745617ac3.zip
kdepimpi-637415693af8fe9974b45c355ecfdd0745617ac3.tar.gz
kdepimpi-637415693af8fe9974b45c355ecfdd0745617ac3.tar.bz2
minor pixel fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 6d6ae8a..e66ddce 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1625,70 +1625,80 @@ void KOMonthView::computeLayoutWeek()
1625 else 1625 else
1626 daysToShow = 3; 1626 daysToShow = 3;
1627 mShowSatSunComp = true; 1627 mShowSatSunComp = true;
1628 combinedSatSun = true; 1628 combinedSatSun = true;
1629 1629
1630 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1630 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1631 QFontMetrics fm ( mWeekLabels[0]->font() ); 1631 QFontMetrics fm ( mWeekLabels[0]->font() );
1632 int weeklabelwid = fm.width( "888" ); 1632 int weeklabelwid = fm.width( "888" );
1633 wid -= weeklabelwid; 1633 wid -= weeklabelwid;
1634 1634
1635 int colWid = wid / daysToShow; 1635 int colWid = wid / daysToShow;
1636 int lastCol = wid - ( colWid*6 ); 1636 int lastCol = wid - ( colWid*6 );
1637 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1637 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1638 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1638 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1639 int colModulo = wid % daysToShow; 1639 int colModulo = wid % daysToShow;
1640 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1640 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1641 //qDebug("rowmod %d ", rowModulo); 1641 //qDebug("rowmod %d ", rowModulo);
1642 int i; 1642 int i;
1643 int x,y,w,h; 1643 int x,y,w,h;
1644 x= 0; 1644 x= 0;
1645 y= 0; 1645 y= 0;
1646 w = colWid; 1646 w = colWid;
1647 h = dayLabelHei ; 1647 h = dayLabelHei ;
1648 for ( i = 0; i < 7; i++) { 1648 for ( i = 0; i < 7; i++) {
1649 if ( i && !( i % daysToShow) && i < 6) { 1649 if ( i && !( i % daysToShow) && i < 6) {
1650 y += hei/(5-daysToShow); 1650 y += hei/(5-daysToShow);
1651 x = 0; 1651 x = 0;
1652 w = colWid; 1652 w = colWid;
1653 } 1653 }
1654 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1654 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1655 ++w; 1655 ++w;
1656 } 1656 }
1657 if ( i >= 5 ) { 1657 if ( i >= 5 ) {
1658 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1658 int wi = width() - x - weeklabelwid;
1659 x -= (w/2 ); 1659 if ( i == 5 ) {
1660 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
1661 } else {
1662 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1663 }
1664 x = x - w + wi - (wi/2 );
1665 }
1666 else {
1667 int wi = w;
1668 if ( !(( i+1) % daysToShow)) {
1669 wi = width() - x - weeklabelwid;
1670 }
1671 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1660 } 1672 }
1661 else
1662 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1663 x += w; 1673 x += w;
1664 } 1674 }
1665 x= 0; 1675 x= 0;
1666 y= dayLabelHei; 1676 y= dayLabelHei;
1667 w = colWid; 1677 w = colWid;
1668 h = cellHei; 1678 h = cellHei;
1669 int max = 0; 1679 int max = 0;
1670 for ( i = 0; i < mCellsW.count(); ++i) { 1680 for ( i = 0; i < mCellsW.count(); ++i) {
1671 if ( i > 6 ) { 1681 if ( i > 6 ) {
1672 mCellsW[i]->hide(); 1682 mCellsW[i]->hide();
1673 continue; 1683 continue;
1674 } 1684 }
1675 1685
1676 w = colWid; 1686 w = colWid;
1677 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1687 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1678 ++w; 1688 ++w;
1679 } 1689 }
1680 if ( i == (daysToShow-1-rowModulo)*7) 1690 if ( i == (daysToShow-1-rowModulo)*7)
1681 ++h; 1691 ++h;
1682 1692
1683 if ( i >= 5 ) { 1693 if ( i >= 5 ) {
1684 if ( i ==5 ) { 1694 if ( i ==5 ) {
1685 max = h/2; 1695 max = h/2;
1686 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1696 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1687 x -= w ;y += h/2; 1697 x -= w ;y += h/2;
1688 } else { 1698 } else {
1689 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1699 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1690 ++w; 1700 ++w;
1691 } 1701 }
1692 max = h-h/2; 1702 max = h-h/2;
1693 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1703 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1694 y -= h/2; 1704 y -= h/2;
@@ -1747,93 +1757,99 @@ void KOMonthView::computeLayout()
1747 return; 1757 return;
1748 } 1758 }
1749 if ( lastWid == width() && lastHei == height() ){ 1759 if ( lastWid == width() && lastHei == height() ){
1750 //qDebug("KOMonthview::No compute layout needed "); 1760 //qDebug("KOMonthview::No compute layout needed ");
1751 return; 1761 return;
1752 } 1762 }
1753 1763
1754 lastWid = width(); 1764 lastWid = width();
1755 lastHei = height(); 1765 lastHei = height();
1756 //qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1766 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1757 QFontMetrics fm ( mWeekLabels[0]->font() ); 1767 QFontMetrics fm ( mWeekLabels[0]->font() );
1758 int weeklabelwid = fm.width( "888" ); 1768 int weeklabelwid = fm.width( "888" );
1759 wid -= weeklabelwid; 1769 wid -= weeklabelwid;
1760 1770
1761 int colWid = wid / daysToShow; 1771 int colWid = wid / daysToShow;
1762 int lastCol = wid - ( colWid*6 ); 1772 int lastCol = wid - ( colWid*6 );
1763 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1773 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1764 int cellHei = (hei - dayLabelHei) /6; 1774 int cellHei = (hei - dayLabelHei) /6;
1765 int colModulo = wid % daysToShow; 1775 int colModulo = wid % daysToShow;
1766 int rowModulo = (hei- dayLabelHei) % 6; 1776 int rowModulo = (hei- dayLabelHei) % 6;
1767 //qDebug("rowmod %d ", rowModulo); 1777 //qDebug("rowmod %d ", rowModulo);
1768 int i; 1778 int i;
1769 int x,y,w,h; 1779 int x,y,w,h;
1770 x= 0; 1780 x= 0;
1771 y= 0; 1781 y= 0;
1772 w = colWid; 1782 w = colWid;
1773 h = dayLabelHei ; 1783 h = dayLabelHei ;
1774 for ( i = 0; i < 7; i++) { 1784 for ( i = 0; i < 7; i++) {
1775 if ( i == daysToShow-colModulo ) 1785 if ( i == daysToShow-colModulo )
1776 ++w; 1786 ++w;
1777 if ( combinedSatSun ) { 1787 if ( combinedSatSun ) {
1778 if ( i >= daysToShow-1 ) { 1788 if ( i >= daysToShow-1 ) {
1779 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1789
1790 if ( i == 6 )
1791 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h);
1792 else
1793 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1780 x -= w/2 ; 1794 x -= w/2 ;
1781 } 1795 }
1782 else 1796 else
1783 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1797 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1784 } else 1798 } else
1785 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1799 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1786 x += w; 1800 x += w;
1787 } 1801 }
1788 x= 0; 1802 x= 0;
1789 y= dayLabelHei; 1803 y= dayLabelHei;
1790 w = colWid; 1804 w = colWid;
1791 h = cellHei ; 1805 h = cellHei ;
1792 int max = 0; 1806 int max = 0;
1793 for ( i = 0; i < mCells.count(); ++i) { 1807 for ( i = 0; i < mCells.count(); ++i) {
1794 //qDebug("iii %d ", i); 1808 //qDebug("iii %d ", i);
1795 w = colWid; 1809 w = colWid;
1796 if ( ((i) % 7) >= 7-colModulo ) { 1810 if ( ((i) % 7) >= 7-colModulo ) {
1797 ++w; 1811 ++w;
1798 } 1812 }
1799 if ( i == (6-rowModulo)*7) 1813 if ( i == (6-rowModulo)*7)
1800 ++h; 1814 ++h;
1801 if ( combinedSatSun ) { 1815 if ( combinedSatSun ) {
1802 if ( (i)%7 >= daysToShow-1 ) { 1816 if ( (i)%7 >= daysToShow-1 ) {
1803 if ( (i)%7 == daysToShow-1 ) { 1817 if ( (i)%7 == daysToShow-1 ) {
1818 w = width()-x-weeklabelwid;
1804 max = h/2; 1819 max = h/2;
1805 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1820 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1806 x -= w ;y += h/2; 1821 x -= w ;y += h/2;
1807 } else { 1822 } else {
1823 w = width()-x-weeklabelwid;
1808 max = h-h/2; 1824 max = h-h/2;
1809 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1825 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1810 y -= h/2; 1826 y -= h/2;
1811 } 1827 }
1812 } else { 1828 } else {
1813 max = h; 1829 max = h;
1814 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1830 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1815 } 1831 }
1816 1832
1817 } 1833 }
1818 else { 1834 else {
1819 max = h; 1835 max = h;
1820 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1836 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1821 } 1837 }
1822 x += w; 1838 x += w;
1823 if ( x + w/2 > wid ) { 1839 if ( x + w/2 > wid ) {
1824 x = 0; 1840 x = 0;
1825 y += h; 1841 y += h;
1826 } 1842 }
1827 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); 1843 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1828 } 1844 }
1829 y= dayLabelHei; 1845 y= dayLabelHei;
1830 h = cellHei ; 1846 h = cellHei ;
1831 for ( i = 0; i < 6; i++) { 1847 for ( i = 0; i < 6; i++) {
1832 if ( i == (6-rowModulo)) 1848 if ( i == (6-rowModulo))
1833 ++h; 1849 ++h;
1834 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1850 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1835 y += h; 1851 y += h;
1836 } 1852 }
1837 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1853 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1838 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1854 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1839 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1855 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());