Commit db8ce006 authored by Mathias Soeken's avatar Mathias Soeken

revert my last change b/c we are in message freeze. I wonder why author names...

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
parent 21ed0371
...@@ -133,7 +133,7 @@ KLineal::KLineal( QWidget*parent ) ...@@ -133,7 +133,7 @@ KLineal::KLineal( QWidget*parent )
mMenu = new KMenu( this ); mMenu = new KMenu( this );
mMenu->addTitle( i18n( "KRuler" ) ); mMenu->addTitle( i18n( "KRuler" ) );
KMenu *oriMenu = new KMenu( i18n( "&Orientation" ), this ); KMenu *oriMenu = new KMenu( i18n( "&Orientation"), this );
oriMenu->addAction( KIcon( "kruler-north" ), oriMenu->addAction( KIcon( "kruler-north" ),
i18nc( "Turn Kruler North", "&North" ), i18nc( "Turn Kruler North", "&North" ),
this, SLOT( setNorth() ), Qt::Key_N ); this, SLOT( setNorth() ), Qt::Key_N );
...@@ -176,13 +176,13 @@ KLineal::KLineal( QWidget*parent ) ...@@ -176,13 +176,13 @@ KLineal::KLineal( QWidget*parent )
new QShortcut( Qt::CTRL + Qt::Key_F, this, SLOT( setFullLength() ) ); new QShortcut( Qt::CTRL + Qt::Key_F, this, SLOT( setFullLength() ) );
mMenu->addMenu( mLenMenu ); mMenu->addMenu( mLenMenu );
mMenu->addAction( KIcon( "preferences-desktop-color" ), mMenu->addAction( KIcon( "preferences-desktop-color" ),
i18n( "&Choose Color..." ), this, SLOT( chooseColor() ), i18n( "&Choose Color..." ), this, SLOT( choseColor() ),
Qt::CTRL + Qt::Key_C ); Qt::CTRL + Qt::Key_C );
mMenu->addAction( KIcon( "preferences-desktop-font" ), mMenu->addAction( KIcon( "preferences-desktop-font" ),
i18n( "Choose &Font..." ), this, SLOT( chooseFont() ), i18n( "Choose &Font..." ), this, SLOT( choseFont() ),
Qt::Key_F ); Qt::Key_F );
new QShortcut(Qt::CTRL + Qt::Key_C, this, SLOT(chooseColor() ) ); new QShortcut(Qt::CTRL + Qt::Key_C, this, SLOT(choseColor() ) );
new QShortcut(Qt::Key_F, this, SLOT( chooseFont() ) ); new QShortcut(Qt::Key_F, this, SLOT( choseFont() ) );
mMenu->addSeparator(); mMenu->addSeparator();
mMenu->addMenu( ( new KHelpMenu( this, KGlobal::mainComponent().aboutData(), true ) )->menu() ); mMenu->addMenu( ( new KHelpMenu( this, KGlobal::mainComponent().aboutData(), true ) )->menu() );
mMenu->addSeparator(); mMenu->addSeparator();
...@@ -379,85 +379,82 @@ void KLineal::setTallLength() { ...@@ -379,85 +379,82 @@ void KLineal::setTallLength() {
void KLineal::setFullLength() { void KLineal::setFullLength() {
reLength(100); reLength(100);
} }
void KLineal::choseColor() {
void KLineal::chooseColor() QRect r = KGlobalSettings::desktopGeometry(this);
{
QRect r = KGlobalSettings::desktopGeometry( this );
QPoint pos = QCursor::pos(); QPoint pos = QCursor::pos();
if ( pos.x() + mColorSelector.width() > r.width() ) { if (pos.x() + mColorSelector.width() > r.width()) {
pos.setX( r.width() - mColorSelector.width() ); pos.setX(r.width() - mColorSelector.width());
} }
if ( pos.y() + mColorSelector.height() > r.height() ) { if (pos.y() + mColorSelector.height() > r.height()) {
pos.setY( r.height() - mColorSelector.height() ); pos.setY(r.height() - mColorSelector.height());
} }
mStoredColor = mColor; mStoredColor = mColor;
mColorSelector.move( pos ); mColorSelector.move(pos);
mColorSelector.setColor( mColor ); mColorSelector.setColor(mColor);
mColorSelector.setDefaultColor( DEFAULT_RULER_COLOR ); mColorSelector.setDefaultColor( DEFAULT_RULER_COLOR );
mColorSelector.show(); mColorSelector.show();
connect( &mColorSelector, SIGNAL( closeClicked() ), connect(&mColorSelector, SIGNAL(closeClicked()), this, SLOT(setColor()));
this, SLOT( setColor() ) ); connect(&mColorSelector, SIGNAL(colorSelected(const QColor&)), this, SLOT(setColor(const QColor&)));
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 * slot to choose a font
*/ */
void KLineal::chooseFont() void KLineal::choseFont() {
{
QFont font = mScaleFont; QFont font = mScaleFont;
int result = KFontDialog::getFont( font, false, this ); int result = KFontDialog::getFont(font, false, this);
if ( result == KFontDialog::Accepted ) { if (result == KFontDialog::Accepted) {
setFont( font ); setFont(font);
} }
} }
/** /**
* set the ruler color to the previously selected color * set the ruler color to the previously selected color
*/ */
void KLineal::setFont(const QFont &font) { void KLineal::setFont(QFont &font) {
mScaleFont = font; mScaleFont = font;
saveSettings(); saveSettings();
repaint(); repaint();
} }
/** /**
* set the ruler color to the previously selected color * set the ruler color to the previously selected color
*/ */
void KLineal::setColor() { void KLineal::setColor() {
setColor( mColorSelector.color() ); setColor(mColorSelector.color());
saveSettings(); saveSettings();
} }
/** /**
* set the ruler color to some color * set the ruler color to some color
*/ */
void KLineal::setColor(const QColor &color) { void KLineal::setColor(const QColor &color) {
mColor = color; mColor = color;
if ( !mColor.isValid() ) { if ( !mColor.isValid() )
mColor = DEFAULT_RULER_COLOR; mColor = DEFAULT_RULER_COLOR;
}
repaint(); repaint();
} }
/** /**
* save the ruler color to the config file * save the ruler color to the config file
*/ */
void KLineal::saveSettings() { void KLineal::saveSettings() {
KSharedConfig::Ptr cfg = KGlobal::config(); // new KConfig(locateLocal("config", kapp->name()+"rc")); KSharedConfig::Ptr cfg = KGlobal::config(); // new KConfig(locateLocal("config", kapp->name()+"rc"));
if ( cfg ) { if (cfg) {
QColor color = mColor; QColor color = mColor;
KConfigGroup cfgcg( cfg, CFG_GROUP_SETTINGS ); KConfigGroup cfgcg(cfg, CFG_GROUP_SETTINGS);
cfgcg.writeEntry( QString( CFG_KEY_BGCOLOR ), color ); cfgcg.writeEntry(QString(CFG_KEY_BGCOLOR), color);
cfgcg.writeEntry( QString( CFG_KEY_SCALE_FONT ), mScaleFont ); cfgcg.writeEntry(QString(CFG_KEY_SCALE_FONT), mScaleFont);
cfgcg.writeEntry( QString( CFG_KEY_LENGTH ), mLongEdgeLen ); cfgcg.writeEntry(QString(CFG_KEY_LENGTH), mLongEdgeLen);
cfg->sync(); cfg->sync();
} }
} }
......
...@@ -27,32 +27,31 @@ class KMenu; ...@@ -27,32 +27,31 @@ class KMenu;
class KLineal : public QWidget { class KLineal : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
enum { North = 0, West, South, East }; enum { North=0, West=1, South=2, East=3 };
/** constructor */ /** constructor */
KLineal( QWidget *parent = 0 ); KLineal(QWidget*parent=0);
/** destructor */ /** destructor */
~KLineal(); ~KLineal();
void move( int x, int y ); void move(int x, int y);
void move( const QPoint &p ); void move(const QPoint &p);
QPoint pos(); QPoint pos();
int x(); int x();
int y(); int y();
protected: protected:
void keyPressEvent( QKeyEvent *e ); void keyPressEvent(QKeyEvent *e);
void mousePressEvent( QMouseEvent *e ); void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent( QMouseEvent *e ); void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent( QMouseEvent *e ); void mouseMoveEvent(QMouseEvent *e);
void paintEvent( QPaintEvent *e ); void paintEvent(QPaintEvent *e);
void enterEvent( QEvent *e ); void enterEvent(QEvent *e);
void leaveEvent( QEvent *e ); void leaveEvent(QEvent *e);
private: private:
void drawScale( QPainter &painter ); void drawScale(QPainter &painter);
void drawBackground( QPainter &painter ); void drawBackground(QPainter &painter);
void reLength( int percentOfScreen ); void reLength(int percentOfScreen);
bool mDragging; bool mDragging;
QPoint mLastClickPos; QPoint mLastClickPos;
QPoint mDragOffset; QPoint mDragOffset;
...@@ -75,9 +74,8 @@ private: ...@@ -75,9 +74,8 @@ private:
KColorDialog mColorSelector; KColorDialog mColorSelector;
QFont mScaleFont; QFont mScaleFont;
bool _clicked; bool _clicked;
public slots: public slots:
void setOrientation( int inOrientation ); void setOrientation(int);
void setNorth(); void setNorth();
void setEast(); void setEast();
void setSouth(); void setSouth();
...@@ -93,13 +91,12 @@ public slots: ...@@ -93,13 +91,12 @@ public slots:
void setTallLength(); void setTallLength();
void setFullLength(); void setFullLength();
void setColor(); void setColor();
void setFont( const QFont &font ); void setFont(QFont &);
void setColor( const QColor &color ); void setColor(const QColor &color);
void chooseColor(); void choseColor();
void chooseFont(); void choseFont();
void restoreColor(); void restoreColor();
void saveSettings(); void saveSettings();
void slotQuit(); void slotQuit();
}; };
#endif #endif
...@@ -28,10 +28,9 @@ int main(int argc, char *argv[]) ...@@ -28,10 +28,9 @@ int main(int argc, char *argv[])
KDE_VERSION_STRING, KDE_VERSION_STRING,
ki18n("A screen ruler for the K Desktop Environment"), ki18n("A screen ruler for the K Desktop Environment"),
KAboutData::License_GPL, KAboutData::License_GPL,
ki18n( "(c) 2008, Mathias Soeken\n(c) 2000 - 2008, Till Krech" ) ); ki18n("(c) 2000, Till Krech"));
aboutData.addAuthor( ki18n( "Mathias Soeken" ), ki18n( "Maintainer" ), "msoeken@informatik.uni-bremen.de" ); aboutData.addAuthor(ki18n("Till Krech"),ki18n("Programming"), "till@snafu.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");
aboutData.addCredit( ki18n( "Gunnstein Lye" ), ki18n( "Initial port to KDE 2" ), "gl@ez.no" );
KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options; KCmdLineOptions options;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment