2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef DIALOG_H
|
|
|
|
#define DIALOG_H
|
|
|
|
|
2011-05-07 20:57:49 +00:00
|
|
|
#include <QtWidgets>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <QtSql>
|
|
|
|
#include <QtXml>
|
|
|
|
|
|
|
|
class Dialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Dialog(QSqlRelationalTableModel *albums, QDomDocument details,
|
2017-07-20 14:39:01 +00:00
|
|
|
QFile *output, QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void revert();
|
|
|
|
void submit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int addNewAlbum(const QString &title, int artistId);
|
|
|
|
int addNewArtist(const QString &name);
|
2017-07-20 14:39:01 +00:00
|
|
|
void addTracks(int albumId, const QStringList &tracks);
|
2011-04-27 10:05:43 +00:00
|
|
|
QDialogButtonBox *createButtons();
|
|
|
|
QGroupBox *createInputWidgets();
|
|
|
|
int findArtistId(const QString &artist);
|
2017-07-20 14:39:01 +00:00
|
|
|
static int generateAlbumId();
|
|
|
|
static int generateArtistId();
|
2011-04-27 10:05:43 +00:00
|
|
|
void increaseAlbumCount(QModelIndex artistIndex);
|
|
|
|
QModelIndex indexOfArtist(const QString &artist);
|
|
|
|
|
|
|
|
QSqlRelationalTableModel *model;
|
|
|
|
QDomDocument albumDetails;
|
|
|
|
QFile *outputFile;
|
|
|
|
|
|
|
|
QLineEdit *artistEditor;
|
|
|
|
QLineEdit *titleEditor;
|
|
|
|
QSpinBox *yearEditor;
|
|
|
|
QLineEdit *tracksEditor;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|