Commit 246ac1f8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 84f85ab4
......@@ -99,7 +99,7 @@ int main(int argc, char **argv)
KGlobalAccel::self()->setDefaultShortcut(openAction, {Qt::Key_Print});
QAction* fullScreenAction = shortCutActions.action(QStringLiteral("FullScreenScreenShot"));
KGlobalAccel::self()->setDefaultShortcut(fullScreenAction, {Qt::SHIFT + Qt::Key_Print});
QAction* currentScreenAction = shortCutActions.action(QStringLiteral("CurrentMonitorScreenShot"));
//QAction* currentScreenAction = shortCutActions.action(QStringLiteral("CurrentMonitorScreenShot"));
QAction* activeWindowAction = shortCutActions.action(QStringLiteral("ActiveWindowScreenShot"));
KGlobalAccel::self()->setDefaultShortcut(activeWindowAction, {Qt::META + Qt::Key_Print});
QAction* regionAction = shortCutActions.action(QStringLiteral("RectangularRegionScreenShot"));
......
......@@ -90,7 +90,7 @@ Spectacle::CaptureMode ExportManager::captureMode() const
return mCaptureMode;
}
void ExportManager::setCaptureMode(const Spectacle::CaptureMode &theCaptureMode)
void ExportManager::setCaptureMode(Spectacle::CaptureMode theCaptureMode)
{
mCaptureMode = theCaptureMode;
}
......
......@@ -64,7 +64,7 @@ class ExportManager: public QObject
void setTimestamp(const QDateTime &timestamp);
QString windowTitle() const;
Spectacle::CaptureMode captureMode() const;
void setCaptureMode(const Spectacle::CaptureMode &theCaptureMode);
void setCaptureMode(Spectacle::CaptureMode theCaptureMode);
QString formatFilename(const QString &nameTemplate);
static const QMap<QString, KLocalizedString> filenamePlaceholders;
......
......@@ -62,7 +62,7 @@ static const int DEFAULT_WINDOW_HEIGHT = 420;
static const int DEFAULT_WINDOW_WIDTH = 840;
static const int MAXIMUM_WINDOW_WIDTH = 1000;
KSMainWindow::KSMainWindow(const Platform::GrabModes &theGrabModes, const Platform::ShutterModes &theShutterModes, QWidget *parent) :
KSMainWindow::KSMainWindow(Platform::GrabModes theGrabModes, Platform::ShutterModes theShutterModes, QWidget *parent) :
QDialog(parent),
mKSWidget(new KSWidget(theGrabModes, this)),
mDivider(new QFrame(this)),
......
......@@ -44,7 +44,7 @@ class KSMainWindow: public QDialog
public:
explicit KSMainWindow(const Platform::GrabModes &theGrabModes, const Platform::ShutterModes &theShutterModes, QWidget *parent = nullptr);
explicit KSMainWindow(Platform::GrabModes theGrabModes, Platform::ShutterModes theShutterModes, QWidget *parent = nullptr);
virtual ~KSMainWindow() = default;
enum class MessageDuration {
......@@ -63,6 +63,7 @@ class KSMainWindow: public QDialog
const KMessageWidget::MessageType messageType,
const MessageDuration messageDuration = MessageDuration::AutoHide,
const QList<QAction*>& actions = {});
int windowWidth(const QPixmap &pixmap) const;
private Q_SLOTS:
......@@ -76,7 +77,6 @@ class KSMainWindow: public QDialog
void setDefaultSaveAction();
void save();
void saveAs();
int windowWidth(const QPixmap &pixmap) const;
void restoreWindowTitle();
public Q_SLOTS:
......
......@@ -39,7 +39,7 @@
#include <KConfigDialogManager>
#include <KLocalizedString>
KSWidget::KSWidget(const Platform::GrabModes &theGrabModes, QWidget *parent)
KSWidget::KSWidget(Platform::GrabModes theGrabModes, QWidget *parent)
: QWidget(parent)
{
// we'll init the widget that holds the image first
......
......@@ -48,7 +48,7 @@ class KSWidget : public QWidget
public:
explicit KSWidget(const Platform::GrabModes &theGrabModes, QWidget *parent = nullptr);
explicit KSWidget(Platform::GrabModes theGrabModes, QWidget *parent = nullptr);
virtual ~KSWidget() = default;
......@@ -70,7 +70,7 @@ class KSWidget : public QWidget
void setScreenshotPixmap(const QPixmap &thePixmap);
void lockOnClickDisabled();
void lockOnClickEnabled();
void setButtonState(State state);
void setButtonState(KSWidget::State state);
void setProgress(double progress);
private Q_SLOTS:
......
......@@ -25,7 +25,6 @@
ProgressButton::ProgressButton(QWidget* parent)
: QToolButton{parent}
, mProgress(0)
{
}
......
......@@ -26,16 +26,17 @@
*/
class ProgressButton : public QToolButton
{
Q_OBJECT
public:
ProgressButton(QWidget* parent);
explicit ProgressButton(QWidget* parent);
void setProgress(double progress);
protected:
void paintEvent(QPaintEvent* event) override;
double mProgress;
double mProgress = 0.0;
};
#endif // PROGRESSBUTTON_H
......@@ -104,16 +104,21 @@ void PlatformKWinWayland::doGrab(ShutterMode theShutterMode, GrabMode theGrabMod
}
switch(theGrabMode) {
case GrabMode::AllScreens:
return doGrabHelper(QStringLiteral("screenshotFullscreen"), theIncludePointer);
case GrabMode::CurrentScreen:
return doGrabHelper(QStringLiteral("screenshotScreen"), theIncludePointer);
case GrabMode::AllScreens: {
doGrabHelper(QStringLiteral("screenshotFullscreen"), theIncludePointer);
return;
}
case GrabMode::CurrentScreen: {
doGrabHelper(QStringLiteral("screenshotScreen"), theIncludePointer);
return;
}
case GrabMode::WindowUnderCursor: {
int lOpMask = theIncludeDecorations ? 1 : 0;
if (theIncludePointer) {
lOpMask |= 1 << 1;
}
return doGrabHelper(QStringLiteral("interactive"), lOpMask);
doGrabHelper(QStringLiteral("interactive"), lOpMask);
return;
}
case GrabMode::InvalidChoice:
case GrabMode::ActiveWindow:
......
......@@ -82,7 +82,7 @@ class PlatformXcb::OnClickEventFilter: public QAbstractNativeEventFilter
mPlatformPtr(thePlatformPtr)
{}
void setCaptureOptions(const Platform::GrabMode &theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
void setCaptureOptions(Platform::GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
{
mGrabMode = theGrabMode;
mIncludePointer = theIncludePointer;
......@@ -166,10 +166,14 @@ Platform::ShutterModes PlatformXcb::supportedShutterModes() const
void PlatformXcb::doGrab(ShutterMode theShutterMode, GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
{
switch(theShutterMode) {
case ShutterMode::Immediate:
return doGrabNow(theGrabMode, theIncludePointer, theIncludeDecorations);
case ShutterMode::OnClick:
return doGrabOnClick(theGrabMode, theIncludePointer, theIncludeDecorations);
case ShutterMode::Immediate: {
doGrabNow(theGrabMode, theIncludePointer, theIncludeDecorations);
return;
}
case ShutterMode::OnClick: {
doGrabOnClick(theGrabMode, theIncludePointer, theIncludeDecorations);
return;
}
}
}
......@@ -681,7 +685,7 @@ void PlatformXcb::grabTransientWithParent(bool theIncludePointer, bool theInclud
emit newScreenshotTaken(lPixmap);
}
void PlatformXcb::doGrabNow(const GrabMode &theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
void PlatformXcb::doGrabNow(GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
{
switch(theGrabMode) {
case GrabMode::AllScreens:
......@@ -704,7 +708,7 @@ void PlatformXcb::doGrabNow(const GrabMode &theGrabMode, bool theIncludePointer,
}
}
void PlatformXcb::doGrabOnClick(const GrabMode &theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
void PlatformXcb::doGrabOnClick(GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations)
{
// get the cursor image
xcb_cursor_t lXcbCursor = XCB_CURSOR_NONE;
......
......@@ -48,8 +48,8 @@ class PlatformXcb final: public Platform
private Q_SLOTS:
void handleKWinScreenshotReply(quint64 theDrawable);
void doGrabNow(const Platform::GrabMode &theGrabMode, bool theIncludePointer, bool theIncludeDecorations);
void doGrabOnClick(const Platform::GrabMode &theGrabMode, bool theIncludePointer, bool theIncludeDecorations);
void doGrabNow(Platform::GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations);
void doGrabOnClick(Platform::GrabMode theGrabMode, bool theIncludePointer, bool theIncludeDecorations);
private:
......
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