diff --git a/src/core/operationrunner.h b/src/core/operationrunner.h index f91468d..d22dfe2 100644 --- a/src/core/operationrunner.h +++ b/src/core/operationrunner.h @@ -1,95 +1,95 @@ /************************************************************************* * Copyright (C) 2008 by Volker Lanz * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 3 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see .* *************************************************************************/ #if !defined(KPMCORE_OPERATIONRUNNER_H) #define KPMCORE_OPERATIONRUNNER_H #include "util/libpartitionmanagerexport.h" #include #include #include class Operation; class OperationStack; class Report; /** Thread to run the Operations in the OperationStack. Runs the OperationStack when the user applies operations. @author Volker Lanz */ class LIBKPMCORE_EXPORT OperationRunner : public QThread { Q_OBJECT Q_DISABLE_COPY(OperationRunner) public: OperationRunner(QObject* parent, OperationStack& ostack); public: - void run(); + void run() override; qint32 numJobs() const; qint32 numOperations() const; qint32 numProgressSub() const; bool isCancelling() const { return m_Cancelling; /**< @return if the user has requested cancelling */ } void cancel() const { m_Cancelling = true; /**< Sets cancelling to true. */ } QMutex& suspendMutex() const { return m_SuspendMutex; /**< @return the QMutex used for syncing */ } QString description(qint32 op) const; void setReport(Report* report) { m_Report = report; /**< @param report the Report to use while running */ } Q_SIGNALS: void progressSub(int); void opStarted(int, Operation*); void opFinished(int, Operation*); void finished(); void cancelled(); void error(); protected: OperationStack& operationStack() { return m_OperationStack; } const OperationStack& operationStack() const { return m_OperationStack; } void setCancelling(bool b) { m_Cancelling = b; } Report& report() { Q_ASSERT(m_Report); return *m_Report; } private: OperationStack& m_OperationStack; Report* m_Report; mutable QMutex m_SuspendMutex; mutable volatile bool m_Cancelling; }; #endif diff --git a/src/gui/partresizerwidget.h b/src/gui/partresizerwidget.h index 7265ae6..929223b 100644 --- a/src/gui/partresizerwidget.h +++ b/src/gui/partresizerwidget.h @@ -1,215 +1,215 @@ /************************************************************************* * Copyright (C) 2008, 2010 by Volker Lanz * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 3 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see .* *************************************************************************/ #if !defined(KPMCORE_PARTRESIZERWIDGET_H) #define KPMCORE_PARTRESIZERWIDGET_H #include "util/libpartitionmanagerexport.h" #include #include class Partition; class PartWidget; class Device; class NewDialog; class QPaintEvent; class QResizeEvent; class QMouseEvent; /** Widget that allows the user to resize a Partition. @author Volker Lanz */ class LIBKPMCORE_EXPORT PartResizerWidget : public QWidget { friend class NewDialog; Q_OBJECT Q_DISABLE_COPY(PartResizerWidget) public: PartResizerWidget(QWidget* parent); public: void init(Device& d, Partition& p, qint64 minFirst, qint64 maxLast, bool read_only = false, bool move_allowed = true); qint64 totalSectors() const { return maximumLastSector() - minimumFirstSector() + 1; /**< @return total sectors (free + Partition's length) */ } qint64 minimumFirstSector(bool aligned = false) const; /**< @return the lowest allowed first sector */ void setMinimumFirstSector(qint64 s) { m_MinimumFirstSector = s; /**< @param s the new lowest allowed first sector */ } qint64 maximumFirstSector(bool aligned = false) const; /**< @return the highest allowed first sector */ void setMaximumFirstSector(qint64 s) { m_MaximumFirstSector = s; /**< @param s the new highest allowed first sector */ } qint64 minimumLastSector(bool aligned = false) const; /**< @return the lowest allowed last sector */ void setMinimumLastSector(qint64 s) { m_MinimumLastSector = s; /**< @param s the new lowest allowed last sector */ } qint64 maximumLastSector(bool aligned = false) const; /**< @return the highest allowed last sector */ void setMaximumLastSector(qint64 s) { m_MaximumLastSector = s; /**< @param s the new highest allowed last sector */ } void setMinimumLength(qint64 s); qint64 minimumLength() const { return m_MinimumLength; /**< @return minimum length for Partition */ } void setMaximumLength(qint64 s); qint64 maximumLength() const { return m_MaximumLength; /**< @return maximum length for the Partition */ } void setMoveAllowed(bool b); bool moveAllowed() const { return m_MoveAllowed; /**< @return true if moving the Partition is allowed */ } bool readOnly() const { return m_ReadOnly; /**< @return true if the widget is read only */ } void setReadOnly(bool b) { m_ReadOnly = b; /**< @param b the new value for read only */ } bool align() const { return m_Align; /**< @return true if the Partition is to be aligned */ } void setAlign(bool b) { m_Align = b; /**< @param b the new value for aligning the Partition */ } qint32 handleWidth() const; /**< @return the handle width in pixels */ static qint32 handleHeight() { return m_HandleHeight; /**< @return the handle height in pixels */ } Q_SIGNALS: void firstSectorChanged(qint64); void lastSectorChanged(qint64); public: bool updateFirstSector(qint64 newFirstSector); bool updateLastSector(qint64 newLastSector); bool movePartition(qint64 newFirstSector); protected: Partition& partition() { Q_ASSERT(m_Partition); return *m_Partition; } const Partition& partition() const { Q_ASSERT(m_Partition); return *m_Partition; } void setPartition(Partition& p) { m_Partition = &p; } Device& device() { Q_ASSERT(m_Device); return *m_Device; } const Device& device() const { Q_ASSERT(m_Device); return *m_Device; } void setDevice(Device& d) { m_Device = &d; } - void paintEvent(QPaintEvent* event); - void resizeEvent(QResizeEvent* event); - void mousePressEvent(QMouseEvent* event); - void mouseMoveEvent(QMouseEvent* event); - void mouseReleaseEvent(QMouseEvent* event); + void paintEvent(QPaintEvent* event) override; + void resizeEvent(QResizeEvent* event) override; + void mousePressEvent(QMouseEvent* event) override; + void mouseMoveEvent(QMouseEvent* event) override; + void mouseReleaseEvent(QMouseEvent* event) override; PartWidget& partWidget() { Q_ASSERT(m_PartWidget); return *m_PartWidget; } const PartWidget& partWidget() const { Q_ASSERT(m_PartWidget); return *m_PartWidget; } void updatePositions(); int partWidgetStart() const; int partWidgetWidth() const; QLabel& leftHandle() { return m_LeftHandle; } QLabel& rightHandle() { return m_RightHandle; } long double sectorsPerPixel() const; void set(qint64 newCap, qint64 newFreeBefore, qint64 newFreeAfter); void resizeLogicals(qint64 deltaFirst, qint64 deltaLast, bool force = false); bool checkAlignment(const Partition& child, qint64 delta) const; QWidget* draggedWidget() { return m_DraggedWidget; } const QWidget* draggedWidget() const { return m_DraggedWidget; } bool checkConstraints(qint64 first, qint64 last) const; private: Device* m_Device; Partition* m_Partition; PartWidget* m_PartWidget; qint64 m_MinimumFirstSector; qint64 m_MaximumFirstSector; qint64 m_MinimumLastSector; qint64 m_MaximumLastSector; qint64 m_MinimumLength; qint64 m_MaximumLength; QLabel m_LeftHandle; QLabel m_RightHandle; QWidget* m_DraggedWidget; int m_Hotspot; bool m_MoveAllowed; bool m_ReadOnly; bool m_Align; static const qint32 m_HandleHeight; }; #endif diff --git a/src/gui/partwidget.h b/src/gui/partwidget.h index 8275483..dde4500 100644 --- a/src/gui/partwidget.h +++ b/src/gui/partwidget.h @@ -1,81 +1,81 @@ /************************************************************************* * Copyright (C) 2008, 2010 by Volker Lanz * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 3 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see .* *************************************************************************/ #if !defined(KPMCORE_PARTWIDGET_H) #define KPMCORE_PARTWIDGET_H #include "util/libpartitionmanagerexport.h" #include "fs/filesystem.h" #include "partwidgetbase.h" #include class Partition; class QPaintEvent; class QResizeEvent; /** Widget that represents a Partition. Represents a single Partition (possibly with its children, in case of an extended Partition) in the GUI. @author Volker Lanz */ class LIBKPMCORE_EXPORT PartWidget : public PartWidgetBase { Q_OBJECT public: explicit PartWidget(QWidget* parent, Partition* p = nullptr); void init(Partition* p); void setActive(bool b) { m_Active = b; } bool isActive() const { return m_Active; /**< @return true if this is the currently active widget */ } void updateChildren(); Partition* partition() { return m_Partition; /**< @return the widget's Partition */ } const Partition* partition() const { return m_Partition; /**< @return the widget's Partition */ } void setFileSystemColorCode( const std::vector& colorCode ); protected: - void paintEvent(QPaintEvent* event); - void resizeEvent(QResizeEvent* event); + void paintEvent(QPaintEvent* event) override; + void resizeEvent(QResizeEvent* event) override; QColor activeColor(const QColor& col) const; void drawGradient(QPainter* painter, const QColor& color, const QRect& rect, bool active = false) const; private: Partition* m_Partition; bool m_Active; std::vector m_fileSystemColorCode; }; #endif diff --git a/test/testexternalcommand.cpp b/test/testexternalcommand.cpp index aec3d31..a8d48f9 100644 --- a/test/testexternalcommand.cpp +++ b/test/testexternalcommand.cpp @@ -1,66 +1,66 @@ /************************************************************************* * Copyright 2017 by Andrius Štikonas * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 3 of * * the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see .* *************************************************************************/ // SPDX-License-Identifier: GPL-3.0+ #include "helpers.h" #include "backend/corebackendmanager.h" #include "util/externalcommand.h" #include #include #include class runcmd : public QThread { public: -void run() +void run() override { ExternalCommand blkidCmd(QStringLiteral("blkid"), {}); blkidCmd.run(); qDebug().noquote() << blkidCmd.output(); } }; class runcmd2 : public QThread { public: -void run() +void run() override { ExternalCommand lsblkCmd(QStringLiteral("lsblk"), { QStringLiteral("--nodeps"), QStringLiteral("--json") }); lsblkCmd.run(); qDebug().noquote() << lsblkCmd.output(); } }; int main( int argc, char **argv ) { QCoreApplication app(argc, argv); KPMCoreInitializer i(QStringLiteral("pmsfdiskbackendplugin")); runcmd a; runcmd2 b; a.start(); a.wait(); b.start(); b.wait(); return 0; }