Commit fc32dd44 authored by Aurélien Gâteau's avatar Aurélien Gâteau

Remove color picker

parent 9abd51b5
...@@ -102,7 +102,7 @@ KLineal::KLineal( QWidget *parent ) ...@@ -102,7 +102,7 @@ KLineal::KLineal( QWidget *parent )
setMinimumSize( 60, 60 ); setMinimumSize( 60, 60 );
setMaximumSize( 8000, 8000 ); setMaximumSize( 8000, 8000 );
setWhatsThis( i18n( "This is a tool to measure pixel distances and colors on the screen. " setWhatsThis( i18n( "This is a tool to measure pixel distances on the screen. "
"It is useful for working on layouts of dialogs, web pages etc." ) ); "It is useful for working on layouts of dialogs, web pages etc." ) );
setMouseTracking( true ); setMouseTracking( true );
...@@ -130,15 +130,6 @@ KLineal::KLineal( QWidget *parent ) ...@@ -130,15 +130,6 @@ KLineal::KLineal( QWidget *parent )
mLabel = new QAutoSizeLabel( this ); mLabel = new QAutoSizeLabel( this );
mLabel->setGeometry( 0, height() - 12, 32, 12 ); mLabel->setGeometry( 0, height() - 12, 32, 12 );
mLabel->setWhatsThis( i18n( "This is the current distance measured in pixels." ) ); mLabel->setWhatsThis( i18n( "This is the current distance measured in pixels." ) );
mColorLabel = new QAutoSizeLabel( this );
mColorLabel->setAutoFillBackground( true );
QFont colorFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mColorLabel->setFont( colorFont );
mColorLabel->move( mLabel->pos() + QPoint(0, 20) );
mColorLabel->setWhatsThis(i18n("This is the current color in hexadecimal rgb representation"
" as you may use it in HTML or as a QColor name. "
"The rectangles background shows the color of the pixel inside the "
"little square at the end of the line cursor." ) );
mBtnRotateLeft = new QToolButton( this ); mBtnRotateLeft = new QToolButton( this );
mBtnRotateLeft->setIcon( QIcon::fromTheme( QStringLiteral( "object-rotate-left" ) ) ); mBtnRotateLeft->setIcon( QIcon::fromTheme( QStringLiteral( "object-rotate-left" ) ) );
...@@ -223,10 +214,6 @@ KLineal::KLineal( QWidget *parent ) ...@@ -223,10 +214,6 @@ KLineal::KLineal( QWidget *parent )
QAction *preferences = mActionCollection->addAction( KStandardAction::Preferences, this, SLOT(slotPreferences()) ); QAction *preferences = mActionCollection->addAction( KStandardAction::Preferences, this, SLOT(slotPreferences()) );
mMenu->addAction( preferences ); mMenu->addAction( preferences );
mMenu->addSeparator(); mMenu->addSeparator();
QAction *copyColorAction = mActionCollection->addAction( KStandardAction::Copy, this, SLOT(copyColor()) );
copyColorAction->setText( i18n( "Copy Color" ) );
mMenu->addAction( copyColorAction );
mMenu->addSeparator();
mMenu->addMenu( ( new KHelpMenu( this, KAboutData::applicationData(), true ) )->menu() ); mMenu->addMenu( ( new KHelpMenu( this, KAboutData::applicationData(), true ) )->menu() );
mMenu->addSeparator(); mMenu->addSeparator();
if ( RulerSettings::self()->trayIcon() ) { if ( RulerSettings::self()->trayIcon() ) {
...@@ -410,25 +397,21 @@ void KLineal::setOrientation( int inOrientation ) ...@@ -410,25 +397,21 @@ void KLineal::setOrientation( int inOrientation )
switch( mOrientation ) { switch( mOrientation ) {
case North: case North:
mLabel->move( 4, height()-mLabel->height() - 4 ); mLabel->move( 4, height()-mLabel->height() - 4 );
mColorLabel->move( mLabel->pos() + QPoint( 0, -20 ) );
mCurrentCursor = mNorthCursor; mCurrentCursor = mNorthCursor;
break; break;
case South: case South:
mLabel->move( 4, 4 ); mLabel->move( 4, 4 );
mColorLabel->move( mLabel->pos() + QPoint( 0, 20 ) );
mCurrentCursor = mSouthCursor; mCurrentCursor = mSouthCursor;
break; break;
case East: case East:
mLabel->move( 4, 4 ); mLabel->move( 4, 4 );
mColorLabel->move( mLabel->pos() + QPoint( 0, 20 ) );
mCurrentCursor = mEastCursor; mCurrentCursor = mEastCursor;
break; break;
case West: case West:
mLabel->move( width()-mLabel->width() - 4, 4 ); mLabel->move( width()-mLabel->width() - 4, 4 );
mColorLabel->move( mLabel->pos() + QPoint( -5, 20 ) );
mCurrentCursor = mWestCursor; mCurrentCursor = mWestCursor;
break; break;
} }
...@@ -705,11 +688,6 @@ void KLineal::saveSettings() ...@@ -705,11 +688,6 @@ void KLineal::saveSettings()
RulerSettings::self()->save(); RulerSettings::self()->save();
} }
void KLineal::copyColor()
{
QApplication::clipboard()->setText( mColorLabel->text() );
}
/** /**
* lets the context menu appear at current cursor position * lets the context menu appear at current cursor position
*/ */
...@@ -750,7 +728,6 @@ void KLineal::showLabel() ...@@ -750,7 +728,6 @@ void KLineal::showLabel()
{ {
adjustLabel(); adjustLabel();
mLabel->show(); mLabel->show();
mColorLabel->show();
if ( RulerSettings::self()->rotateButtonsVisible() ) { if ( RulerSettings::self()->rotateButtonsVisible() ) {
mBtnRotateLeft->show(); mBtnRotateLeft->show();
mBtnRotateRight->show(); mBtnRotateRight->show();
...@@ -768,7 +745,6 @@ void KLineal::showLabel() ...@@ -768,7 +745,6 @@ void KLineal::showLabel()
void KLineal::hideLabel() void KLineal::hideLabel()
{ {
mLabel->hide(); mLabel->hide();
mColorLabel->hide();
mBtnRotateLeft->hide(); mBtnRotateLeft->hide();
mBtnRotateRight->hide(); mBtnRotateRight->hide();
if ( mCloseButton ) { if ( mCloseButton ) {
...@@ -920,20 +896,6 @@ void KLineal::mouseMoveEvent( QMouseEvent *inEvent ) ...@@ -920,20 +896,6 @@ void KLineal::mouseMoveEvent( QMouseEvent *inEvent )
break; break;
} }
QColor color = pixelColor( p );
int h, s, v;
color.getHsv( &h, &s, &v );
mColorLabel->setText( color.name().toUpper() );
QPalette palette = mColorLabel->palette();
palette.setColor( mColorLabel->backgroundRole(), color );
if ( v < 255 / 2 ) {
v = 255;
} else {
v = 0;
}
color.setHsv( h, s, v );
palette.setColor( mColorLabel->foregroundRole(), color );
mColorLabel->setPalette( palette );
adjustLabel(); adjustLabel();
} }
} }
...@@ -1162,12 +1124,3 @@ void KLineal::paintEvent(QPaintEvent *inEvent ) ...@@ -1162,12 +1124,3 @@ void KLineal::paintEvent(QPaintEvent *inEvent )
drawBackground( painter ); drawBackground( painter );
drawScale( painter ); drawScale( painter );
} }
QColor KLineal::pixelColor(const QPoint &p)
{
const QDesktopWidget *desktop = QApplication::desktop();
QScreen *screen = QGuiApplication::screens().at(desktop->screenNumber());
const QPixmap pixmap = screen->grabWindow(desktop->winId(), p.x(), p.y(), 1, 1);
return QColor(pixmap.toImage().pixel(QPoint(0, 0)));
}
...@@ -67,13 +67,11 @@ private: ...@@ -67,13 +67,11 @@ private:
void reLength( int percentOfScreen ); void reLength( int percentOfScreen );
void reLengthAbsolute( int length ); void reLengthAbsolute( int length );
void updateScaleDirectionMenuItem(); void updateScaleDirectionMenuItem();
QColor pixelColor( const QPoint &p );
bool mDragging; bool mDragging;
QPoint mLastClickPos; QPoint mLastClickPos;
QPoint mDragOffset; QPoint mDragOffset;
QAutoSizeLabel *mLabel; QAutoSizeLabel *mLabel;
QAutoSizeLabel *mColorLabel;
int mOrientation; int mOrientation;
int mLongEdgeLen; int mLongEdgeLen;
int mShortEdgeLen; int mShortEdgeLen;
...@@ -128,7 +126,6 @@ public slots: ...@@ -128,7 +126,6 @@ public slots:
void slotKeyBindings(); void slotKeyBindings();
void slotPreferences(); void slotPreferences();
void switchRelativeScale( bool checked ); void switchRelativeScale( bool checked );
void copyColor();
void saveSettings(); void saveSettings();
void slotClose(); void slotClose();
void slotQuit(); void slotQuit();
......
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