Run clang-format
This commit is contained in:
parent
892d6a7fff
commit
1dc80b96d1
11 changed files with 378 additions and 356 deletions
|
@ -15,7 +15,9 @@
|
|||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
|
||||
ArtConfigWindow::ArtConfigWindow(const QString& filename, QWidget* parent) : QDialog(parent) {
|
||||
ArtConfigWindow::ArtConfigWindow(const QString &filename, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowModality(Qt::WindowModality::WindowModal);
|
||||
setWindowTitle(filename);
|
||||
|
||||
|
@ -56,7 +58,8 @@ ArtConfigWindow::ArtConfigWindow(const QString& filename, QWidget* parent) : QDi
|
|||
}
|
||||
}
|
||||
|
||||
void ArtConfigWindow::loadData(const QString& filename) {
|
||||
void ArtConfigWindow::loadData(const QString &filename)
|
||||
{
|
||||
qDebug() << "Loading data from" << filename;
|
||||
|
||||
QFile artFile(filename);
|
||||
|
@ -67,7 +70,8 @@ void ArtConfigWindow::loadData(const QString& filename) {
|
|||
m_commissionsOpen->setChecked(artJson[QStringLiteral("commissions")].toBool());
|
||||
}
|
||||
|
||||
void ArtConfigWindow::saveData(const QString& filename) {
|
||||
void ArtConfigWindow::saveData(const QString &filename)
|
||||
{
|
||||
qDebug() << "Saving data to" << filename;
|
||||
|
||||
QJsonObject object;
|
||||
|
@ -82,4 +86,3 @@ void ArtConfigWindow::saveData(const QString& filename) {
|
|||
|
||||
close();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
|
||||
#include <QCheckBox>
|
||||
#include <QDateEdit>
|
||||
#include <QDialog>
|
||||
#include <QJsonObject>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QStringListModel>
|
||||
#include <QTextEdit>
|
||||
#include <QDialog>
|
||||
|
||||
class ArtConfigWindow : public QDialog {
|
||||
class ArtConfigWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ArtConfigWindow(const QString &filename, QWidget *parent = nullptr);
|
||||
|
|
|
@ -176,7 +176,8 @@ ArtDetailWindow::ArtDetailWindow(const QString &filename, const QDir &assetDirec
|
|||
}
|
||||
}
|
||||
|
||||
void ArtDetailWindow::loadData(const QString& filename) {
|
||||
void ArtDetailWindow::loadData(const QString &filename)
|
||||
{
|
||||
qDebug() << "Loading data from" << filename;
|
||||
|
||||
QFile artFile(filename);
|
||||
|
@ -235,7 +236,8 @@ void ArtDetailWindow::loadData(const QString& filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void ArtDetailWindow::saveData(const QString& filename) {
|
||||
void ArtDetailWindow::saveData(const QString &filename)
|
||||
{
|
||||
qDebug() << "Saving data to" << filename;
|
||||
|
||||
QJsonObject object;
|
||||
|
@ -287,4 +289,3 @@ void ArtDetailWindow::saveData(const QString& filename) {
|
|||
|
||||
close();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
#include <QStringListModel>
|
||||
#include <QTextEdit>
|
||||
|
||||
class ArtDetailWindow : public QDialog {
|
||||
class ArtDetailWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ArtDetailWindow(const QString &filename, const QDir &assetDirectory, QWidget *parent = nullptr);
|
||||
|
|
|
@ -55,17 +55,20 @@ ArtModel::ArtModel(const QDir &definitionDirectory, const QDir &assetDirectory)
|
|||
piecesFuture->setFuture(QtConcurrent::mapped(pieceList, loadPiece));
|
||||
}
|
||||
|
||||
int ArtModel::rowCount(const QModelIndex &parent) const {
|
||||
int ArtModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return m_artPieces.size();
|
||||
}
|
||||
|
||||
int ArtModel::columnCount(const QModelIndex &parent) const {
|
||||
int ArtModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return 4;
|
||||
}
|
||||
|
||||
QVariant ArtModel::data(const QModelIndex &index, int role) const {
|
||||
QVariant ArtModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return {};
|
||||
|
||||
|
@ -96,7 +99,8 @@ QVariant ArtModel::data(const QModelIndex &index, int role) const {
|
|||
return {};
|
||||
}
|
||||
|
||||
QVariant ArtModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
||||
QVariant ArtModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Orientation::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
|
@ -115,8 +119,8 @@ QVariant ArtModel::headerData(int section, Qt::Orientation orientation, int role
|
|||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
|
||||
void ArtModel::loadData(ArtPiece& piece, const QString& filename, const QString& assetFilename) {
|
||||
void ArtModel::loadData(ArtPiece &piece, const QString &filename, const QString &assetFilename)
|
||||
{
|
||||
piece.jsonFilename = filename + ".json";
|
||||
piece.filename = assetFilename;
|
||||
|
||||
|
@ -138,15 +142,16 @@ void ArtModel::loadData(ArtPiece& piece, const QString& filename, const QString&
|
|||
piece.hasAltText = true;
|
||||
}
|
||||
}
|
||||
void ArtModel::pieceFinished(int row) {
|
||||
void ArtModel::pieceFinished(int row)
|
||||
{
|
||||
m_artPieces[row] = piecesFuture->resultAt(row);
|
||||
|
||||
Q_EMIT dataChanged(index(row, 0), index(row + 1, 0));
|
||||
}
|
||||
|
||||
void ArtModel::finished() {
|
||||
std::sort(m_artPieces.begin(), m_artPieces.end(), [](ArtPiece& a, ArtPiece& b)
|
||||
void ArtModel::finished()
|
||||
{
|
||||
std::sort(m_artPieces.begin(), m_artPieces.end(), [](ArtPiece &a, ArtPiece &b) {
|
||||
return a.date > b.date;
|
||||
});
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ struct ArtPiece {
|
|||
bool hasAltText = false;
|
||||
};
|
||||
|
||||
class ArtModel : public QAbstractTableModel {
|
||||
class ArtModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ArtModel(const QDir &definitionDirectory, const QDir &assetDirectory);
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <QDir>
|
||||
#include <QMainWindow>
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(const QDir &definitionDirectory, const QDir &assetDirectory, const QDir &dataDirectory);
|
||||
|
|
|
@ -4,30 +4,37 @@
|
|||
|
||||
#include "imagelabel.h"
|
||||
|
||||
ImageLabel::ImageLabel(QWidget *parent) : QLabel(parent) {
|
||||
ImageLabel::ImageLabel(QWidget *parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
this->setMinimumSize(1, 1);
|
||||
setScaledContents(false);
|
||||
}
|
||||
|
||||
void ImageLabel::setPixmap(const QPixmap &p) {
|
||||
void ImageLabel::setPixmap(const QPixmap &p)
|
||||
{
|
||||
pix = p;
|
||||
QLabel::setPixmap(scaledPixmap());
|
||||
}
|
||||
|
||||
int ImageLabel::heightForWidth(int width) const {
|
||||
int ImageLabel::heightForWidth(int width) const
|
||||
{
|
||||
return pix.isNull() ? this->height() : ((qreal)pix.height() * width) / pix.width();
|
||||
}
|
||||
|
||||
QSize ImageLabel::sizeHint() const {
|
||||
QSize ImageLabel::sizeHint() const
|
||||
{
|
||||
const int w = this->width();
|
||||
return {w, heightForWidth(w)};
|
||||
}
|
||||
|
||||
QPixmap ImageLabel::scaledPixmap() const {
|
||||
QPixmap ImageLabel::scaledPixmap() const
|
||||
{
|
||||
return pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
void ImageLabel::resizeEvent(QResizeEvent *e) {
|
||||
void ImageLabel::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
if (!pix.isNull()) {
|
||||
QLabel::setPixmap(scaledPixmap());
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
|
||||
#include <QLabel>
|
||||
|
||||
class ImageLabel : public QLabel {
|
||||
class ImageLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ImageLabel(QWidget *parent = nullptr);
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
#include "MainWindow.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue