migrate to Qt6
This commit is contained in:
		@@ -62,7 +62,7 @@ void BackupItem::removeEntry()
 | 
			
		||||
    emit deleteEntry(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const QPixmap *BackupItem::getIconPixmap()
 | 
			
		||||
const QPixmap BackupItem::getIconPixmap()
 | 
			
		||||
{
 | 
			
		||||
    return ui->itemPicture->pixmap();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ public:
 | 
			
		||||
    void setItemInfo(const QString &name, const QString &size, const QString &extra);
 | 
			
		||||
    void setItemIcon(const QString &m_path, int width = 48, bool try_dds = false);
 | 
			
		||||
    void setDirectory(const QString &m_path);
 | 
			
		||||
    const QPixmap *getIconPixmap();
 | 
			
		||||
    const QPixmap getIconPixmap();
 | 
			
		||||
    int getIconWidth();
 | 
			
		||||
    QString getPath();
 | 
			
		||||
    QString getSize();
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,6 @@
 | 
			
		||||
 | 
			
		||||
#include "backupmanagerform.h"
 | 
			
		||||
#include "ui_backupmanagerform.h"
 | 
			
		||||
#include "cmaobject.h"
 | 
			
		||||
#include "sforeader.h"
 | 
			
		||||
#include "confirmdialog.h"
 | 
			
		||||
#include "cmautils.h"
 | 
			
		||||
@@ -90,7 +89,7 @@ void BackupManagerForm::removeEntry(BackupItem *item)
 | 
			
		||||
    ConfirmDialog msgBox;
 | 
			
		||||
 | 
			
		||||
    msgBox.setMessageText(tr("Are you sure to remove the backup of the following entry?"), item->title);
 | 
			
		||||
    msgBox.setMessagePixmap(*item->getIconPixmap(), item->getIconWidth());
 | 
			
		||||
    msgBox.setMessagePixmap(item->getIconPixmap(), item->getIconWidth());
 | 
			
		||||
 | 
			
		||||
    if(msgBox.exec() == 0) {
 | 
			
		||||
        return;
 | 
			
		||||
@@ -190,11 +189,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
    // adjust the table item width to fill all the widget
 | 
			
		||||
    QHeaderView *vert_header = ui->tableWidget->verticalHeader();
 | 
			
		||||
    QHeaderView *horiz_header = ui->tableWidget->horizontalHeader();
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    horiz_header->setSectionResizeMode(QHeaderView::Stretch);
 | 
			
		||||
#else
 | 
			
		||||
    horiz_header->setResizeMode(QHeaderView::Stretch);
 | 
			
		||||
#endif
 | 
			
		||||
    qint64 backup_size = m_db->getObjectSize(ohfi);
 | 
			
		||||
    setBackupUsage(backup_size);
 | 
			
		||||
    QString path = m_db->getAbsolutePath(ohfi);
 | 
			
		||||
@@ -254,7 +249,7 @@ void BackupManagerForm::loadBackupListing(int index)
 | 
			
		||||
 | 
			
		||||
    m_db->freeMetadata(first);
 | 
			
		||||
 | 
			
		||||
    qSort(item_list.begin(), item_list.end(), BackupItem::lessThan);
 | 
			
		||||
    std::sort(item_list.begin(), item_list.end(), BackupItem::lessThan);
 | 
			
		||||
 | 
			
		||||
    int row;
 | 
			
		||||
    QList<BackupItem *>::iterator it;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,14 +26,7 @@ extern "C" {
 | 
			
		||||
 | 
			
		||||
#include <QFileDialog>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#else
 | 
			
		||||
#include <QDesktopServices>
 | 
			
		||||
#define QStandardPaths QDesktopServices
 | 
			
		||||
#define writableLocation storageLocation
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
ConfigWidget::ConfigWidget(QWidget *obj_parent) :
 | 
			
		||||
    QDialog(obj_parent),
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
#include "ui_pinform.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
 | 
			
		||||
const QString PinForm::pinFormat =
 | 
			
		||||
    "<html><head/><body>"
 | 
			
		||||
@@ -33,7 +33,10 @@ PinForm::PinForm(QWidget *obj_parent) :
 | 
			
		||||
    ui(new Ui::PinForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    move(QApplication::desktop()->screen()->rect().center() - rect().center());
 | 
			
		||||
    if (QScreen *screen = QGuiApplication::primaryScreen()) {
 | 
			
		||||
        QRect screenGeometry = screen->geometry();
 | 
			
		||||
        move(screenGeometry.center() - rect().center());
 | 
			
		||||
    }
 | 
			
		||||
    setFixedSize(size());
 | 
			
		||||
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
 | 
			
		||||
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(hide()));
 | 
			
		||||
 
 | 
			
		||||
@@ -20,15 +20,18 @@
 | 
			
		||||
#include "progressform.h"
 | 
			
		||||
#include "ui_progressform.h"
 | 
			
		||||
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
 | 
			
		||||
ProgressForm::ProgressForm(QWidget *obj_parent) :
 | 
			
		||||
    QWidget(obj_parent),
 | 
			
		||||
    ui(new Ui::ProgressForm)
 | 
			
		||||
{
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    move(QApplication::desktop()->screen()->rect().center() - rect().center());
 | 
			
		||||
    if (QScreen *screen = QGuiApplication::primaryScreen()) {
 | 
			
		||||
        QRect screenGeometry = screen->geometry();
 | 
			
		||||
        move(screenGeometry.center() - rect().center());
 | 
			
		||||
    }
 | 
			
		||||
    setFixedSize(size());
 | 
			
		||||
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
 | 
			
		||||
    connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelConfirm()));
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								gui/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								gui/main.cpp
									
									
									
									
									
								
							@@ -24,7 +24,6 @@
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLibraryInfo>
 | 
			
		||||
#include <QLocale>
 | 
			
		||||
#include <QTextCodec>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QTranslator>
 | 
			
		||||
@@ -34,14 +33,9 @@
 | 
			
		||||
#include "singleapplication.h"
 | 
			
		||||
#include "mainwidget.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
 | 
			
		||||
{
 | 
			
		||||
    const char * msg = str.toStdString().c_str();
 | 
			
		||||
#else
 | 
			
		||||
static void noMessageOutput(QtMsgType type, const char *msg)
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
    Q_UNUSED(type);
 | 
			
		||||
    Q_UNUSED(msg);
 | 
			
		||||
}
 | 
			
		||||
@@ -102,18 +96,10 @@ int main(int argc, char *argv[])
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_VERBOSE);
 | 
			
		||||
    } else {
 | 
			
		||||
        VitaMTP_Set_Logging(VitaMTP_NONE);
 | 
			
		||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
        qInstallMessageHandler(noMessageOutput);
 | 
			
		||||
#else
 | 
			
		||||
        qInstallMsgHandler(noMessageOutput);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << endl;
 | 
			
		||||
    QTextStream(stdout) << "Starting Qcma " << QCMA_VER << Qt::endl;
 | 
			
		||||
 | 
			
		||||
    QTranslator translator;
 | 
			
		||||
    QString locale = QLocale().system().name();
 | 
			
		||||
@@ -134,8 +120,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QTranslator system_translator;
 | 
			
		||||
    system_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
 | 
			
		||||
    app.installTranslator(&system_translator);
 | 
			
		||||
    if(!system_translator.load("qt_" + locale, QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
 | 
			
		||||
        qWarning() << "Cannot load system translation for locale:" << locale;
 | 
			
		||||
    } else {
 | 
			
		||||
        app.installTranslator(&system_translator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qDebug("Starting main thread: 0x%016" PRIxPTR, (uintptr_t)QThread::currentThreadId());
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,12 +25,6 @@
 | 
			
		||||
 | 
			
		||||
#include "trayindicator_global.h"
 | 
			
		||||
 | 
			
		||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 | 
			
		||||
// in Qt4 signals are protected
 | 
			
		||||
#undef signals
 | 
			
		||||
#define signals public
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TrayIndicator : public QWidget
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user