From db8ce006d7427e659dac306026891d6d3d18a109 Mon Sep 17 00:00:00 2001 From: Mathias Soeken Date: Sun, 14 Dec 2008 16:08:35 +0000 Subject: [PATCH] revert my last change b/c we are in message freeze. I wonder why author names have to be translated. svn path=/trunk/KDE/kdegraphics/kruler/; revision=896874 --- klineal.cpp | 95 ++++++++++++++++++++++++++--------------------------- klineal.h | 43 +++++++++++------------- main.cpp | 7 ++-- 3 files changed, 69 insertions(+), 76 deletions(-) diff --git a/klineal.cpp b/klineal.cpp index 361da09..6e6b7dc 100644 --- a/klineal.cpp +++ b/klineal.cpp @@ -133,7 +133,7 @@ KLineal::KLineal( QWidget*parent ) mMenu = new KMenu( this ); mMenu->addTitle( i18n( "KRuler" ) ); - KMenu *oriMenu = new KMenu( i18n( "&Orientation" ), this ); + KMenu *oriMenu = new KMenu( i18n( "&Orientation"), this ); oriMenu->addAction( KIcon( "kruler-north" ), i18nc( "Turn Kruler North", "&North" ), this, SLOT( setNorth() ), Qt::Key_N ); @@ -176,13 +176,13 @@ KLineal::KLineal( QWidget*parent ) new QShortcut( Qt::CTRL + Qt::Key_F, this, SLOT( setFullLength() ) ); mMenu->addMenu( mLenMenu ); mMenu->addAction( KIcon( "preferences-desktop-color" ), - i18n( "&Choose Color..." ), this, SLOT( chooseColor() ), + i18n( "&Choose Color..." ), this, SLOT( choseColor() ), Qt::CTRL + Qt::Key_C ); mMenu->addAction( KIcon( "preferences-desktop-font" ), - i18n( "Choose &Font..." ), this, SLOT( chooseFont() ), + i18n( "Choose &Font..." ), this, SLOT( choseFont() ), Qt::Key_F ); - new QShortcut(Qt::CTRL + Qt::Key_C, this, SLOT(chooseColor() ) ); - new QShortcut(Qt::Key_F, this, SLOT( chooseFont() ) ); + new QShortcut(Qt::CTRL + Qt::Key_C, this, SLOT(choseColor() ) ); + new QShortcut(Qt::Key_F, this, SLOT( choseFont() ) ); mMenu->addSeparator(); mMenu->addMenu( ( new KHelpMenu( this, KGlobal::mainComponent().aboutData(), true ) )->menu() ); mMenu->addSeparator(); @@ -379,85 +379,82 @@ void KLineal::setTallLength() { void KLineal::setFullLength() { reLength(100); } - -void KLineal::chooseColor() -{ - QRect r = KGlobalSettings::desktopGeometry( this ); +void KLineal::choseColor() { + QRect r = KGlobalSettings::desktopGeometry(this); QPoint pos = QCursor::pos(); - if ( pos.x() + mColorSelector.width() > r.width() ) { - pos.setX( r.width() - mColorSelector.width() ); + if (pos.x() + mColorSelector.width() > r.width()) { + pos.setX(r.width() - mColorSelector.width()); } - if ( pos.y() + mColorSelector.height() > r.height() ) { - pos.setY( r.height() - mColorSelector.height() ); + if (pos.y() + mColorSelector.height() > r.height()) { + pos.setY(r.height() - mColorSelector.height()); } - mStoredColor = mColor; - mColorSelector.move( pos ); - mColorSelector.setColor( mColor ); + mColorSelector.move(pos); + mColorSelector.setColor(mColor); mColorSelector.setDefaultColor( DEFAULT_RULER_COLOR ); mColorSelector.show(); - connect( &mColorSelector, SIGNAL( closeClicked() ), - this, SLOT( setColor() ) ); - connect( &mColorSelector, SIGNAL( colorSelected( const QColor& ) ), - this, SLOT( setColor( const QColor& ) ) ); + connect(&mColorSelector, SIGNAL(closeClicked()), this, SLOT(setColor())); + connect(&mColorSelector, SIGNAL(colorSelected(const QColor&)), this, SLOT(setColor(const QColor&))); + /* + connect(&mColorSelector, SIGNAL(cancelPressed()), this, SLOT(restoreColor())); + connect(&mColorSelector, SIGNAL(okPressed()), this, SLOT(saveColor())); + */ } /** - * slot to choose a font - */ -void KLineal::chooseFont() -{ +* slot to choose a font +*/ +void KLineal::choseFont() { QFont font = mScaleFont; - int result = KFontDialog::getFont( font, false, this ); - if ( result == KFontDialog::Accepted ) { - setFont( font ); + int result = KFontDialog::getFont(font, false, this); + if (result == KFontDialog::Accepted) { + setFont(font); } } /** - * set the ruler color to the previously selected color - */ -void KLineal::setFont(const QFont &font) { - mScaleFont = font; - saveSettings(); +* set the ruler color to the previously selected color +*/ +void KLineal::setFont(QFont &font) { + mScaleFont = font; + saveSettings(); repaint(); } /** - * set the ruler color to the previously selected color - */ +* set the ruler color to the previously selected color +*/ void KLineal::setColor() { - setColor( mColorSelector.color() ); - saveSettings(); + setColor(mColorSelector.color()); + saveSettings(); } /** - * set the ruler color to some color - */ +* set the ruler color to some color +*/ void KLineal::setColor(const QColor &color) { mColor = color; - if ( !mColor.isValid() ) { + if ( !mColor.isValid() ) mColor = DEFAULT_RULER_COLOR; - } repaint(); } /** - * save the ruler color to the config file - */ +* save the ruler color to the config file +*/ void KLineal::saveSettings() { KSharedConfig::Ptr cfg = KGlobal::config(); // new KConfig(locateLocal("config", kapp->name()+"rc")); - if ( cfg ) { - QColor color = mColor; - KConfigGroup cfgcg( cfg, CFG_GROUP_SETTINGS ); - cfgcg.writeEntry( QString( CFG_KEY_BGCOLOR ), color ); - cfgcg.writeEntry( QString( CFG_KEY_SCALE_FONT ), mScaleFont ); - cfgcg.writeEntry( QString( CFG_KEY_LENGTH ), mLongEdgeLen ); - cfg->sync(); + if (cfg) { + QColor color = mColor; + KConfigGroup cfgcg(cfg, CFG_GROUP_SETTINGS); + cfgcg.writeEntry(QString(CFG_KEY_BGCOLOR), color); + cfgcg.writeEntry(QString(CFG_KEY_SCALE_FONT), mScaleFont); + cfgcg.writeEntry(QString(CFG_KEY_LENGTH), mLongEdgeLen); + cfg->sync(); } } diff --git a/klineal.h b/klineal.h index f754df4..b23bf81 100644 --- a/klineal.h +++ b/klineal.h @@ -27,32 +27,31 @@ class KMenu; class KLineal : public QWidget { Q_OBJECT - public: - enum { North = 0, West, South, East }; + enum { North=0, West=1, South=2, East=3 }; /** constructor */ - KLineal( QWidget *parent = 0 ); + KLineal(QWidget*parent=0); /** destructor */ ~KLineal(); - void move( int x, int y ); - void move( const QPoint &p ); + void move(int x, int y); + void move(const QPoint &p); QPoint pos(); int x(); int y(); - protected: - void keyPressEvent( QKeyEvent *e ); - void mousePressEvent( QMouseEvent *e ); - void mouseReleaseEvent( QMouseEvent *e ); - void mouseMoveEvent( QMouseEvent *e ); - void paintEvent( QPaintEvent *e ); - void enterEvent( QEvent *e ); - void leaveEvent( QEvent *e ); + void keyPressEvent(QKeyEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void paintEvent(QPaintEvent *e); + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); + private: - void drawScale( QPainter &painter ); - void drawBackground( QPainter &painter ); - void reLength( int percentOfScreen ); + void drawScale(QPainter &painter); + void drawBackground(QPainter &painter); + void reLength(int percentOfScreen); bool mDragging; QPoint mLastClickPos; QPoint mDragOffset; @@ -75,9 +74,8 @@ private: KColorDialog mColorSelector; QFont mScaleFont; bool _clicked; - public slots: - void setOrientation( int inOrientation ); + void setOrientation(int); void setNorth(); void setEast(); void setSouth(); @@ -93,13 +91,12 @@ public slots: void setTallLength(); void setFullLength(); void setColor(); - void setFont( const QFont &font ); - void setColor( const QColor &color ); - void chooseColor(); - void chooseFont(); + void setFont(QFont &); + void setColor(const QColor &color); + void choseColor(); + void choseFont(); void restoreColor(); void saveSettings(); void slotQuit(); }; - #endif diff --git a/main.cpp b/main.cpp index f4619e8..55de6c1 100644 --- a/main.cpp +++ b/main.cpp @@ -28,10 +28,9 @@ int main(int argc, char *argv[]) KDE_VERSION_STRING, ki18n("A screen ruler for the K Desktop Environment"), KAboutData::License_GPL, - ki18n( "(c) 2008, Mathias Soeken\n(c) 2000 - 2008, Till Krech" ) ); - aboutData.addAuthor( ki18n( "Mathias Soeken" ), ki18n( "Maintainer" ), "msoeken@informatik.uni-bremen.de" ); - aboutData.addAuthor( ki18n( "Till Krech" ), ki18n( "Former Maintainer/Developer"), "till@snafu.de" ); - aboutData.addCredit( ki18n( "Gunnstein Lye" ), ki18n( "Initial port to KDE 2" ), "gl@ez.no" ); + ki18n("(c) 2000, Till Krech")); + aboutData.addAuthor(ki18n("Till Krech"),ki18n("Programming"), "till@snafu.de"); + aboutData.addCredit(ki18n("Gunnstein Lye"),ki18n("Initial port to KDE 2"), "gl@ez.no"); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions options; -- GitLab