fix: port away from deprecated Qt APIs
This commit is contained in:
parent
c641be3377
commit
53a7ee1981
33
caesium.cpp
33
caesium.cpp
@ -1,6 +1,7 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||||
|
# 2021 Gary Wang <wzc782970009@gmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of the Caesium distribution.
|
# This file is part of the Caesium distribution.
|
||||||
#
|
#
|
||||||
@ -19,6 +20,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
# Author: Matteo Paonessa <matteo.paonessa@gmail.com>
|
# Author: Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||||
|
# Gary Wang <wzc782970009@gmail.com>
|
||||||
#
|
#
|
||||||
# ******************************************************************************/
|
# ******************************************************************************/
|
||||||
|
|
||||||
@ -53,7 +55,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
QTime t;
|
QElapsedTimer t;
|
||||||
int error_count = 0, iteration_count = 0, skipped_count;
|
int error_count = 0, iteration_count = 0, skipped_count;
|
||||||
int current_index = -1;
|
int current_index = -1;
|
||||||
double scale_factor = 1.0;
|
double scale_factor = 1.0;
|
||||||
@ -751,14 +753,14 @@ void Caesium::on_listTreeWidget_itemSelectionChanged()
|
|||||||
|
|
||||||
void Caesium::on_actionSave_List_As_triggered()
|
void Caesium::on_actionSave_List_As_triggered()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."), QString::null, tr("Caesium List (*.clf)"));
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."), QString(), tr("Caesium List (*.clf)"));
|
||||||
Caesium::saveList(fileName);
|
Caesium::saveList(fileName);
|
||||||
opened_list = fileName;
|
opened_list = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Caesium::on_actionOpen_List_triggered()
|
void Caesium::on_actionOpen_List_triggered()
|
||||||
{
|
{
|
||||||
QString listName = QFileDialog::getOpenFileName(this, tr("Open a list file..."), QString::null, tr("Caesium List (*.clf)"));
|
QString listName = QFileDialog::getOpenFileName(this, tr("Open a list file..."), QString(), tr("Caesium List (*.clf)"));
|
||||||
Caesium::openList(listName);
|
Caesium::openList(listName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,11 +972,11 @@ void Caesium::updateUI(int i, int newSize, QString ratio)
|
|||||||
chopped_ratio.chop(1);
|
chopped_ratio.chop(1);
|
||||||
if (chopped_ratio.toInt() > 0)
|
if (chopped_ratio.toInt() > 0)
|
||||||
{
|
{
|
||||||
ui->listTreeWidget->topLevelItem(i - 1)->setTextColor(3, QColor::fromRgb(255, 0, 0, 255));
|
ui->listTreeWidget->topLevelItem(i - 1)->setForeground(3, QColor::fromRgb(255, 0, 0, 255));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->listTreeWidget->topLevelItem(i - 1)->setTextColor(3, QColor::fromRgb(0, 0, 0, 255));
|
ui->listTreeWidget->topLevelItem(i - 1)->setForeground(3, QColor::fromRgb(0, 0, 0, 255));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1192,7 +1194,7 @@ void Caesium::openList()
|
|||||||
ui->listTreeWidget->clear();
|
ui->listTreeWidget->clear();
|
||||||
QTextStream stream(&list);
|
QTextStream stream(&list);
|
||||||
QString line = stream.readLine(0);
|
QString line = stream.readLine(0);
|
||||||
while (line != QString::null)
|
while (!line.isNull())
|
||||||
{
|
{
|
||||||
QStringList splittedLine = line.split("|");
|
QStringList splittedLine = line.split("|");
|
||||||
if (splittedLine.count() != 7)
|
if (splittedLine.count() != 7)
|
||||||
@ -1217,11 +1219,11 @@ void Caesium::lstSave()
|
|||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
if (ui->rememberDirectoryCheckBox->isChecked())
|
if (ui->rememberDirectoryCheckBox->isChecked())
|
||||||
{
|
{
|
||||||
stream << "1|" << ui->outputLineEdit->text() << endl;
|
stream << "1|" << ui->outputLineEdit->text() << Qt::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << "0|" << ui->outputLineEdit->text() << endl;
|
stream << "0|" << ui->outputLineEdit->text() << Qt::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString tempFolder = QDir::tempPath();
|
QString tempFolder = QDir::tempPath();
|
||||||
@ -1356,13 +1358,14 @@ void Caesium::adjustPreviewView()
|
|||||||
{
|
{
|
||||||
if (!deleting)
|
if (!deleting)
|
||||||
{
|
{
|
||||||
img_ratio = (double) imageLabel1->pixmap()->width() / imageLabel1->pixmap()->height();
|
QPixmap imgLabel1Pixmap = imageLabel1->pixmap(Qt::ReturnByValue);
|
||||||
|
img_ratio = (double) imgLabel1Pixmap.width() / imgLabel1Pixmap.height();
|
||||||
if (ui->listTreeWidget->selectedItems().at(0)->text(6) == "")
|
if (ui->listTreeWidget->selectedItems().at(0)->text(6) == "")
|
||||||
{
|
{
|
||||||
if (ui->methodComboBox->currentIndex() == 0)
|
if (ui->methodComboBox->currentIndex() == 0)
|
||||||
{
|
{
|
||||||
ui->widthSpinBox->setValue(imageLabel1->pixmap()->width());
|
ui->widthSpinBox->setValue(imgLabel1Pixmap.width());
|
||||||
ui->heightSpinBox->setValue(imageLabel1->pixmap()->height());
|
ui->heightSpinBox->setValue(imgLabel1Pixmap.height());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1379,8 +1382,8 @@ void Caesium::adjustPreviewView()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QList<int> wh = resolutionToInt(ui->listTreeWidget->selectedItems().at(0)->text(6));
|
QList<int> wh = resolutionToInt(ui->listTreeWidget->selectedItems().at(0)->text(6));
|
||||||
ui->widthSpinBox->setValue(100 * wh.at(0) / imageLabel1->pixmap()->width());
|
ui->widthSpinBox->setValue(100 * wh.at(0) / imgLabel1Pixmap.width());
|
||||||
ui->heightSpinBox->setValue(100 * wh.at(1) / imageLabel1->pixmap()->height());
|
ui->heightSpinBox->setValue(100 * wh.at(1) / imgLabel1Pixmap.height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(settings.value("Preferences/imageview").value<QString>() == "fit")
|
if(settings.value("Preferences/imageview").value<QString>() == "fit")
|
||||||
@ -1698,7 +1701,7 @@ void Caesium::saveList(QString path)
|
|||||||
<< ui->listTreeWidget->topLevelItem(i)->text(5) + "|"
|
<< ui->listTreeWidget->topLevelItem(i)->text(5) + "|"
|
||||||
<< ui->listTreeWidget->topLevelItem(i)->text(6) + "|"
|
<< ui->listTreeWidget->topLevelItem(i)->text(6) + "|"
|
||||||
<< ui->listTreeWidget->topLevelItem(i)->text(7) + "|"
|
<< ui->listTreeWidget->topLevelItem(i)->text(7) + "|"
|
||||||
<< endl;
|
<< Qt::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1711,7 +1714,7 @@ void Caesium::openList(QString path)
|
|||||||
ui->listTreeWidget->clear();
|
ui->listTreeWidget->clear();
|
||||||
QTextStream stream(&list);
|
QTextStream stream(&list);
|
||||||
QString line = stream.readLine(0);
|
QString line = stream.readLine(0);
|
||||||
while (line != QString::null)
|
while (!line.isNull())
|
||||||
{
|
{
|
||||||
QStringList splittedLine = line.split("|");
|
QStringList splittedLine = line.split("|");
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(splittedLine, 0);
|
QTreeWidgetItem *item = new QTreeWidgetItem(splittedLine, 0);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
#
|
#
|
||||||
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||||
|
# 2021 Gary Wang <wzc782970009@gmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of the Caesium distribution.
|
# This file is part of the Caesium distribution.
|
||||||
#
|
#
|
||||||
@ -19,6 +20,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
|
||||||
#
|
#
|
||||||
# Author: Matteo Paonessa <matteo.paonessa@gmail.com>
|
# Author: Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||||
|
# Gary Wang <wzc782970009@gmail.com>
|
||||||
#
|
#
|
||||||
# ******************************************************************************/
|
# ******************************************************************************/
|
||||||
|
|
||||||
@ -196,8 +198,7 @@ void Updater::closeEvent(QCloseEvent *event)
|
|||||||
{
|
{
|
||||||
if (downFinished)
|
if (downFinished)
|
||||||
{
|
{
|
||||||
QProcess *process;
|
QProcess::startDetached(QDir::tempPath() + "/" + fileName, {});
|
||||||
process->startDetached(QDir::tempPath() + "/" + fileName);
|
|
||||||
u_parent->close();
|
u_parent->close();
|
||||||
}
|
}
|
||||||
else if (start_pressed)
|
else if (start_pressed)
|
||||||
|
Loading…
Reference in New Issue
Block a user