[rvthtool] Un-indent *all* the classes.

QRvtHToolWindow::openRvtH(): This function takes a filename using Qt
separators ('/'), *not* native separators.
This commit is contained in:
David Korth 2025-05-21 20:44:08 -04:00
parent 3114107a4b
commit 2d8d68a3aa
38 changed files with 1650 additions and 1615 deletions

View File

@ -12,62 +12,62 @@
class CisoReader : public Reader
{
public:
/**
* Create a CISO reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
CisoReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
/**
* Create a CISO reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
CisoReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
private:
typedef Reader super;
DISABLE_COPY(CisoReader)
private:
typedef Reader super;
DISABLE_COPY(CisoReader)
public:
/**
* Is a given disc image supported by the CISO reader?
* @param sbuf [in] Sector buffer. (first LBA of the disc)
* @param size [in] Size of sbuf. (should be 512 or larger)
* @return True if supported; false if not.
*/
static bool isSupported(const uint8_t *sbuf, size_t size);
public:
/**
* Is a given disc image supported by the CISO reader?
* @param sbuf [in] Sector buffer. (first LBA of the disc)
* @param size [in] Size of sbuf. (should be 512 or larger)
* @return True if supported; false if not.
*/
static bool isSupported(const uint8_t *sbuf, size_t size);
public:
/** I/O functions **/
public:
/** I/O functions **/
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
private:
#define CISO_HEADER_SIZE 0x8000
#define CISO_MAP_SIZE (CISO_HEADER_SIZE - sizeof(uint32_t) - (sizeof(char) * 4))
private:
#define CISO_HEADER_SIZE 0x8000
#define CISO_MAP_SIZE (CISO_HEADER_SIZE - sizeof(uint32_t) - (sizeof(char) * 4))
// 32 KB minimum block size (GCN/Wii sector)
// 16 MB maximum block size
#define CISO_BLOCK_SIZE_MIN (32768)
#define CISO_BLOCK_SIZE_MAX (16*1024*1024)
// 32 KB minimum block size (GCN/Wii sector)
// 16 MB maximum block size
#define CISO_BLOCK_SIZE_MIN (32768)
#define CISO_BLOCK_SIZE_MAX (16*1024*1024)
// NOTE: reader.lba_len is the virtual image size.
// real_lba_len is the actual image size.
uint32_t m_real_lba_len;
// NOTE: reader.lba_len is the virtual image size.
// real_lba_len is the actual image size.
uint32_t m_real_lba_len;
// CISO block size, in LBAs.
uint32_t m_block_size_lba;
// CISO block size, in LBAs.
uint32_t m_block_size_lba;
// Block map.
// 0x0000 == first block after CISO header.
// 0xFFFF == empty block.
uint16_t m_blockMap[CISO_MAP_SIZE];
// Block map.
// 0x0000 == first block after CISO header.
// 0xFFFF == empty block.
uint16_t m_blockMap[CISO_MAP_SIZE];
};

View File

