Commit 745e2fb7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use std::chrono_literals + Q_EMIT

parent 4132828c
......@@ -53,7 +53,8 @@ add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory( doc )
add_subdirectory( pics )
add_subdirectory( src )
......
......@@ -349,19 +349,19 @@ void KmagApp::readOptions()
// set zoom - defaults to 2x
unsigned int zoomIndex = cg.readEntry("ZoomIndex", 4);
setZoomIndex(zoomIndex);
emit updateZoomIndex(m_zoomIndex);
Q_EMIT updateZoomIndex(m_zoomIndex);
unsigned int rotationIndex = cg.readEntry("RotationIndex", 0);
setRotationIndex(rotationIndex);
emit updateRotationIndex(m_rotationIndex);
Q_EMIT updateRotationIndex(m_rotationIndex);
unsigned int fpsIndex = cg.readEntry("FPSIndex", 2);
setFPSIndex(fpsIndex);
emit updateFPSIndex(m_fpsIndex);
Q_EMIT updateFPSIndex(m_fpsIndex);
unsigned int colorIndex = cg.readEntry("ColorIndex", 0);
setColorIndex(colorIndex);
emit updateColorIndex(colorIndex);
Q_EMIT updateColorIndex(colorIndex);
QString mode = cg.readEntry("Mode", "followmouse");
if (mode == QLatin1String( "wholescreen" )) {
......@@ -438,7 +438,7 @@ void KmagApp::zoomIn()
// set the new index .. checking will done inside setZoom
setZoomIndex(m_zoomIndex+1);
// signal change in zoom index
emit updateZoomIndex((int)m_zoomIndex);
Q_EMIT updateZoomIndex((int)m_zoomIndex);
}
/**
......@@ -449,7 +449,7 @@ void KmagApp::zoomOut()
// set the new index .. checking will done inside setZoom
setZoomIndex(m_zoomIndex-1);
// signal change in zoom index
emit updateZoomIndex((int)m_zoomIndex);
Q_EMIT updateZoomIndex((int)m_zoomIndex);
}
/**
* Sets the zoom index to index
......@@ -484,7 +484,7 @@ void KmagApp::setZoomIndex(int index)
}
// signal change in zoom value
emit updateZoomValue(zoomArray.at(m_zoomIndex));
Q_EMIT updateZoomValue(zoomArray.at(m_zoomIndex));
}
/**
......@@ -504,7 +504,7 @@ void KmagApp::setRotationIndex(int index)
}
// signal change in zoom value
emit updateRotationValue(rotationArray.at(m_rotationIndex));
Q_EMIT updateRotationValue(rotationArray.at(m_rotationIndex));
}
/**
......@@ -524,7 +524,7 @@ void KmagApp::setFPSIndex(int index)
}
// signal change in fps value
emit updateFPSValue(fpsArray.at(m_fpsIndex));
Q_EMIT updateFPSValue(fpsArray.at(m_fpsIndex));
}
/**
......@@ -544,7 +544,7 @@ void KmagApp::setColorIndex(int index)
}
// signal change in fps value
emit updateColorValue(colorArray.at(m_colorIndex));
Q_EMIT updateColorValue(colorArray.at(m_colorIndex));
}
/**
......
......@@ -133,7 +133,7 @@ KMagSelRect::~KMagSelRect()
//
//--------------------------------------------------------------------------
bool KMagSelRect::visible()
bool KMagSelRect::visible() const
{
return (selectionwindow != nullptr);
}
......@@ -174,15 +174,15 @@ void KMagSelRect::hide()
void KMagSelRect::update()
{
if (selectionwindow != nullptr)
if (selectionwindow)
selectionwindow->setSelRect (QRect (topLeft(), bottomRight()));
}
void KMagSelRect::selWinResized()
{
if (selectionwindow != nullptr)
if (selectionwindow)
{
QRect newRect = selectionwindow->getSelRect();
const QRect newRect = selectionwindow->getSelRect();
setRect (newRect.x(), newRect.y(), newRect.width(), newRect.height());
}
}
......@@ -314,31 +314,31 @@ void KMagSelWin::titleMoved (const QPoint &offset)
QRect selRect = oldSelRect;
selRect.translate (offset.x(), offset.y());
setSelRect (selRect);
emit resized ();
Q_EMIT resized ();
}
void KMagSelWin::topLeftResized (const QPoint &offset)
{
setSelRect (QRect(oldSelRect.topLeft() + offset, oldSelRect.bottomRight ()));
emit resized();
Q_EMIT resized();
}
void KMagSelWin::topRightResized (const QPoint &offset)
{
setSelRect (QRect(oldSelRect.topRight() + offset, oldSelRect.bottomLeft ()));
emit resized();
Q_EMIT resized();
}
void KMagSelWin::bottomLeftResized (const QPoint &offset)
{
setSelRect (QRect(oldSelRect.bottomLeft() + offset, oldSelRect.topRight ()));
emit resized();
Q_EMIT resized();
}
void KMagSelWin::bottomRightResized (const QPoint &offset)
{
setSelRect (QRect(oldSelRect.bottomRight() + offset, oldSelRect.topLeft()));
emit resized();
Q_EMIT resized();
}
......@@ -360,16 +360,16 @@ KMagSelWinCorner::~KMagSelWinCorner()
void KMagSelWinCorner::mousePressEvent ( QMouseEvent * e )
{
oldPos = e->globalPos ();
emit startResizing ();
Q_EMIT startResizing ();
}
void KMagSelWinCorner::mouseReleaseEvent ( QMouseEvent * e )
{
setFrameShadow (QFrame::Raised);
emit resized (e->globalPos () - oldPos);
Q_EMIT resized (e->globalPos () - oldPos);
}
void KMagSelWinCorner::mouseMoveEvent ( QMouseEvent * e )
{
emit resized (e->globalPos () - oldPos);
Q_EMIT resized (e->globalPos () - oldPos);
}
......@@ -109,7 +109,7 @@ public:
virtual ~KMagSelRect();
bool visible();
bool visible() const;
/// Makes the rectangle always visible
void alwaysVisible(bool visible=true);
......
......@@ -36,6 +36,9 @@
// include files for KF5
#include <KLocalizedString>
#include <chrono>
using namespace std::chrono_literals;
#ifdef QAccessibilityClient_FOUND
#include <qaccessibilityclient/accessibleobject.h>
......@@ -118,7 +121,7 @@ KMagZoomView::KMagZoomView(QWidget *parent, const char *name)
// connect it to updateMouseView()
connect(&m_mouseViewTimer, &QTimer::timeout, this, &KMagZoomView::updateMouseView);
// start the grabTimer @ 25 frames per second!
m_mouseViewTimer.start(40);
m_mouseViewTimer.start(40ms);
this->setWhatsThis( i18n("This is the main window which shows the contents of the\
selected region. The contents will be magnified according to the zoom level that is set."));
......
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