@ -13,41 +13,41 @@
class PlainReader : public Reader
{
public:
/**
* Create a plain reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
PlainReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
/**
* Create a plain reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
PlainReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
private:
typedef Reader super;
DISABLE_COPY(PlainReader)
private:
typedef Reader super;
DISABLE_COPY(PlainReader)
public:
/** I/O functions **/
public:
/** I/O functions **/
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
/**
* Write data to the disc image.
* @param ptr [in] Write buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t write(const void *ptr, uint32_t lba_start, uint32_t lba_len) final;
/**
* Write data to the disc image.
* @param ptr [in] Write buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t write(const void *ptr, uint32_t lba_start, uint32_t lba_len) final;
};

View File

@ -18,120 +18,120 @@
class Reader
{
protected:
/**
* Reader base class
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
Reader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
virtual ~Reader() = default;
protected:
/**
* Reader base class
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
*/
Reader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
virtual ~Reader() = default;
private:
DISABLE_COPY(Reader)
private:
DISABLE_COPY(Reader)
public:
/**
* Create a Reader object for a disc image.
*
* If the disc image is using a supported compressed/compacted
* format, the appropriate reader will be chosen. Otherwise,
* the plain reader will be used.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
* @return Reader*, or NULL on error.
*/
static Reader *open(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
/**
* Create a Reader object for a disc image.
*
* If the disc image is using a supported compressed/compacted
* format, the appropriate reader will be chosen. Otherwise,
* the plain reader will be used.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
* @return Reader*, or NULL on error.
*/
static Reader *open(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
/**
* Is the Reader object open?
* @return True if open; false if not.
*/
inline bool isOpen(void) const
{
return (m_file != nullptr);
public:
/**
* Is the Reader object open?
* @return True if open; false if not.
*/
inline bool isOpen(void) const
{
return (m_file != nullptr);
}
public:
/** I/O functions **/
// TODO: lba_start param, or separate seek()?
// Regardless, we have to seek on each read because another
// disc image may have altered the file pointer.
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
virtual uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) = 0;
/**
* Write data to the disc image.
* @param ptr [in] Write buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
virtual uint32_t write(const void *ptr, uint32_t lba_start, uint32_t lba_len);
/**
* Flush the file buffers.
*/
void flush(void);
public:
/** Accessors **/
/**
* Get the starting LBA.
* @return Starting LBA.
*/
inline uint32_t lba_start(void) const { return m_lba_start; }
/**
* Get the length, in LBAs.
* @return Length, in LBAs.
*/
inline uint32_t lba_len(void) const { return m_lba_len; }
/**
* Get the image type.
* @return Image type.
*/
inline RvtH_ImageType_e type(void) const { return m_type; }
public:
/** Special functions **/
/**
* Adjust the LBA starting offset for SDK headers.
* @param lba_count Number of LBAs to adjust.
*/
inline void lba_adjust(uint32_t lba_count)
{
if (lba_count > m_lba_len) {
lba_count = m_lba_len;
}
m_lba_start += lba_count;
m_lba_len -= lba_count;
}
public:
/** I/O functions **/
// TODO: lba_start param, or separate seek()?
// Regardless, we have to seek on each read because another
// disc image may have altered the file pointer.
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
virtual uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) = 0;
/**
* Write data to the disc image.
* @param ptr [in] Write buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
virtual uint32_t write(const void *ptr, uint32_t lba_start, uint32_t lba_len);
/**
* Flush the file buffers.
*/
void flush(void);
public:
/** Accessors **/
/**
* Get the starting LBA.
* @return Starting LBA.
*/
inline uint32_t lba_start(void) const { return m_lba_start; }
/**
* Get the length, in LBAs.
* @return Length, in LBAs.
*/
inline uint32_t lba_len(void) const { return m_lba_len; }
/**
* Get the image type.
* @return Image type.
*/
inline RvtH_ImageType_e type(void) const { return m_type; }
public:
/** Special functions **/
/**
* Adjust the LBA starting offset for SDK headers.
* @param lba_count Number of LBAs to adjust.
*/
inline void lba_adjust(uint32_t lba_count)
{
if (lba_count > m_lba_len) {
lba_count = m_lba_len;
}
m_lba_start += lba_count;
m_lba_len -= lba_count;
}
protected:
RefFilePtr m_file; // Disc image file
uint32_t m_lba_start; // Starting LBA
uint32_t m_lba_len; // Length of image, in LBAs
RvtH_ImageType_e m_type; // Disc image type
protected:
RefFilePtr m_file; // Disc image file
uint32_t m_lba_start; // Starting LBA
uint32_t m_lba_len; // Length of image, in LBAs
RvtH_ImageType_e m_type; // Disc image type
};
#else /* !__cplusplus */

View File

@ -18,58 +18,58 @@ typedef uint16_t be16_t;
class WbfsReader : public Reader
{
public:
/**
* Create a WBFS reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
* @return Reader*, or NULL on error.
*/
WbfsReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
public:
/**
* Create a WBFS reader for a disc image.
*
* NOTE: If lba_start == 0 and lba_len == 0, the entire file
* will be used.
*
* @param file RefFile
* @param lba_start [in] Starting LBA
* @param lba_len [in] Length, in LBAs
* @return Reader*, or NULL on error.
*/
WbfsReader(const RefFilePtr &file, uint32_t lba_start, uint32_t lba_len);
virtual ~WbfsReader();
virtual ~WbfsReader();
private:
typedef Reader super;
DISABLE_COPY(WbfsReader);
private:
typedef Reader super;
DISABLE_COPY(WbfsReader);
public:
/**
* Is a given disc image supported by the WBFS reader?
* @param sbuf [in] Sector buffer. (first LBA of the disc)
* @param size [in] Size of sbuf. (should be 512 or larger)
* @return True if supported; false if not.
*/
static bool isSupported(const uint8_t *sbuf, size_t size);
public:
/**
* Is a given disc image supported by the WBFS reader?
* @param sbuf [in] Sector buffer. (first LBA of the disc)
* @param size [in] Size of sbuf. (should be 512 or larger)
* @return True if supported; false if not.
*/
static bool isSupported(const uint8_t *sbuf, size_t size);
public:
/** I/O functions **/
public:
/** I/O functions **/
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
/**
* Read data from the disc image.
* @param ptr [out] Read buffer.
* @param lba_start [in] Starting LBA.
* @param lba_len [in] Length, in LBAs.
* @return Number of LBAs read, or 0 on error.
*/
uint32_t read(void *ptr, uint32_t lba_start, uint32_t lba_len) final;
private:
// NOTE: reader.lba_len is the virtual image size.
// real_lba_len is the actual image size.
uint32_t m_real_lba_len;
private:
// NOTE: reader.lba_len is the virtual image size.
// real_lba_len is the actual image size.
uint32_t m_real_lba_len;
// WBFS block size, in LBAs.
uint32_t m_block_size_lba;
// WBFS block size, in LBAs.
uint32_t m_block_size_lba;
// WBFS structs.
wbfs_t *m_wbfs; // WBFS image.
wbfs_disc_t *m_wbfs_disc; // Current disc.
// WBFS structs.
wbfs_t *m_wbfs; // WBFS image.
wbfs_disc_t *m_wbfs_disc; // Current disc.
const be16_t *m_wlba_table; // Pointer to m_wbfs_disc->disc->header->wlba_table.
const be16_t *m_wlba_table; // Pointer to m_wbfs_disc->disc->header->wlba_table.
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (libwiicrypto/tests) *
* CertVerifyTest.cpp: Certificate verification test. *
* *
* Copyright (c) 2018 by David Korth. *
* Copyright (c) 2018-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -27,18 +27,18 @@ namespace LibWiiCrypto { namespace Tests {
class CertVerifyTest : public ::testing::TestWithParam<RVL_Cert_Issuer>
{
protected:
CertVerifyTest() { }
protected:
CertVerifyTest() = default;
public:
/** Test case parameters. **/
public:
/** Test case parameters **/
/**
* Test case suffix generator.
* @param info Test parameter information.
* @return Test case suffix.
*/
static string test_case_suffix_generator(const ::testing::TestParamInfo<RVL_Cert_Issuer> &info);
/**
* Test case suffix generator.
* @param info Test parameter information.
* @return Test case suffix.
*/
static string test_case_suffix_generator(const ::testing::TestParamInfo<RVL_Cert_Issuer> &info);
};
/**

View File

@ -12,18 +12,18 @@
class MessageSound
{
private:
// MessageSound is a private class.
MessageSound();
~MessageSound();
Q_DISABLE_COPY(MessageSound);
private:
// MessageSound is a private class.
MessageSound();
~MessageSound();
Q_DISABLE_COPY(MessageSound);
public:
/**
* Play a message sound effect.
* @param notificationType Notification type.
* @param message Message for logging. (not supported on all systems)
* @param parent Parent window. (not supported on all systems)
*/
static void play(QMessageBox::Icon notificationType, const QString &message = QString(), QWidget *parent = nullptr);
public:
/**
* Play a message sound effect.
* @param notificationType Notification type.
* @param message Message for logging. (not supported on all systems)
* @param parent Parent window. (not supported on all systems)
*/
static void play(QMessageBox::Icon notificationType, const QString &message = QString(), QWidget *parent = nullptr);
};

View File

@ -29,67 +29,67 @@ using std::array;
class RvtHModelPrivate
{
public:
explicit RvtHModelPrivate(RvtHModel *q);
public:
explicit RvtHModelPrivate(RvtHModel *q);
protected:
RvtHModel *const q_ptr;
Q_DECLARE_PUBLIC(RvtHModel)
private:
Q_DISABLE_COPY(RvtHModelPrivate)
protected:
RvtHModel *const q_ptr;
Q_DECLARE_PUBLIC(RvtHModel)
private:
Q_DISABLE_COPY(RvtHModelPrivate)
public:
RvtH *rvth;
// Style variables.
struct style_t {
/**
* Initialize the style variables.
*/
void init(void);
// Background colors for "deleted" banks.
QBrush brush_lostFile;
QBrush brush_lostFile_alt;
// Monosapced font.
QFont fntMonospace;
};
style_t style;
public:
RvtH *rvth;
// Style variables.
struct style_t {
/**
* Load an icon.
* @param id Icon ID.
* @return Icon.
* Initialize the style variables.
*/
static QIcon getIcon(RvtHModel::IconID id);
void init(void);
private:
/**
* Load an icon from the Qt resources.
* @param dir Base directory.
* @param name Icon name.
*/
static QIcon loadIcon(const QString &dir, const QString &name);
// Background colors for "deleted" banks.
QBrush brush_lostFile;
QBrush brush_lostFile_alt;
// Icons for COL_TYPE.
// TODO: QMutexLocker?
static QIcon ms_icons[RvtHModel::ICON_MAX];
// Monosapced font.
QFont fntMonospace;
};
style_t style;
public:
/**
* Get the icon ID for the specified bank.
* @param bank Bank number.
* @return RvtHModel::IconID, or RvtHModel::ICON_MAX on error.
*/
RvtHModel::IconID iconIDForBank(unsigned int bank) const;
/**
* Load an icon.
* @param id Icon ID
* @return Icon
*/
static QIcon getIcon(RvtHModel::IconID id);
/**
* Get the icon for the specified bank.
* @param bank Bank number.
* @return QIcon.
*/
QIcon iconForBank(unsigned int bank) const;
private:
/**
* Load an icon from the Qt resources.
* @param dir Base directory
* @param name Icon name
*/
static QIcon loadIcon(const QString &dir, const QString &name);
// Icons for COL_TYPE.
// TODO: QMutexLocker?
static QIcon ms_icons[RvtHModel::ICON_MAX];
public:
/**
* Get the icon ID for the specified bank.
* @param bank Bank number
* @return RvtHModel::IconID, or RvtHModel::ICON_MAX on error.
*/
RvtHModel::IconID iconIDForBank(unsigned int bank) const;
/**
* Get the icon for the specified bank.
* @param bank Bank number
* @return QIcon
*/
QIcon iconForBank(unsigned int bank) const;
};
/** RvtHModelPrivate **/
@ -144,8 +144,8 @@ void RvtHModelPrivate::style_t::init(void)
/**
* Load an icon.
* @param id Icon ID.
* @return Icon.
* @param id Icon ID
* @return Icon
*/
QIcon RvtHModelPrivate::getIcon(RvtHModel::IconID id)
{
@ -169,8 +169,8 @@ QIcon RvtHModelPrivate::getIcon(RvtHModel::IconID id)
/**
* Load an icon from the Qt resources.
* @param dir Base directory.
* @param name Icon name.
* @param dir Base directory
* @param name Icon name
*/
QIcon RvtHModelPrivate::loadIcon(const QString &dir, const QString &name)
{
@ -192,7 +192,7 @@ QIcon RvtHModelPrivate::loadIcon(const QString &dir, const QString &name)
/**
* Get the icon ID for the specified bank.
* @param bank Bank number.
* @param bank Bank number
* @return RvtHModel::IconID, or RvtHModel::ICON_MAX on error.
*/
RvtHModel::IconID RvtHModelPrivate::iconIDForBank(unsigned int bank) const
@ -275,8 +275,8 @@ RvtHModel::IconID RvtHModelPrivate::iconIDForBank(unsigned int bank) const
/**
* Get the icon for the specified bank.
* @param bank Bank number.
* @return QIcon.
* @param bank Bank number
* @return QIcon
*/
QIcon RvtHModelPrivate::iconForBank(unsigned int bank) const
{

View File

@ -16,86 +16,86 @@ class RvtH;
class RvtHModelPrivate;
class RvtHModel : public QAbstractListModel
{
Q_OBJECT
typedef QAbstractListModel super;
Q_OBJECT
typedef QAbstractListModel super;
public:
explicit RvtHModel(QObject *parent = nullptr);
virtual ~RvtHModel();
public:
explicit RvtHModel(QObject *parent = nullptr);
virtual ~RvtHModel();
protected:
RvtHModelPrivate *const d_ptr;
Q_DECLARE_PRIVATE(RvtHModel)
private:
Q_DISABLE_COPY(RvtHModel)
protected:
RvtHModelPrivate *const d_ptr;
Q_DECLARE_PRIVATE(RvtHModel)
private:
Q_DISABLE_COPY(RvtHModel)
public:
enum Column {
COL_BANKNUM, // Bank #
COL_TYPE, // Type (HW)
COL_TITLE, // Title
COL_GAMEID, // Game ID
COL_DISCNUM, // Disc #
COL_REVISION, // Revision
COL_REGION, // Region
COL_IOS_VERSION, // IOS version (Wii only)
COL_MAX
};
public:
enum Column {
COL_BANKNUM, // Bank #
COL_TYPE, // Type (HW)
COL_TITLE, // Title
COL_GAMEID, // Game ID
COL_DISCNUM, // Disc #
COL_REVISION, // Revision
COL_REGION, // Region
COL_IOS_VERSION, // IOS version (Wii only)
// Icon IDs.
enum IconID {
ICON_GCN, // GameCube (retail)
ICON_NR, // NR Reader (debug)
ICON_WII, // Wii (retail)
ICON_RVTR, // RVT-R Reader (debug)
ICON_RVTH, // RVT-H Reader (debug)
COL_MAX
};
ICON_MAX
};
// Icon IDs
enum IconID {
ICON_GCN, // GameCube (retail)
ICON_NR, // NR Reader (debug)
ICON_WII, // Wii (retail)
ICON_RVTR, // RVT-R Reader (debug)
ICON_RVTH, // RVT-H Reader (debug)
// Dual-layer role.
// If true, this is a Wii DL image and should be
// represented as taking up two banks.
static const int DualLayerRole = Qt::UserRole;
ICON_MAX
};
// Qt Model/View interface.
int rowCount(const QModelIndex& parent = QModelIndex()) const final;
int columnCount(const QModelIndex& parent = QModelIndex()) const final;
// Dual-layer role.
// If true, this is a Wii DL image and should be
// represented as taking up two banks.
static const int DualLayerRole = Qt::UserRole;
QVariant data(const QModelIndex& index, int role) const final;
QVariant headerData(int section, Qt::Orientation orientation, int role) const final;
// Qt Model/View interface.
int rowCount(const QModelIndex& parent = QModelIndex()) const final;
int columnCount(const QModelIndex& parent = QModelIndex()) const final;
/**
* Set the RVT-H Reader disk image to use in this model.
* @param rvth RVT-H Reader disk image.
*/
void setRvtH(RvtH *rvth);
QVariant data(const QModelIndex& index, int role) const final;
QVariant headerData(int section, Qt::Orientation orientation, int role) const final;
/**
* Load an icon.
* @param id Icon ID.
* @return Icon.
*/
static QIcon getIcon(IconID id);
/**
* Set the RVT-H Reader disk image to use in this model.
* @param rvth RVT-H Reader disk image
*/
void setRvtH(RvtH *rvth);
/**
* Get the icon ID for the first bank.
* Used for the application icon.
* @return Icon ID, or ICON_MAX on error.
*/
IconID iconIDForBank1(void) const;
/**
* Load an icon.
* @param id Icon ID
* @return Icon
*/
static QIcon getIcon(IconID id);
private slots:
/**
* The system theme has changed.
*/
void themeChanged_slot(void);
/**
* Get the icon ID for the first bank.
* Used for the application icon.
* @return Icon ID, or ICON_MAX on error.
*/
IconID iconIDForBank1(void) const;
public slots:
/**
* Force the RVT-H model to update a bank.
* @param bank Bank number.
*/
void forceBankUpdate(unsigned int bank);
private slots:
/**
* The system theme has changed.
*/
void themeChanged_slot(void);
public slots:
/**
* Force the RVT-H model to update a bank.
* @param bank Bank number
*/
void forceBankUpdate(unsigned int bank);
};

View File

@ -12,16 +12,16 @@
class RvtHSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
typedef QSortFilterProxyModel super;
Q_OBJECT
typedef QSortFilterProxyModel super;
public:
explicit RvtHSortFilterProxyModel(QObject *parent = nullptr);
public:
explicit RvtHSortFilterProxyModel(QObject *parent = nullptr);
private:
Q_DISABLE_COPY(RvtHSortFilterProxyModel)
private:
Q_DISABLE_COPY(RvtHSortFilterProxyModel)
public:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const final;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const final;
public:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const final;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* DockManager.hpp: DockManager D-Bus implementation. *
* *
* Copyright (c) 2013-2023 by David Korth. *
* Copyright (c) 2013-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -30,44 +30,44 @@
#include "TaskbarButtonManager_p.hpp"
class DockManagerPrivate : public TaskbarButtonManagerPrivate
{
public:
explicit DockManagerPrivate(DockManager *const q);
virtual ~DockManagerPrivate();
public:
explicit DockManagerPrivate(DockManager *const q);
virtual ~DockManagerPrivate();
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(DockManager)
Q_DISABLE_COPY(DockManagerPrivate)
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(DockManager)
Q_DISABLE_COPY(DockManagerPrivate)
public:
/**
* Close all DockManager connections.
*/
void close(void);
public:
/**
* Close all DockManager connections.
*/
void close(void);
/**
* Get the DockManager interface.
* @param parent Parent for the DockManager interface object.
* @return DockManager interface, or nullptr on error.
*/
static net::launchpad::DockManager *GetDockManagerInterface(QObject *parent = 0);
/**
* Get the DockManager interface.
* @param parent Parent for the DockManager interface object.
* @return DockManager interface, or nullptr on error.
*/
static net::launchpad::DockManager *GetDockManagerInterface(QObject *parent = 0);
/**
* Connect to the DockManager.
* @return 0 on success; non-zero on error.
*/
int connectToDockManager(void);
/**
* Connect to the DockManager.
* @return 0 on success; non-zero on error.
*/
int connectToDockManager(void);
/**
* Update the DockItem status.
* DockItem must be connected.
*/
void update(void);
/**
* Update the DockItem status.
* DockItem must be connected.
*/
void update(void);
private:
// DockManager.
net::launchpad::DockManager *ifDockManager;
net::launchpad::DockItem *ifDockItem;
private:
// DockManager
net::launchpad::DockManager *ifDockManager;
net::launchpad::DockItem *ifDockItem;
};
DockManagerPrivate::DockManagerPrivate(DockManager *const q)
@ -242,7 +242,7 @@ bool DockManager::IsUsable(void)
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
* @param window Window
*/
void DockManager::setWindow(QWidget *window)
{

View File

@ -13,48 +13,48 @@
class DockManagerPrivate;
class DockManager : public TaskbarButtonManager
{
Q_OBJECT
Q_OBJECT
public:
explicit DockManager(QObject *parent = nullptr);
public:
explicit DockManager(QObject *parent = nullptr);
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(DockManager)
Q_DISABLE_COPY(DockManager)
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(DockManager)
Q_DISABLE_COPY(DockManager)
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
*/
void setWindow(QWidget *window) final;
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window
*/
void setWindow(QWidget *window) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
private slots:
/**
* HACK: Timer for window initialization.
* If we attempt to get the dock item before the
* window is fully initialized, we won't find it.
*/
void setWindow_timer_slot(void);
private slots:
/**
* HACK: Timer for window initialization.
* If we attempt to get the dock item before the
* window is fully initialized, we won't find it.
*/
void setWindow_timer_slot(void);
};

View File

@ -14,83 +14,83 @@
class TaskbarButtonManagerPrivate;
class TaskbarButtonManager : public QObject
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY(QWidget* window READ window WRITE setWindow)
Q_PROPERTY(int progressBarValue READ progressBarValue WRITE setProgressBarValue)
Q_PROPERTY(int progressBarMax READ progressBarMax WRITE setProgressBarMax)
Q_PROPERTY(QWidget* window READ window WRITE setWindow)
Q_PROPERTY(int progressBarValue READ progressBarValue WRITE setProgressBarValue)
Q_PROPERTY(int progressBarMax READ progressBarMax WRITE setProgressBarMax)
protected:
TaskbarButtonManager(TaskbarButtonManagerPrivate *d, QObject *parent = nullptr);
public:
virtual ~TaskbarButtonManager();
protected:
TaskbarButtonManager(TaskbarButtonManagerPrivate *d, QObject *parent = nullptr);
public:
virtual ~TaskbarButtonManager();
protected:
TaskbarButtonManagerPrivate *const d_ptr;
Q_DECLARE_PRIVATE(TaskbarButtonManager)
private:
typedef QObject super;
Q_DISABLE_COPY(TaskbarButtonManager)
protected:
TaskbarButtonManagerPrivate *const d_ptr;
Q_DECLARE_PRIVATE(TaskbarButtonManager)
private:
typedef QObject super;
Q_DISABLE_COPY(TaskbarButtonManager)
public:
/**
* Get the window this TaskbarButtonManager is managing.
* @return Window.
*/
QWidget *window(void) const;
public:
/**
* Get the window this TaskbarButtonManager is managing.
* @return Window
*/
QWidget *window(void) const;
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
*/
virtual void setWindow(QWidget *window);
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
*/
virtual void setWindow(QWidget *window);
/**
* Clear the progress bar.
*/
void clearProgressBar(void);
/**
* Clear the progress bar.
*/
void clearProgressBar(void);
/**
* Get the progress bar value.
* @return Value.
*/
int progressBarValue(void) const;
/**
* Get the progress bar value.
* @return Value.
*/
int progressBarValue(void) const;
/**
* Set the progress bar value.
* @param current Value.
*/
void setProgressBarValue(int value);
/**
* Set the progress bar value.
* @param current Value.
*/
void setProgressBarValue(int value);
/**
* Get the progress bar's maximum value.
* @return Maximum value.
*/
int progressBarMax(void) const;
/**
* Get the progress bar's maximum value.
* @return Maximum value.
*/
int progressBarMax(void) const;
/**
* Set the progress bar's maximum value.
* @param max Maximum value.
*/
void setProgressBarMax(int max);
/**
* Set the progress bar's maximum value.
* @param max Maximum value.
*/
void setProgressBarMax(int max);
protected:
/**
* Update the taskbar button.
*/
virtual void update(void) = 0;
protected:
/**
* Update the taskbar button.
*/
virtual void update(void) = 0;
private slots:
/**
* Window we're managing was destroyed.
* @param obj QObject that was destroyed.
*/
void windowDestroyed_slot(QObject *obj);
private slots:
/**
* Window we're managing was destroyed.
* @param obj QObject that was destroyed.
*/
void windowDestroyed_slot(QObject *obj);
};

View File

@ -15,17 +15,17 @@ class QObject;
class TaskbarButtonManager;
class TaskbarButtonManagerFactory
{
private:
TaskbarButtonManagerFactory();
~TaskbarButtonManagerFactory();
private:
Q_DISABLE_COPY(TaskbarButtonManagerFactory)
private:
TaskbarButtonManagerFactory();
~TaskbarButtonManagerFactory();
private:
Q_DISABLE_COPY(TaskbarButtonManagerFactory)
public:
/**
* Create a TaskbarButtonManager.
* @param parent Parent object.
* @return System-specific TaskbarButtonManager, or nullptr on error.
*/
static TaskbarButtonManager *createManager(QObject *parent = nullptr);
public:
/**
* Create a TaskbarButtonManager.
* @param parent Parent object.
* @return System-specific TaskbarButtonManager, or nullptr on error.
*/
static TaskbarButtonManager *createManager(QObject *parent = nullptr);
};

View File

@ -12,21 +12,21 @@
class TaskbarButtonManagerPrivate
{
public:
explicit TaskbarButtonManagerPrivate(TaskbarButtonManager *const q);
virtual ~TaskbarButtonManagerPrivate();
public:
explicit TaskbarButtonManagerPrivate(TaskbarButtonManager *const q);
virtual ~TaskbarButtonManagerPrivate();
protected:
TaskbarButtonManager *const q_ptr;
Q_DECLARE_PUBLIC(TaskbarButtonManager)
private:
Q_DISABLE_COPY(TaskbarButtonManagerPrivate)
protected:
TaskbarButtonManager *const q_ptr;
Q_DECLARE_PUBLIC(TaskbarButtonManager)
private:
Q_DISABLE_COPY(TaskbarButtonManagerPrivate)
public:
// Window.
QWidget *window;
public:
// Window
QWidget *window;
// Status elements.
int progressBarValue; // Current progress. (-1 for no bar)
int progressBarMax; // Maximum progress.
// Status elements
int progressBarValue; // Current progress. (-1 for no bar)
int progressBarMax; // Maximum progress.
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* UnityLauncher.cpp: Unity Launcher implementation. *
* *
* Copyright (c) 2013-2023 by David Korth. *
* Copyright (c) 2013-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -26,36 +26,38 @@
#include "TaskbarButtonManager_p.hpp"
class UnityLauncherPrivate : public TaskbarButtonManagerPrivate
{
public:
explicit UnityLauncherPrivate(UnityLauncher *const q)
: super(q) { }
public:
explicit UnityLauncherPrivate(UnityLauncher *const q)
: super(q)
{ }
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(UnityLauncher)
Q_DISABLE_COPY(UnityLauncherPrivate)
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(UnityLauncher)
Q_DISABLE_COPY(UnityLauncherPrivate)
public:
static inline void sendMessage(const QVariantMap &map)
{
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/qrvthtool"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
QVariantList args;
args << QStringLiteral("application://" DESKTOP_FILENAME) << map;
message.setArguments(args);
if (!QDBusConnection::sessionBus().send(message))
qWarning("Unable to send message");
public:
static inline void sendMessage(const QVariantMap &map)
{
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/qrvthtool"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
QVariantList args;
args << QStringLiteral("application://" DESKTOP_FILENAME) << map;
message.setArguments(args);
if (!QDBusConnection::sessionBus().send(message)) {
qWarning("Unable to send message");
}
}
template<typename T>
static void sendMessage(const char *name, const T &value)
{
QVariantMap map;
map.insert(QLatin1String(name), value);
sendMessage(map);
}
template<typename T>
static void sendMessage(const char *name, const T &value)
{
QVariantMap map;
map.insert(QLatin1String(name), value);
sendMessage(map);
}
};
/** UnityLauncher **/
@ -84,7 +86,7 @@ bool UnityLauncher::IsUsable(void)
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
* @param window Window
*/
void UnityLauncher::setWindow(QWidget *window)
{

View File

@ -13,40 +13,40 @@
class UnityLauncherPrivate;
class UnityLauncher : public TaskbarButtonManager
{
Q_OBJECT
Q_OBJECT
public:
explicit UnityLauncher(QObject *parent = nullptr);
public:
explicit UnityLauncher(QObject *parent = nullptr);
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(UnityLauncher)
Q_DISABLE_COPY(UnityLauncher)
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(UnityLauncher)
Q_DISABLE_COPY(UnityLauncher)
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
*/
void setWindow(QWidget *window) final;
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window
*/
void setWindow(QWidget *window) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* Win7TaskbarList.cpp: Windows 7 ITaskBarList3 implementation. *
* *
* Copyright (c) 2013-2019 by David Korth. *
* Copyright (c) 2013-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -20,29 +20,29 @@
#include "TaskbarButtonManager_p.hpp"
class Win7TaskbarListPrivate : public TaskbarButtonManagerPrivate
{
public:
explicit Win7TaskbarListPrivate(Win7TaskbarList *const q);
virtual ~Win7TaskbarListPrivate();
public:
explicit Win7TaskbarListPrivate(Win7TaskbarList *const q);
virtual ~Win7TaskbarListPrivate();
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(Win7TaskbarList)
Q_DISABLE_COPY(Win7TaskbarListPrivate);
private:
typedef TaskbarButtonManagerPrivate super;
Q_DECLARE_PUBLIC(Win7TaskbarList)
Q_DISABLE_COPY(Win7TaskbarListPrivate);
public:
/**
* Update the ITaskbarList3 status.
*/
void update(void);
public:
/**
* Update the ITaskbarList3 status.
*/
void update(void);
/**
* Release the ITaskbarList3 object.
*/
void close(void);
/**
* Release the ITaskbarList3 object.
*/
void close(void);
private:
// Win7TaskbarList.
ITaskbarList3 *w7taskbar;
private:
// Win7TaskbarList.
ITaskbarList3 *w7taskbar;
};
Win7TaskbarListPrivate::Win7TaskbarListPrivate(Win7TaskbarList *const q)
@ -134,7 +134,7 @@ bool Win7TaskbarList::IsUsable(void)
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
* @param window Window
*/
void Win7TaskbarList::setWindow(QWidget *window)
{

View File

@ -13,40 +13,40 @@
class Win7TaskbarListPrivate;
class Win7TaskbarList : public TaskbarButtonManager
{
Q_OBJECT
Q_OBJECT
public:
explicit Win7TaskbarList(QObject *parent = nullptr);
public:
explicit Win7TaskbarList(QObject *parent = nullptr);
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(Win7TaskbarList)
Q_DISABLE_COPY(Win7TaskbarList)
private:
typedef TaskbarButtonManager super;
Q_DECLARE_PRIVATE(Win7TaskbarList)
Q_DISABLE_COPY(Win7TaskbarList)
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Is this TaskbarButtonManager usable?
* @return True if usable; false if not.
*/
static bool IsUsable(void);
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window.
*/
void setWindow(QWidget *window) final;
public:
/**
* Set the window this TaskbarButtonManager should manage.
* This must be a top-level window in order to work properly.
*
* Subclasses should reimplement this function if special
* initialization is required to set up the taskbar button.
*
* TODO: Make a separate protected function that setWindow() calls?
*
* @param window Window
*/
void setWindow(QWidget *window) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
protected:
/**
* Update the taskbar button.
*/
void update(void) final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* TranslationManager.cpp: Qt translation manager. *
* *
* Copyright (c) 2014-2023 by David Korth. *
* Copyright (c) 2014-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -21,26 +21,26 @@
class TranslationManagerPrivate
{
public:
explicit TranslationManagerPrivate(TranslationManager *q);
~TranslationManagerPrivate();
public:
explicit TranslationManagerPrivate(TranslationManager *q);
~TranslationManagerPrivate();
protected:
TranslationManager *const q_ptr;
Q_DECLARE_PUBLIC(TranslationManager)
private:
Q_DISABLE_COPY(TranslationManagerPrivate)
protected:
TranslationManager *const q_ptr;
Q_DECLARE_PUBLIC(TranslationManager)
private:
Q_DISABLE_COPY(TranslationManagerPrivate)
public:
static TranslationManager *instance;
public:
static TranslationManager *instance;
// QTranslators.
QTranslator *qtTranslator;
QTranslator *prgTranslator;
// QTranslators
QTranslator *qtTranslator;
QTranslator *prgTranslator;
// List of paths to check for translations.
// NOTE: qtTranslator also checks QLibraryInfo::TranslationsPath.
QVector<QString> pathList;
// List of paths to check for translations.
// NOTE: qtTranslator also checks QLibraryInfo::TranslationsPath.
QVector<QString> pathList;
};
// Singleton instance.

View File

@ -16,36 +16,36 @@
class TranslationManagerPrivate;
class TranslationManager : public QObject
{
Q_OBJECT
Q_OBJECT
private:
TranslationManager(QObject *parent = nullptr);
~TranslationManager();
private:
TranslationManager(QObject *parent = nullptr);
~TranslationManager();
protected:
typedef QObject super;
TranslationManagerPrivate *const d_ptr;
Q_DECLARE_PRIVATE(TranslationManager)
private:
Q_DISABLE_COPY(TranslationManager)
protected:
typedef QObject super;
TranslationManagerPrivate *const d_ptr;
Q_DECLARE_PRIVATE(TranslationManager)
private:
Q_DISABLE_COPY(TranslationManager)
public:
static TranslationManager *instance(void);
public:
static TranslationManager *instance(void);
/**
* Set the translation.
* @param locale Locale, e.g. "en_US". (Empty string is untranslated.)
*/
void setTranslation(const QString &locale);
/**
* Set the translation.
* @param locale Locale, e.g. "en_US". (Empty string is untranslated.)
*/
void setTranslation(const QString &locale);
// TODO: Add a function to get the current translation?
// TODO: Add a function to get the current translation?
/**
* Enumerate available translations.
* NOTE: This only checks qrvthtool translations.
* If a Qt translation exists but qrvthtool doesn't have
* that translation, it won't show up.
* @return Map of available translations. (Key == locale, Value == description)
*/
QMap<QString, QString> enumerate(void) const;
/**
* Enumerate available translations.
* NOTE: This only checks qrvthtool translations.
* If a Qt translation exists but qrvthtool doesn't have
* that translation, it won't show up.
* @return Map of available translations. (Key == locale, Value == description)
*/
QMap<QString, QString> enumerate(void) const;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* WorkerObject.cpp: Worker object for extract/import/etc. *
* *
* Copyright (c) 2018-2019 by David Korth. *
* Copyright (c) 2018-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -22,50 +22,51 @@
class WorkerObjectPrivate
{
public:
explicit WorkerObjectPrivate(WorkerObject *q)
: q_ptr(q)
, rvth(nullptr)
, bank(~0U)
, flags(0U)
, recryption_key(-1)
, cancel(false) { }
public:
explicit WorkerObjectPrivate(WorkerObject *q)
: q_ptr(q)
, rvth(nullptr)
, bank(~0U)
, flags(0U)
, recryption_key(-1)
, cancel(false)
{ }
protected:
WorkerObject *const q_ptr;
Q_DECLARE_PUBLIC(WorkerObject)
private:
Q_DISABLE_COPY(WorkerObjectPrivate)
protected:
WorkerObject *const q_ptr;
Q_DECLARE_PUBLIC(WorkerObject)
private:
Q_DISABLE_COPY(WorkerObjectPrivate)
public:
RvtH *rvth;
QString gcmFilename;
QString gcmFilenameOnly;
public:
RvtH *rvth;
QString gcmFilename;
QString gcmFilenameOnly;
unsigned int bank;
unsigned int flags;
int recryption_key;
unsigned int bank;
unsigned int flags;
int recryption_key;
// Cancel the current process.
// TODO: Mutex?
bool cancel;
// Cancel the current process.
// TODO: Mutex?
bool cancel;
public:
/**
* RVT-H progress callback.
* @param state [in] Current progress.
* @param userdata [in] User data specified when calling the RVT-H function.
* @return True to continue; false to abort.
*/
static bool progress_callback(const RvtH_Progress_State *state, void *userdata);
public:
/**
* RVT-H progress callback.
* @param state [in] Current progress
* @param userdata [in] User data specified when calling the RVT-H function
* @return True to continue; false to abort.
*/
static bool progress_callback(const RvtH_Progress_State *state, void *userdata);
};
/** WorkerObjectPrivate **/
/**
* RVT-H progress callback.
* @param state [in] Current progress.
* @param userdata [in] User data specified when calling the RVT-H function.
* @param state [in] Current progress
* @param userdata [in] User data specified when calling the RVT-H function
* @return True to continue; false to abort.
*/
bool WorkerObjectPrivate::progress_callback(const RvtH_Progress_State *state, void *userdata)
@ -140,7 +141,7 @@ WorkerObject::WorkerObject(QObject *parent)
/**
* Get the RVT-H object.
* @return RVT-H object.
* @return RVT-H object
*/
RvtH *WorkerObject::rvth(void) const
{
@ -150,7 +151,7 @@ RvtH *WorkerObject::rvth(void) const
/**
* Set the RVT-H object.
* @param rvth RVT-H object.
* @param rvth RVT-H object
*/
void WorkerObject::setRvtH(RvtH *rvth)
{
@ -160,7 +161,7 @@ void WorkerObject::setRvtH(RvtH *rvth)
/**
* Get the RVT-H bank number.
* @return RVT-H bank number. (~0 if not set)
* @return RVT-H bank number (~0 if not set)
*/
unsigned int WorkerObject::bank(void) const
{
@ -170,7 +171,7 @@ unsigned int WorkerObject::bank(void) const
/**
* Set the RVT-H bank number.
* @param bank Bank number.
* @param bank Bank number
*/
void WorkerObject::setBank(unsigned int bank)
{
@ -182,7 +183,7 @@ void WorkerObject::setBank(unsigned int bank)
* Get the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @return GCM filename.
* @return GCM filename
*/
QString WorkerObject::gcmFilename(void) const
{
@ -194,7 +195,7 @@ QString WorkerObject::gcmFilename(void) const
* Set the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @param filename GCM filename.
* @param filename GCM filename
*/
void WorkerObject::setGcmFilename(QString filename)
{
@ -205,7 +206,7 @@ void WorkerObject::setGcmFilename(QString filename)
/**
* Get the recryption key.
* @return Recryption key. (-1 for no recryption)
* @return Recryption key (-1 for no recryption)
*/
int WorkerObject::recryptionKey(void) const
{
@ -215,7 +216,7 @@ int WorkerObject::recryptionKey(void) const
/**
* Set the recryption key.
* @param recryption_key Recryption key. (-1 for no recryption)
* @param recryption_key Recryption key (-1 for no recryption)
*/
void WorkerObject::setRecryptionKey(int recryption_key)
{
@ -225,7 +226,7 @@ void WorkerObject::setRecryptionKey(int recryption_key)
/**
* Get the flags. (operation-specific)
* @return Flags.
* @return Flags
*/
unsigned int WorkerObject::flags(void) const
{
@ -235,7 +236,7 @@ unsigned int WorkerObject::flags(void) const
/**
* Set the flags. (operation-specific)
* @param flags Flags.
* @param flags Flags
*/
void WorkerObject::setFlags(unsigned int flags)
{

View File

@ -19,137 +19,137 @@ class QProgressBar;
class WorkerObjectPrivate;
class WorkerObject : public QObject
{
Q_OBJECT
typedef QObject super;
Q_OBJECT
typedef QObject super;
Q_PROPERTY(RvtH* rvth READ rvth WRITE setRvtH)
Q_PROPERTY(unsigned int bank READ bank WRITE setBank)
Q_PROPERTY(QString gcmFilename READ gcmFilename WRITE setGcmFilename)
Q_PROPERTY(int recryptionKey READ recryptionKey WRITE setRecryptionKey)
public:
explicit WorkerObject(QObject *parent = nullptr);
Q_PROPERTY(RvtH* rvth READ rvth WRITE setRvtH)
Q_PROPERTY(unsigned int bank READ bank WRITE setBank)
Q_PROPERTY(QString gcmFilename READ gcmFilename WRITE setGcmFilename)
Q_PROPERTY(int recryptionKey READ recryptionKey WRITE setRecryptionKey)
protected:
WorkerObjectPrivate *const d_ptr;
Q_DECLARE_PRIVATE(WorkerObject)
private:
Q_DISABLE_COPY(WorkerObject)
public:
explicit WorkerObject(QObject *parent = nullptr);
public:
/** Properties **/
protected:
WorkerObjectPrivate *const d_ptr;
Q_DECLARE_PRIVATE(WorkerObject)
private:
Q_DISABLE_COPY(WorkerObject)
/**
* Get the RVT-H object.
* @return RVT-H object.
*/
RvtH *rvth(void) const;
public:
/** Properties **/
/**
* Set the RVT-H object.
* @param rvth RVT-H object.
*/
void setRvtH(RvtH *rvth);
/**
* Get the RVT-H object.
* @return RVT-H object
*/
RvtH *rvth(void) const;
/**
* Get the RVT-H bank number.
* @return RVT-H bank number. (~0 if not set)
*/
unsigned int bank(void) const;
/**
* Set the RVT-H object.
* @param rvth RVT-H object
*/
void setRvtH(RvtH *rvth);
/**
* Set the RVT-H bank number.
* @param bank Bank number.
*/
void setBank(unsigned int bank);
/**
* Get the RVT-H bank number.
* @return RVT-H bank number (~0 if not set)
*/
unsigned int bank(void) const;
/**
* Get the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @return GCM filename.
*/
QString gcmFilename(void) const;
/**
* Set the RVT-H bank number.
* @param bank Bank number
*/
void setBank(unsigned int bank);
/**
* Set the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @param filename GCM filename.
*/
void setGcmFilename(QString filename);
/**
* Get the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @return GCM filename
*/
QString gcmFilename(void) const;
/**
* Get the recryption key.
* @return Recryption key. (-1 for no recryption)
*/
int recryptionKey(void) const;
/**
* Set the GCM filename.
* For extract: This will be the destination GCM.
* For import: This will be the source GCM.
* @param filename GCM filename
*/
void setGcmFilename(QString filename);
/**
* Set the recryption key.
* @param recryption_key Recryption key. (-1 for no recryption)
*/
void setRecryptionKey(int recryption_key);
/**
* Get the recryption key.
* @return Recryption key (-1 for no recryption)
*/
int recryptionKey(void) const;
/**
* Get the flags. (operation-specific)
* @return Flags.
*/
unsigned int flags(void) const;
/**
* Set the recryption key.
* @param recryption_key Recryption key (-1 for no recryption)
*/
void setRecryptionKey(int recryption_key);
/**
* Set the flags. (operation-specific)
* @param flags Flags.
*/
void setFlags(unsigned int flags);
/**
* Get the flags. (operation-specific)
* @return Flags
*/
unsigned int flags(void) const;
signals:
/** Signals **/
/**
* Set the flags. (operation-specific)
* @param flags Flags
*/
void setFlags(unsigned int flags);
/**
* Update the status bar.
* @param text Status bar text.
* @param progress_value Progress bar value. (If -1, ignore this.)
* @param progress_max Progress bar maximum. (If -1, ignore this.)
*/
void updateStatus(const QString &text, int progress_value, int progress_max);
signals:
/** Signals **/
/**
* Process is finished.
* @param text Status bar text.
* @param err Error code. (0 on success)
*/
void finished(const QString &text, int err);
/**
* Update the status bar.
* @param text Status bar text
* @param progress_value Progress bar value (If -1, ignore this.)
* @param progress_max Progress bar maximum (If -1, ignore this.)
*/
void updateStatus(const QString &text, int progress_value, int progress_max);
public slots:
/** Worker functions **/
/**
* Process is finished.
* @param text Status bar text
* @param err Error code (0 on success)
*/
void finished(const QString &text, int err);
/**
* Cancel the current process.
*/
void cancel(void);
public slots:
/** Worker functions **/
/**
* Start an extraction process.
*
* The following properties must be set before calling this function:
* - rvth
* - bank
* - gcmFilename
*
* Optional parameters:
* - recryptionKey (default is -1)
* - flags (default is 0)
*/
void doExtract(void);
/**
* Cancel the current process.
*/
void cancel(void);
/**
* Start an import process.
*
* The following properties must be set before calling this function:
* - rvth
* - bank
* - gcmFilename
*/
void doImport(void);
/**
* Start an extraction process.
*
* The following properties must be set before calling this function:
* - rvth
* - bank
* - gcmFilename
*
* Optional parameters:
* - recryptionKey (default is -1)
* - flags (default is 0)
*/
void doExtract(void);
/**
* Start an import process.
*
* The following properties must be set before calling this function:
* - rvth
* - bank
* - gcmFilename
*/
void doImport(void);
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* BankEntryView.cpp: Bank Entry view widget. *
* *
* Copyright (c) 2018-2023 by David Korth. *
* Copyright (c) 2018-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -25,43 +25,43 @@
#include "ui_BankEntryView.h"
class BankEntryViewPrivate
{
public:
explicit BankEntryViewPrivate(BankEntryView *q);
public:
explicit BankEntryViewPrivate(BankEntryView *q);
protected:
BankEntryView *const q_ptr;
Q_DECLARE_PUBLIC(BankEntryView)
private:
Q_DISABLE_COPY(BankEntryViewPrivate)
protected:
BankEntryView *const q_ptr;
Q_DECLARE_PUBLIC(BankEntryView)
private:
Q_DISABLE_COPY(BankEntryViewPrivate)
public:
// UI
Ui::BankEntryView ui;
public:
// UI
Ui::BankEntryView ui;
const RvtH_BankEntry *bankEntry;
const RvtH_BankEntry *bankEntry;
static inline int calc_frac_part(quint64 size, quint64 mask);
static inline int calc_frac_part(quint64 size, quint64 mask);
/**
* Format a file size.
* TODO: Move to a common file so other files can use this?
* @param size File size.
* @return Formatted file size.
*/
static QString formatFileSize(quint64 size);
/**
* Format a file size.
* TODO: Move to a common file so other files can use this?
* @param size File size
* @return Formatted file size
*/
static QString formatFileSize(quint64 size);
/**
* Get a string for ticket/TMD status.
* @param sig_type Signature type.
* @param sig_status Signature status.
* @return String for ticket/TMD status.
*/
static QString sigStatusString(RVL_SigType_e sig_type, RVL_SigStatus_e sig_status);
/**
* Get a string for ticket/TMD status.
* @param sig_type Signature type
* @param sig_status Signature status
* @return String for ticket/TMD status
*/
static QString sigStatusString(RVL_SigType_e sig_type, RVL_SigStatus_e sig_status);
/**
* Update the widget display.
*/
void updateWidgetDisplay(void);
/**
* Update the widget display.
*/
void updateWidgetDisplay(void);
};
BankEntryViewPrivate::BankEntryViewPrivate(BankEntryView *q)
@ -85,8 +85,8 @@ inline int BankEntryViewPrivate::calc_frac_part(quint64 size, quint64 mask)
/**
* Format a file size.
* TODO: Move to a common file so other files can use this?
* @param size File size.
* @return Formatted file size.
* @param size File size
* @return Formatted file size
*/
QString BankEntryViewPrivate::formatFileSize(quint64 size)
{
@ -152,9 +152,9 @@ QString BankEntryViewPrivate::formatFileSize(quint64 size)
/**
* Get a string for ticket/TMD status.
* @param sig_type Signature type.
* @param sig_status Signature status.
* @return String for ticket/TMD status.
* @param sig_type Signature type
* @param sig_status Signature status
* @return String for ticket/TMD status
*/
QString BankEntryViewPrivate::sigStatusString(
RVL_SigType_e sig_type, RVL_SigStatus_e sig_status)
@ -481,7 +481,7 @@ BankEntryView::~BankEntryView()
/**
* Get the RvtH_BankEntry being displayed.
* @return RvtH_BankEntry.
* @return RvtH_BankEntry
*/
const RvtH_BankEntry *BankEntryView::bankEntry(void) const
{
@ -491,7 +491,7 @@ const RvtH_BankEntry *BankEntryView::bankEntry(void) const
/**
* Set the RvtH_BankEntry being displayed.
* @param bankEntry RvtH_BankEntry.
* @param bankEntry RvtH_BankEntry
*/
void BankEntryView::setBankEntry(const RvtH_BankEntry *bankEntry)
{

View File

@ -16,40 +16,40 @@
class BankEntryViewPrivate;
class BankEntryView : public QWidget
{
Q_OBJECT
typedef QWidget super;
Q_OBJECT
typedef QWidget super;
Q_PROPERTY(const RvtH_BankEntry* bankEntry READ bankEntry WRITE setBankEntry)
Q_PROPERTY(const RvtH_BankEntry* bankEntry READ bankEntry WRITE setBankEntry)
public:
explicit BankEntryView(QWidget *parent = nullptr);
virtual ~BankEntryView();
public:
explicit BankEntryView(QWidget *parent = nullptr);
virtual ~BankEntryView();
protected:
BankEntryViewPrivate *const d_ptr;
Q_DECLARE_PRIVATE(BankEntryView)
private:
Q_DISABLE_COPY(BankEntryView)
protected:
BankEntryViewPrivate *const d_ptr;
Q_DECLARE_PRIVATE(BankEntryView)
private:
Q_DISABLE_COPY(BankEntryView)
public:
/**
* Get the RvtH_BankEntry being displayed.
* @return RvtH_BankEntry.
*/
const RvtH_BankEntry *bankEntry(void) const;
public:
/**
* Get the RvtH_BankEntry being displayed.
* @return RvtH_BankEntry
*/
const RvtH_BankEntry *bankEntry(void) const;
/**
* Set the RvtH_BankEntry being displayed.
* @param bankEntry RvtH_BankEntry.
*/
void setBankEntry(const RvtH_BankEntry *bankEntry);
/**
* Set the RvtH_BankEntry being displayed.
* @param bankEntry RvtH_BankEntry
*/
void setBankEntry(const RvtH_BankEntry *bankEntry);
/**
* Update the currently displayed RvtH_BankEntry.
*/
void update(void);
/**
* Update the currently displayed RvtH_BankEntry.
*/
void update(void);
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* LanguageMenu.cpp: QMenu subclass for selecting a UI language. *
* *
* Copyright (c) 2012-2023 by David Korth. *
* Copyright (c) 2012-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -40,43 +40,43 @@ namespace Qt {
class LanguageMenuPrivate
{
public:
explicit LanguageMenuPrivate(LanguageMenu *q);
public:
explicit LanguageMenuPrivate(LanguageMenu *q);
private:
LanguageMenu *const q_ptr;
Q_DECLARE_PUBLIC(LanguageMenu)
Q_DISABLE_COPY(LanguageMenuPrivate)
private:
LanguageMenu *const q_ptr;
Q_DECLARE_PUBLIC(LanguageMenu)
Q_DISABLE_COPY(LanguageMenuPrivate)
public:
// "System Default" language.
QAction *actLanguageSysDefault;
// Key: Locale ID; value: QAction
QHash<QString, QAction*> hashActions;
public:
// "System Default" language
QAction *actLanguageSysDefault;
// Key: Locale ID; value: QAction
QHash<QString, QAction*> hashActions;
// Action group.
QActionGroup *actgrp;
// Action group
QActionGroup *actgrp;
// Current language. (locale tag, e.g. "en_US")
// If empty, we're using the System Default language.
QString locale;
// Current language (locale tag, e.g. "en_US")
// If empty, we're using the System Default language.
QString locale;
/**
* Get an icon for a given locale.
* @param locale Locale tag, e.g. "en_US".
* @return Icon, or null QIcon if not found.
*/
static QIcon iconForLocale(const QString &locale);
/**
* Get an icon for a given locale.
* @param locale Locale tag, e.g. "en_US".
* @return Icon, or null QIcon if not found.
*/
static QIcon iconForLocale(const QString &locale);
/**
* Clear the Language Menu.
*/
void clear(void);
/**
* Clear the Language Menu.
*/
void clear(void);
/**
* Retranslate the "System Default" language action.
*/
void retranslateSystemDefault(void);
/**
* Retranslate the "System Default" language action.
*/
void retranslateSystemDefault(void);
};
LanguageMenuPrivate::LanguageMenuPrivate(LanguageMenu *q)

View File

@ -13,49 +13,49 @@
class LanguageMenuPrivate;
class LanguageMenu : public QMenu
{
Q_OBJECT
Q_OBJECT
Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged)
Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged)
public:
explicit LanguageMenu(QWidget *parent = nullptr);
LanguageMenu(const QString &title, QWidget *parent = nullptr);
virtual ~LanguageMenu();
public:
explicit LanguageMenu(QWidget *parent = nullptr);
LanguageMenu(const QString &title, QWidget *parent = nullptr);
virtual ~LanguageMenu();
private:
typedef QMenu super;
LanguageMenuPrivate *const d_ptr;
Q_DECLARE_PRIVATE(LanguageMenu)
Q_DISABLE_COPY(LanguageMenu)
private:
typedef QMenu super;
LanguageMenuPrivate *const d_ptr;
Q_DECLARE_PRIVATE(LanguageMenu)
Q_DISABLE_COPY(LanguageMenu)
public:
/**
* Get the current language.
* This will return an empty string if "System Default" is selected.
* @return Locale tag, e.g. "en_US".
*/
QString language(void) const;
public:
/**
* Get the current language.
* This will return an empty string if "System Default" is selected.
* @return Locale tag, e.g. "en_US".
*/
QString language(void) const;
public slots:
/**
* Set the current language.
* @param locale Locale to set, or empty string for system default.
* @return True if set successfully; false if not found.
*/
bool setLanguage(const QString &locale);
public slots:
/**
* Set the current language.
* @param locale Locale to set, or empty string for system default.
* @return True if set successfully; false if not found.
*/
bool setLanguage(const QString &locale);
signals:
/**
* User has selected a different language.
* LanguageMenu will automatically load the new translation.
* @param locale Locale tag, e.g. "en_US".
*/
void languageChanged(const QString &locale);
signals:
/**
* User has selected a different language.
* LanguageMenu will automatically load the new translation.
* @param locale Locale tag, e.g. "en_US".
*/
void languageChanged(const QString &locale);
protected:
/**
* Widget state has changed.
* @param event State change event.
*/
void changeEvent(QEvent *event) final;
protected:
/**
* Widget state has changed.
* @param event State change event.
*/
void changeEvent(QEvent *event) final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* MessageWidget.hpp: Message widget. *
* *
* Copyright (c) 2014-2023 by David Korth. *
* Copyright (c) 2014-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -27,56 +27,56 @@
class MessageWidgetPrivate
{
public:
explicit MessageWidgetPrivate(MessageWidget *q);
~MessageWidgetPrivate();
public:
explicit MessageWidgetPrivate(MessageWidget *q);
~MessageWidgetPrivate();
protected:
MessageWidget *const q_ptr;
Q_DECLARE_PUBLIC(MessageWidget)
private:
Q_DISABLE_COPY(MessageWidgetPrivate)
public:
struct Ui_MessageWidget {
QHBoxLayout *hboxMain;
QFrame *content;
QHBoxLayout *hboxFrame;
QLabel *lblIcon;
QLabel *lblMessage;
QToolButton *btnDismiss;
void setupUi(QWidget *MessageWidget);
};
Ui_MessageWidget ui;
/**
* Set the icon.
* @param icon Icon to set
*/
void setIcon(MessageWidget::MsgIcon icon);
/*
* Calculate the best height for the widget.
* @return Best height
*/
int calcBestHeight(void) const;
public:
// Colors
// TODO: Use system colors on KDE?
static const QRgb colorCritical = 0xEE4444;
static const QRgb colorQuestion = 0x66EE66;
static const QRgb colorWarning = 0xEECC66;
static const QRgb colorInformation = 0x66CCEE;
protected:
MessageWidget *const q_ptr;
Q_DECLARE_PUBLIC(MessageWidget)
private:
Q_DISABLE_COPY(MessageWidgetPrivate)
public:
QTimer* tmrTimeout; // Message timeout
QTimeLine* timeLine; // Animation timeline
MessageWidget::MsgIcon icon; // Icon
static const int iconSz = 22; // Icon size
bool timeout; // True if message was dismissed via timeout.
bool animateOnShow; // Animate the widget on show?
struct Ui_MessageWidget {
QHBoxLayout *hboxMain;
QFrame *content;
QHBoxLayout *hboxFrame;
QLabel *lblIcon;
QLabel *lblMessage;
QToolButton *btnDismiss;
void setupUi(QWidget *MessageWidget);
};
Ui_MessageWidget ui;
/**
* Set the icon.
* @param icon Icon to set
*/
void setIcon(MessageWidget::MsgIcon icon);
/*
* Calculate the best height for the widget.
* @return Best height
*/
int calcBestHeight(void) const;
public:
// Colors
// TODO: Use system colors on KDE?
static const QRgb colorCritical = 0xEE4444;
static const QRgb colorQuestion = 0x66EE66;
static const QRgb colorWarning = 0xEECC66;
static const QRgb colorInformation = 0x66CCEE;
public:
QTimer* tmrTimeout; // Message timeout
QTimeLine* timeLine; // Animation timeline
MessageWidget::MsgIcon icon; // Icon
static const int iconSz = 22; // Icon size
bool timeout; // True if message was dismissed via timeout.
bool animateOnShow; // Animate the widget on show?
};
MessageWidgetPrivate::MessageWidgetPrivate(MessageWidget *q)
@ -323,9 +323,9 @@ void MessageWidget::showEvent(QShowEvent *event)
/**
* Show a message.
* @param msg Message text. (supports Qt RichText formatting)
* @param icon Icon.
* @param timeout Timeout, in milliseconds. (0 for no timeout)
* @param msg Message text (supports Qt RichText formatting)
* @param icon Icon
* @param timeout Timeout, in milliseconds (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void MessageWidget::showMessage(const QString &msg, MsgIcon icon, int timeout, QObject *closeOnDestroy)
@ -397,7 +397,7 @@ void MessageWidget::tmrTimeout_timeout(void)
/**
* Animation timeline has changed.
* @param value Timeline value.
* @param value Timeline value
*/
void MessageWidget::timeLineChanged_slot(qreal value)
{

View File

@ -13,96 +13,96 @@
class MessageWidgetPrivate;
class MessageWidget : public QWidget
{
Q_OBJECT
typedef QWidget super;
Q_OBJECT
typedef QWidget super;
Q_ENUMS(MsgIcon)
Q_ENUMS(MsgIcon)
public:
explicit MessageWidget(QWidget *parent = nullptr);
virtual ~MessageWidget();
public:
explicit MessageWidget(QWidget *parent = nullptr);
virtual ~MessageWidget();
protected:
MessageWidgetPrivate *const d_ptr;
Q_DECLARE_PRIVATE(MessageWidget)
private:
Q_DISABLE_COPY(MessageWidget)
protected:
MessageWidgetPrivate *const d_ptr;
Q_DECLARE_PRIVATE(MessageWidget)
private:
Q_DISABLE_COPY(MessageWidget)
public:
/**
* Icon types.
*/
enum MsgIcon {
ICON_NONE,
ICON_CRITICAL,
ICON_QUESTION,
ICON_WARNING,
ICON_INFORMATION,
public:
/**
* Icon types
*/
enum MsgIcon {
ICON_NONE,
ICON_CRITICAL,
ICON_QUESTION,
ICON_WARNING,
ICON_INFORMATION,
ICON_MAX
};
ICON_MAX
};
protected:
/**
* Paint event.
* @param event QPaintEvent.
*/
void paintEvent(QPaintEvent *event) final;
protected:
/**
* Paint event.
* @param event QPaintEvent.
*/
void paintEvent(QPaintEvent *event) final;
/**
* Hide event.
* @param event QHideEvent.
*/
void showEvent(QShowEvent *event) final;
/**
* Hide event.
* @param event QHideEvent.
*/
void showEvent(QShowEvent *event) final;
public slots:
/**
* Show a message.
* @param msg Message text. (supports Qt RichText formatting)
* @param icon Icon.
* @param timeout Timeout, in milliseconds. (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void showMessage(const QString &msg, MsgIcon icon, int timeout = 0, QObject *closeOnDestroy = nullptr);
public slots:
/**
* Show a message.
* @param msg Message text (supports Qt RichText formatting)
* @param icon Icon
* @param timeout Timeout, in milliseconds (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void showMessage(const QString &msg, MsgIcon icon, int timeout = 0, QObject *closeOnDestroy = nullptr);
/**
* Show the MessageWidget using animation.
* NOTE: You should probably use showMessage()!
*/
void showAnimated(void);
/**
* Show the MessageWidget using animation.
* NOTE: You should probably use showMessage()!
*/
void showAnimated(void);
/**
* Hide the MessageWidget using animation.
*/
void hideAnimated(void);
/**
* Hide the MessageWidget using animation.
*/
void hideAnimated(void);
protected slots:
/**
* Message timer has expired.
*/
void tmrTimeout_timeout(void);
protected slots:
/**
* Message timer has expired.
*/
void tmrTimeout_timeout(void);
/**
* Animation timeline has changed.
* @param value Timeline value.
*/
void timeLineChanged_slot(qreal value);
/**
* Animation timeline has changed.
* @param value Timeline value
*/
void timeLineChanged_slot(qreal value);
/**
* Animation timeline has finished.
*/
void timeLineFinished_slot(void);
/**
* Animation timeline has finished.
*/
void timeLineFinished_slot(void);
/**
* "Dismiss" button has been clicked.
*/
void on_btnDismiss_clicked(void);
/**
* "Dismiss" button has been clicked.
*/
void on_btnDismiss_clicked(void);
signals:
/**
* Message has been dismissed,
* either manually or via timeout.
* @param timeout True if the message time out.
*/
void dismissed(bool timeout);
signals:
/**
* Message has been dismissed,
* either manually or via timeout.
* @param timeout True if the message timed out.
*/
void dismissed(bool timeout);
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* MessageWidgetStack.hpp: Message widget stack. *
* *
* Copyright (c) 2014-2023 by David Korth. *
* Copyright (c) 2014-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -21,26 +21,26 @@
class MessageWidgetStackPrivate
{
public:
explicit MessageWidgetStackPrivate(MessageWidgetStack *q);
~MessageWidgetStackPrivate();
public:
explicit MessageWidgetStackPrivate(MessageWidgetStack *q);
~MessageWidgetStackPrivate();
protected:
MessageWidgetStack *const q_ptr;
Q_DECLARE_PUBLIC(MessageWidgetStack)
private:
Q_DISABLE_COPY(MessageWidgetStackPrivate)
protected:
MessageWidgetStack *const q_ptr;
Q_DECLARE_PUBLIC(MessageWidgetStack)
private:
Q_DISABLE_COPY(MessageWidgetStackPrivate)
public:
struct Ui_MessageWidgetStack {
QVBoxLayout *vboxMain;
public:
struct Ui_MessageWidgetStack {
QVBoxLayout *vboxMain;
void setupUi(QWidget *MessageWidgetStack);
};
Ui_MessageWidgetStack ui;
void setupUi(QWidget *MessageWidgetStack);
};
Ui_MessageWidgetStack ui;
// All active MessageWidgets.
std::set<MessageWidget*> messageWidgets;
// All active MessageWidgets
std::set<MessageWidget*> messageWidgets;
};
MessageWidgetStackPrivate::MessageWidgetStackPrivate(MessageWidgetStack *q)
@ -89,9 +89,9 @@ MessageWidgetStack::~MessageWidgetStack()
/**
* Show a message.
* @param msg Message text. (supports Qt RichText formatting)
* @param icon Icon.
* @param timeout Timeout, in milliseconds. (0 for no timeout)
* @param msg Message text (supports Qt RichText formatting)
* @param icon Icon
* @param timeout Timeout, in milliseconds (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void MessageWidgetStack::showMessage(const QString &msg, MessageWidget::MsgIcon icon, int timeout, QObject *closeOnDestroy)
@ -123,7 +123,7 @@ void MessageWidgetStack::showMessage(const QString &msg, MessageWidget::MsgIcon
/**
* A MessageWidget has been destroyed.
* @param obj QObject that was destroyed.
* @param obj QObject that was destroyed
*/
void MessageWidgetStack::messageWidget_destroyed_slot(QObject *obj)
{

View File

@ -14,33 +14,33 @@
class MessageWidgetStackPrivate;
class MessageWidgetStack : public QWidget
{
Q_OBJECT
typedef QWidget super;
Q_OBJECT
typedef QWidget super;
public:
explicit MessageWidgetStack(QWidget *parent = 0);
virtual ~MessageWidgetStack();
public:
explicit MessageWidgetStack(QWidget *parent = 0);
virtual ~MessageWidgetStack();
protected:
MessageWidgetStackPrivate *const d_ptr;
Q_DECLARE_PRIVATE(MessageWidgetStack)
private:
Q_DISABLE_COPY(MessageWidgetStack)
protected:
MessageWidgetStackPrivate *const d_ptr;
Q_DECLARE_PRIVATE(MessageWidgetStack)
private:
Q_DISABLE_COPY(MessageWidgetStack)
public:
/**
* Show a message.
* @param msg Message text. (supports Qt RichText formatting)
* @param icon Icon.
* @param timeout Timeout, in milliseconds. (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void showMessage(const QString &msg, MessageWidget::MsgIcon icon, int timeout = 0, QObject *closeOnDestroy = 0);
public:
/**
* Show a message.
* @param msg Message text (supports Qt RichText formatting)
* @param icon Icon
* @param timeout Timeout, in milliseconds (0 for no timeout)
* @param closeOnDestroy Close the message when the specified QObject is destroyed.
*/
void showMessage(const QString &msg, MessageWidget::MsgIcon icon, int timeout = 0, QObject *closeOnDestroy = 0);
protected slots:
/**
* A MessageWidget has been destroyed.
* @param obj QObject that was destroyed.
*/
void messageWidget_destroyed_slot(QObject *obj);
protected slots:
/**
* A MessageWidget has been destroyed.
* @param obj QObject that was destroyed
*/
void messageWidget_destroyed_slot(QObject *obj);
};

View File

@ -20,47 +20,55 @@
class QListView_Text : public QListView
{
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QListView super;
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QListView super;
public:
QListView_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left) { }
public:
QListView_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left)
{ }
private:
Q_DISABLE_COPY(QListView_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
private:
Q_DISABLE_COPY(QListView_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QStyleOptionViewItem viewOptions(void) const final;
QStyleOptionViewItem viewOptions(void) const final;
#endif
public:
inline QString noItemText(void) const { return m_noItemText; }
void setNoItemText(const QString &noItemText);
public:
inline QString noItemText(void) const
{
return m_noItemText;
}
void setNoItemText(const QString &noItemText);
inline QStyleOptionViewItem::Position decorationPosition(void) const { return m_decorationPosition; }
void setDecorationPosition(QStyleOptionViewItem::Position position);
inline QStyleOptionViewItem::Position decorationPosition(void) const
{
return m_decorationPosition;
}
void setDecorationPosition(QStyleOptionViewItem::Position position);
};
class QListWidget_Text : public QListWidget
{
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QListWidget super;
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QListWidget super;
public:
QListWidget_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left) { }
public:
QListWidget_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left)
{ }
private:
Q_DISABLE_COPY(QListWidget_Text)
@ -74,74 +82,94 @@ class QListWidget_Text : public QListWidget
QStyleOptionViewItem viewOptions(void) const final;
#endif
public:
inline QString noItemText(void) const { return m_noItemText; }
void setNoItemText(const QString &noItemText);
public:
inline QString noItemText(void) const
{
return m_noItemText;
}
void setNoItemText(const QString &noItemText);
inline QStyleOptionViewItem::Position decorationPosition(void) const { return m_decorationPosition; }
void setDecorationPosition(QStyleOptionViewItem::Position position);
inline QStyleOptionViewItem::Position decorationPosition(void) const
{
return m_decorationPosition;
}
void setDecorationPosition(QStyleOptionViewItem::Position position);
};
class QTreeView_Text : public QTreeView
{
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QTreeView super;
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QTreeView super;
public:
QTreeView_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left) { }
public:
QTreeView_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left)
{ }
private:
Q_DISABLE_COPY(QTreeView_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
private:
Q_DISABLE_COPY(QTreeView_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QStyleOptionViewItem viewOptions(void) const final;
QStyleOptionViewItem viewOptions(void) const final;
#endif
public:
inline QString noItemText(void) const { return m_noItemText; }
void setNoItemText(const QString &noItemText);
public:
inline QString noItemText(void) const
{
return m_noItemText;
}
void setNoItemText(const QString &noItemText);
inline QStyleOptionViewItem::Position decorationPosition(void) const { return m_decorationPosition; }
void setDecorationPosition(QStyleOptionViewItem::Position position);
inline QStyleOptionViewItem::Position decorationPosition(void) const
{
return m_decorationPosition;
}
void setDecorationPosition(QStyleOptionViewItem::Position position);
};
class QTreeWidget_Text : public QTreeWidget
{
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QTreeWidget super;
Q_OBJECT
Q_PROPERTY(QString noItemText READ noItemText WRITE setNoItemText)
Q_PROPERTY(QStyleOptionViewItem::Position decorationPosition READ decorationPosition WRITE setDecorationPosition)
typedef QTreeWidget super;
public:
QTreeWidget_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left) { }
public:
QTreeWidget_Text(QWidget *parent = nullptr)
: super(parent)
, m_decorationPosition(QStyleOptionViewItem::Left)
{ }
private:
Q_DISABLE_COPY(QTreeWidget_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
private:
Q_DISABLE_COPY(QTreeWidget_Text)
QString m_noItemText;
QStyleOptionViewItem::Position m_decorationPosition;
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
protected:
void paintEvent(QPaintEvent *e) final;
// FIXME: Qt6's viewOptions() is final.
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QStyleOptionViewItem viewOptions(void) const final;
QStyleOptionViewItem viewOptions(void) const final;
#endif
public:
inline QString noItemText(void) const { return m_noItemText; }
void setNoItemText(const QString &noItemText);
public:
inline QString noItemText(void) const
{
return m_noItemText;
}
void setNoItemText(const QString &noItemText);
inline QStyleOptionViewItem::Position decorationPosition(void) const { return m_decorationPosition; }
void setDecorationPosition(QStyleOptionViewItem::Position position);
inline QStyleOptionViewItem::Position decorationPosition(void) const
{
return m_decorationPosition;
}
void setDecorationPosition(QStyleOptionViewItem::Position position);
};

View File

@ -16,20 +16,20 @@ class QFocusEvent;
class QTreeViewOpt : public QTreeView
{
Q_OBJECT
typedef QTreeView super;
Q_OBJECT
typedef QTreeView super;
public:
explicit QTreeViewOpt(QWidget *parent = nullptr);
public:
explicit QTreeViewOpt(QWidget *parent = nullptr);
private:
Q_DISABLE_COPY(QTreeViewOpt);
private:
Q_DISABLE_COPY(QTreeViewOpt);
public:
void dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles = QVector<int>()) final;
public:
void dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles = QVector<int>()) final;
protected slots:
void showColumnContextMenu(const QPoint &point);
protected slots:
void showColumnContextMenu(const QPoint &point);
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* AboutDialog.cpp: About Dialog. *
* *
* Copyright (c) 2013-2024 by David Korth. *
* Copyright (c) 2013-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -39,37 +39,39 @@ static const QChar chrBullet(0x2022); // U+2022: BULLET
#include "ui_AboutDialog.h"
class AboutDialogPrivate
{
public:
explicit AboutDialogPrivate(AboutDialog *q);
public:
explicit AboutDialogPrivate(AboutDialog *q);
protected:
AboutDialog *const q_ptr;
Q_DECLARE_PUBLIC(AboutDialog)
private:
Q_DISABLE_COPY(AboutDialogPrivate)
protected:
AboutDialog *const q_ptr;
Q_DECLARE_PUBLIC(AboutDialog)
private:
Q_DISABLE_COPY(AboutDialogPrivate)
public:
Ui::AboutDialog ui;
public:
Ui::AboutDialog ui;
bool scrlAreaInit;
bool scrlAreaInit;
// Initialize the About Dialog text.
void initAboutDialogText(void);
/**
* Initialize the About Dialog text.
*/
void initAboutDialogText(void);
/**
* Initialize the "Credits" tab.
*/
void initCreditsTab(void);
/**
* Initialize the "Credits" tab.
*/
void initCreditsTab(void);
/**
* Initialize the "Libraries" tab.
*/
void initLibrariesTab(void);
/**
* Initialize the "Libraries" tab.
*/
void initLibrariesTab(void);
/**
* Initialize the "Support" tab.
*/
void initSupportTab(void);
/**
* Initialize the "Support" tab.
*/
void initSupportTab(void);
};
AboutDialogPrivate::AboutDialogPrivate(AboutDialog* q)

View File

@ -16,20 +16,20 @@ class QWidget;
class AboutDialogPrivate;
class AboutDialog : public QDialog
{
Q_OBJECT
typedef QDialog super;
Q_OBJECT
typedef QDialog super;
public:
explicit AboutDialog(QWidget *parent = nullptr);
virtual ~AboutDialog();
public:
explicit AboutDialog(QWidget *parent = nullptr);
virtual ~AboutDialog();
protected:
AboutDialogPrivate *const d_ptr;
Q_DECLARE_PRIVATE(AboutDialog)
private:
Q_DISABLE_COPY(AboutDialog)
protected:
AboutDialogPrivate *const d_ptr;
Q_DECLARE_PRIVATE(AboutDialog)
private:
Q_DISABLE_COPY(AboutDialog)
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* QRvtHToolWindow.cpp: Main window. *
* *
* Copyright (c) 2018-2023 by David Korth. *
* Copyright (c) 2018-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -55,121 +55,121 @@
#include "ui_QRvtHToolWindow.h"
class QRvtHToolWindowPrivate
{
public:
explicit QRvtHToolWindowPrivate(QRvtHToolWindow *q);
~QRvtHToolWindowPrivate();
public:
explicit QRvtHToolWindowPrivate(QRvtHToolWindow *q);
~QRvtHToolWindowPrivate();
protected:
QRvtHToolWindow *const q_ptr;
Q_DECLARE_PUBLIC(QRvtHToolWindow)
private:
Q_DISABLE_COPY(QRvtHToolWindowPrivate)
protected:
QRvtHToolWindow *const q_ptr;
Q_DECLARE_PUBLIC(QRvtHToolWindow)
private:
Q_DISABLE_COPY(QRvtHToolWindowPrivate)
public:
Ui::QRvtHToolWindow ui;
public:
Ui::QRvtHToolWindow ui;
// About dialog
AboutDialog *aboutDialog;
// About dialog
AboutDialog *aboutDialog;
// RVT-H Reader disk image
RvtH *rvth;
RvtHModel *model;
RvtHSortFilterProxyModel *proxyModel;
// RVT-H Reader disk image
RvtH *rvth;
RvtHModel *model;
RvtHSortFilterProxyModel *proxyModel;
// Filename.
QString filename;
// Filename
QString filename;
// TODO: Config class like mcrecover?
QString lastPath;
// TODO: Config class like mcrecover?
QString lastPath;
// NHCD table status for the frame title.
QString nhcd_status;
// NHCD table status for the frame title
QString nhcd_status;
// Last icon ID.
RvtHModel::IconID lastIconID;
// Last icon ID
RvtHModel::IconID lastIconID;
// Initialized columns?
bool cols_init;
// Initialized columns?
bool cols_init;
// Enable write operations?
// Should be enabled for RVT-H Readers with valid
// NHCD tables and disabled otherwise.
bool write_enabled;
// Enable write operations?
// Should be enabled for RVT-H Readers with valid
// NHCD tables and disabled otherwise.
bool write_enabled;
/**
* Update the RVT-H Reader disk image's QTreeView.
*/
void updateLstBankList(void);
/**
* Update the RVT-H Reader disk image's QTreeView.
*/
void updateLstBankList(void);
/**
* Update the "enabled" status of the QActions.
*/
void updateActionEnableStatus(void);
/**
* Update the "enabled" status of the QActions.
*/
void updateActionEnableStatus(void);
/**
* Update the window title.
*/
void updateWindowTitle(void);
/**
* Update the window title.
*/
void updateWindowTitle(void);
/**
* Get the display filename for the given filename.
*
* This removes the directories and returns only the filename,
* except in the case of device files.
*
* @param filename Full filename.
* @return Display filename.
*/
static QString getDisplayFilename(const QString &filename);
/**
* Get the display filename for the given filename.
*
* This removes the directories and returns only the filename,
* except in the case of device files.
*
* @param filename Full filename.
* @return Display filename.
*/
static QString getDisplayFilename(const QString &filename);
public:
/**
* Initialize the toolbar.
*/
void initToolbar(void);
public:
/**
* Initialize the toolbar.
*/
void initToolbar(void);
/**
* Retranslate the toolbar.
*/
void retranslateToolbar(void);
/**
* Retranslate the toolbar.
*/
void retranslateToolbar(void);
// Recryption Key widgets.
QLabel *lblRecryptionKey;
QComboBox *cboRecryptionKey;
// Recryption Key widgets
QLabel *lblRecryptionKey;
QComboBox *cboRecryptionKey;
public:
// Status bar widgets.
QLabel *lblMessage;
QToolButton *btnCancel;
QProgressBar *progressBar;
public:
// Status bar widgets
QLabel *lblMessage;
QToolButton *btnCancel;
QProgressBar *progressBar;
// Worker thread.
QThread *workerThread;
WorkerObject *workerObject;
// Worker thread
QThread *workerThread;
WorkerObject *workerObject;
// UI busy counter
int uiBusyCounter;
// UI busy counter
int uiBusyCounter;
// Taskbar Button Manager.
TaskbarButtonManager *taskbarButtonManager;
// Taskbar Button Manager
TaskbarButtonManager *taskbarButtonManager;
public:
// Update status.
bool updateStatus_didInitialUpdate;
int updateStatus_bank;
public:
// Update status
bool updateStatus_didInitialUpdate;
int updateStatus_bank;
public:
/**
* Get the selected bank number.
* @return Bank number, or -1 if no banks are selected.
*/
int selectedBankNumber(void) const;
public:
/**
* Get the selected bank number.
* @return Bank number, or -1 if no banks are selected.
*/
int selectedBankNumber(void) const;
/**
* Get the selected bank entry.
* @return Bank entry, or nullptr if no banks are selected.
*/
const RvtH_BankEntry *selectedBankEntry(void) const;
/**
* Get the selected bank entry.
* @return Bank entry, or nullptr if no banks are selected.
*/
const RvtH_BankEntry *selectedBankEntry(void) const;
};
QRvtHToolWindowPrivate::QRvtHToolWindowPrivate(QRvtHToolWindow *q)
@ -1380,9 +1380,9 @@ void QRvtHToolWindow::lstBankList_selectionModel_selectionChanged(
/**
* Update the status bar.
* @param text Status bar text.
* @param progress_value Progress bar value. (If -1, ignore this.)
* @param progress_max Progress bar maximum. (If -1, ignore this.)
* @param text Status bar text
* @param progress_value Progress bar value (If -1, ignore this.)
* @param progress_max Progress bar maximum (If -1, ignore this.)
*/
void QRvtHToolWindow::workerObject_updateStatus(const QString &text, int progress_value, int progress_max)
{
@ -1413,8 +1413,8 @@ void QRvtHToolWindow::workerObject_updateStatus(const QString &text, int progres
/**
* Process is finished.
* @param text Status bar text.
* @param err Error code. (0 on success)
* @param text Status bar text
* @param err Error code (0 on success)
*/
void QRvtHToolWindow::workerObject_finished(const QString &text, int err)
{

View File

@ -14,100 +14,100 @@ class QItemSelection;
class QRvtHToolWindowPrivate;
class QRvtHToolWindow : public QMainWindow
{
Q_OBJECT
typedef QMainWindow super;
Q_OBJECT
typedef QMainWindow super;
public:
explicit QRvtHToolWindow(QWidget *parent = nullptr);
virtual ~QRvtHToolWindow();
public:
explicit QRvtHToolWindow(QWidget *parent = nullptr);
virtual ~QRvtHToolWindow();
protected:
QRvtHToolWindowPrivate *const d_ptr;
Q_DECLARE_PRIVATE(QRvtHToolWindow)
private:
Q_DISABLE_COPY(QRvtHToolWindow)
protected:
QRvtHToolWindowPrivate *const d_ptr;
Q_DECLARE_PRIVATE(QRvtHToolWindow)
private:
Q_DISABLE_COPY(QRvtHToolWindow)
public:
/**
* Open an RVT-H Reader disk image.
* @param filename Filename (using NATIVE separators)
* @param isDevice True if opened using SelectDeviceDialog
*/
void openRvtH(const QString &filename, bool isDevice);
public:
/**
* Open an RVT-H Reader disk image.
* @param filename Filename
* @param isDevice True if opened using SelectDeviceDialog
*/
void openRvtH(const QString &filename, bool isDevice);
/**
* Close the currently-opened RVT-H Reader disk image.
*/
void closeRvtH(void);
/**
* Close the currently-opened RVT-H Reader disk image.
*/
void closeRvtH(void);
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
// Window show event.
void showEvent(QShowEvent *event) final;
// Window show event.
void showEvent(QShowEvent *event) final;
// Window close event.
void closeEvent(QCloseEvent *event) final;
// Window close event.
void closeEvent(QCloseEvent *event) final;
#ifdef Q_OS_WIN
// Windows message handler. Used for TaskbarButtonManager.
// Windows message handler. Used for TaskbarButtonManager.
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) final;
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) final;
# else /* QT_VERSION < QT_VERSION_CHECK(6, 0, 0) */
bool nativeEvent(const QByteArray &eventType, void *message, long *result) final;
bool nativeEvent(const QByteArray &eventType, void *message, long *result) final;
# endif /* QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) */
#endif /* Q_OS_WIN */
protected slots:
// UI busy functions
void markUiBusy(void);
void markUiNotBusy(void);
protected slots:
// UI busy functions
void markUiBusy(void);
void markUiNotBusy(void);
protected slots:
/** UI widget slots **/
protected slots:
/** UI widget slots **/
// Actions
void on_actionOpenDiskImage_triggered(void);
void on_actionOpenDevice_triggered(void);
void on_actionClose_triggered(void);
void on_actionExit_triggered(void);
void on_actionAbout_triggered(void);
// Actions
void on_actionOpenDiskImage_triggered(void);
void on_actionOpenDevice_triggered(void);
void on_actionClose_triggered(void);
void on_actionExit_triggered(void);
void on_actionAbout_triggered(void);
// RVT-H disk image actions
void on_actionExtract_triggered(void);
void on_actionImport_triggered(void);
void on_actionDelete_triggered(void);
void on_actionUndelete_triggered(void);
// RVT-H disk image actions
void on_actionExtract_triggered(void);
void on_actionImport_triggered(void);
void on_actionDelete_triggered(void);
void on_actionUndelete_triggered(void);
// RvtHModel slots
void rvthModel_layoutChanged(void);
void rvthModel_rowsInserted(void);
// RvtHModel slots
void rvthModel_layoutChanged(void);
void rvthModel_rowsInserted(void);
// lstBankList slots
void lstBankList_selectionModel_selectionChanged(
const QItemSelection& selected, const QItemSelection& deselected);
// lstBankList slots
void lstBankList_selectionModel_selectionChanged(
const QItemSelection& selected, const QItemSelection& deselected);
protected slots:
/** Worker object slots **/
protected slots:
/** Worker object slots **/
/**
* Update the status bar.
* @param text Status bar text.
* @param progress_value Progress bar value. (If -1, ignore this.)
* @param progress_max Progress bar maximum. (If -1, ignore this.)
*/
void workerObject_updateStatus(const QString &text, int progress_value, int progress_max);
/**
* Update the status bar.
* @param text Status bar text
* @param progress_value Progress bar value (If -1, ignore this.)
* @param progress_max Progress bar maximum (If -1, ignore this.)
*/
void workerObject_updateStatus(const QString &text, int progress_value, int progress_max);
/**
* Process is finished.
* @param text Status bar text.
* @param err Error code. (0 on success)
*/
void workerObject_finished(const QString &text, int err);
/**
* Process is finished.
* @param text Status bar text
* @param err Error code (0 on success)
*/
void workerObject_finished(const QString &text, int err);
/**
* Cancel button was pressed.
*/
void btnCancel_clicked(void);
/**
* Cancel button was pressed.
*/
void btnCancel_clicked(void);
};

View File

@ -2,7 +2,7 @@
* RVT-H Tool (qrvthtool) *
* SelectDeviceDialog.hpp: Select an RVT-H Reader device. *
* *
* Copyright (c) 2018-2023 by David Korth. *
* Copyright (c) 2018-2025 by David Korth. *
* SPDX-License-Identifier: GPL-2.0-or-later *
***************************************************************************/
@ -35,71 +35,71 @@
#include "ui_SelectDeviceDialog.h"
class SelectDeviceDialogPrivate
{
public:
explicit SelectDeviceDialogPrivate(SelectDeviceDialog *q);
~SelectDeviceDialogPrivate();
public:
explicit SelectDeviceDialogPrivate(SelectDeviceDialog *q);
~SelectDeviceDialogPrivate();
protected:
SelectDeviceDialog *const q_ptr;
Q_DECLARE_PUBLIC(SelectDeviceDialog)
private:
Q_DISABLE_COPY(SelectDeviceDialogPrivate)
protected:
SelectDeviceDialog *const q_ptr;
Q_DECLARE_PUBLIC(SelectDeviceDialog)
private:
Q_DISABLE_COPY(SelectDeviceDialogPrivate)
public:
Ui::SelectDeviceDialog ui;
public:
Ui::SelectDeviceDialog ui;
// RVT-H Reader icon
QIcon rvthReaderIcon;
// RVT-H Reader icon
QIcon rvthReaderIcon;
// Selected device
DeviceQueryData *sel_device;
// Selected device
DeviceQueryData *sel_device;
// Device information
QList<DeviceQueryData> lstQueryData;
// Device information
QList<DeviceQueryData> lstQueryData;
// Device listener
RvtH_ListenForDevices *listener;
// Device listener
RvtH_ListenForDevices *listener;
#ifdef _WIN32
HDEVNOTIFY hDeviceNotify;
HDEVNOTIFY hDeviceNotify;
#endif /* _WIN32 */
private:
static inline int calc_frac_part(int64_t size, int64_t mask);
private:
static inline int calc_frac_part(int64_t size, int64_t mask);
/**
* Format a block device size.
* @param size [in] Block device size.
* @return Formatted block device size.
*/
static QString format_size(int64_t size);
/**
* Format a block device size.
* @param size [in] Block device size
* @return Formatted block device size.
*/
static QString format_size(int64_t size);
/**
* Add a device to the list.
* @param queryData DeviceQueryData
*/
void addDevice(const DeviceQueryData &queryData);
/**
* Add a device to the list.
* @param queryData DeviceQueryData
*/
void addDevice(const DeviceQueryData &queryData);
public:
// Refresh the device list.
void refreshDeviceList(void);
public:
// Refresh the device list.
void refreshDeviceList(void);
/**
* RvtH device listener callback.
* @param listener Listener
* @param entry Device that was added/removed (if removed, only contains device name)
* @param state Device state (see RvtH_Listen_State_e)
* @param userdata User data specified on initialization
*
* NOTE: query's data is not guaranteed to remain valid once the
* callback function returns. Copy everything out immediately!
*
* NOTE: On RVTH_LISTEN_DISCONNECTED, only query->device_name is set.
* udev doesn't seem to let us get the correct USB parent device, so
* the callback function will need to verify that query->device_name
* is a previously-received RVT-H Reader device.
*/
static void rvth_listener_callback(RvtH_ListenForDevices *listener,
const RvtH_QueryEntry *entry, RvtH_Listen_State_e state, void *userdata);
/**
* RvtH device listener callback.
* @param listener Listener
* @param entry Device that was added/removed (if removed, only contains device name)
* @param state Device state (see RvtH_Listen_State_e)
* @param userdata User data specified on initialization
*
* NOTE: query's data is not guaranteed to remain valid once the
* callback function returns. Copy everything out immediately!
*
* NOTE: On RVTH_LISTEN_DISCONNECTED, only query->device_name is set.
* udev doesn't seem to let us get the correct USB parent device, so
* the callback function will need to verify that query->device_name
* is a previously-received RVT-H Reader device.
*/
static void rvth_listener_callback(RvtH_ListenForDevices *listener,
const RvtH_QueryEntry *entry, RvtH_Listen_State_e state, void *userdata);
};
SelectDeviceDialogPrivate::SelectDeviceDialogPrivate(SelectDeviceDialog *q)
@ -144,7 +144,7 @@ inline int SelectDeviceDialogPrivate::calc_frac_part(int64_t size, int64_t mask)
/**
* Format a block device size.
* @param size [in] Block device size.
* @param size [in] Block device size
* @return Formatted block device size.
*/
QString SelectDeviceDialogPrivate::format_size(int64_t size)

View File

@ -32,119 +32,121 @@ static inline QString qsFromTCHAR(const TCHAR *str)
}
class DeviceQueryData {
public:
QString device_name; // Device name, e.g. "/dev/sdc" or "\\.\PhysicalDrive3".
public:
QString device_name; // Device name, e.g. "/dev/sdc" or "\\.\PhysicalDrive3".
QString usb_vendor; // USB vendor name.
QString usb_product; // USB product name.
QString usb_serial; // USB serial number, in ASCII.
QString usb_vendor; // USB vendor name.
QString usb_product; // USB product name.
QString usb_serial; // USB serial number, in ASCII.
QString hdd_vendor; // HDD vendor.
QString hdd_model; // HDD model number.
QString hdd_fwver; // HDD firmware version.
QString hdd_vendor; // HDD vendor.
QString hdd_model; // HDD model number.
QString hdd_fwver; // HDD firmware version.
#ifdef RVTH_QUERY_ENABLE_HDD_SERIAL
QString hdd_serial; // HDD serial number, in ASCII.
QString hdd_serial; // HDD serial number, in ASCII.
#endif /* RVTH_QUERY_ENABLE_HDD_SERIAL */
uint64_t size; // HDD size, in bytes.
uint64_t size; // HDD size, in bytes.
public:
DeviceQueryData() : size(0) { }
public:
DeviceQueryData()
: size(0)
{ }
DeviceQueryData(const RvtH_QueryEntry *entry)
: device_name(qsFromTCHAR(entry->device_name))
, usb_vendor(qsFromTCHAR(entry->usb_vendor))
, usb_product(qsFromTCHAR(entry->usb_product))
, usb_serial(qsFromTCHAR(entry->usb_serial))
, hdd_vendor(qsFromTCHAR(entry->hdd_vendor))
, hdd_model(qsFromTCHAR(entry->hdd_model))
, hdd_fwver(qsFromTCHAR(entry->hdd_fwver))
DeviceQueryData(const RvtH_QueryEntry *entry)
: device_name(qsFromTCHAR(entry->device_name))
, usb_vendor(qsFromTCHAR(entry->usb_vendor))
, usb_product(qsFromTCHAR(entry->usb_product))
, usb_serial(qsFromTCHAR(entry->usb_serial))
, hdd_vendor(qsFromTCHAR(entry->hdd_vendor))
, hdd_model(qsFromTCHAR(entry->hdd_model))
, hdd_fwver(qsFromTCHAR(entry->hdd_fwver))
#ifdef RVTH_QUERY_ENABLE_HDD_SERIAL
, hdd_serial(qsFromTCHAR(entry->hdd_serial))
, hdd_serial(qsFromTCHAR(entry->hdd_serial))
#endif /* RVTH_QUERY_ENABLE_HDD_SERIAL */
, size(entry->size)
{ }
, size(entry->size)
{ }
};
Q_DECLARE_METATYPE(DeviceQueryData)
class SelectDeviceDialogPrivate;
class SelectDeviceDialog : public QDialog
{
Q_OBJECT
typedef QDialog super;
Q_OBJECT
typedef QDialog super;
public:
explicit SelectDeviceDialog(QWidget *parent = nullptr);
virtual ~SelectDeviceDialog();
public:
explicit SelectDeviceDialog(QWidget *parent = nullptr);
virtual ~SelectDeviceDialog();
protected:
SelectDeviceDialogPrivate *const d_ptr;
Q_DECLARE_PRIVATE(SelectDeviceDialog)
private:
Q_DISABLE_COPY(SelectDeviceDialog)
protected:
SelectDeviceDialogPrivate *const d_ptr;
Q_DECLARE_PRIVATE(SelectDeviceDialog)
private:
Q_DISABLE_COPY(SelectDeviceDialog)
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
protected:
// State change event. (Used for switching the UI language at runtime.)
void changeEvent(QEvent *event) final;
#ifdef _WIN32
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
typedef qintptr native_event_result_t;
typedef qintptr native_event_result_t;
#else /* QT_VERSION < QT_VERSION_CHECK(6,0,0) */
typedef long native_event_result_t;
typedef long native_event_result_t;
#endif /* QT_VERSION >= QT_VERSION_CHECK(6,0,0) */
/**
* Native event
* @param eventType
* @param message
* @param result
* @return
*/
bool nativeEvent(const QByteArray &eventType, void *message,
native_event_result_t *result) final;
/**
* Native event
* @param eventType
* @param message
* @param result
* @return
*/
bool nativeEvent(const QByteArray &eventType, void *message,
native_event_result_t *result) final;
#endif /* _WIN32 */
public:
/** Properties **/
public:
/** Properties **/
/**
* Get the selected RVT-H Reader device name.
* @return Device name, or empty string if not selected.
*/
QString deviceName(void) const;
/**
* Get the selected RVT-H Reader device name.
* @return Device name, or empty string if not selected.
*/
QString deviceName(void) const;
/**
* Get the selected RVT-H Reader serial number.
* @return Serial number, or empty string if not selected.
*/
QString serialNumber(void) const;
/**
* Get the selected RVT-H Reader serial number.
* @return Serial number, or empty string if not selected.
*/
QString serialNumber(void) const;
/**
* Get the selected RVT-H Reader HDD size.
* @return HDD size (in bytes), or 0 if not selected.
*/
int64_t hddSize(void) const;
/**
* Get the selected RVT-H Reader HDD size.
* @return HDD size (in bytes), or 0 if not selected.
*/
int64_t hddSize(void) const;
protected slots:
/** UI widget slots **/
protected slots:
/** UI widget slots **/
// QDialog slots
void accept(void) final;
void reject(void) final;
void done(int r) final;
void refresh(void);
// QDialog slots
void accept(void) final;
void reject(void) final;
void done(int r) final;
void refresh(void);
// lstDevices slots
void lstDevices_selectionModel_selectionChanged(
const QItemSelection& selected, const QItemSelection& deselected);
void on_lstDevices_doubleClicked(const QModelIndex &index);
// lstDevices slots
void lstDevices_selectionModel_selectionChanged(
const QItemSelection& selected, const QItemSelection& deselected);
void on_lstDevices_doubleClicked(const QModelIndex &index);
/**
* A device state has changed.
* @param queryData Device query data
* @param state Device state
*/
void deviceStateChanged(const DeviceQueryData &queryData, RvtH_Listen_State_e state);
/**
* A device state has changed.
* @param queryData Device query data
* @param state Device state
*/
void deviceStateChanged(const DeviceQueryData &queryData, RvtH_Listen_State_e state);
};