mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Address comments, move dialog to appropriate folder.
This commit is contained in:
parent
f33c6a4db0
commit
9a3e748580
6 changed files with 44 additions and 41 deletions
|
|
@ -35,6 +35,7 @@ set(cockatrice_SOURCES
|
|||
src/deck/deck_list_model.cpp
|
||||
src/deck/deck_stats_interface.cpp
|
||||
src/dialogs/dlg_connect.cpp
|
||||
src/dialogs/dlg_convert_deck_to_cod_format.cpp
|
||||
src/dialogs/dlg_create_token.cpp
|
||||
src/dialogs/dlg_create_game.cpp
|
||||
src/dialogs/dlg_edit_avatar.cpp
|
||||
|
|
@ -169,7 +170,6 @@ set(cockatrice_SOURCES
|
|||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_widget.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_color_identity_filter_widget.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_addition_widget.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_deck_format_conversion_dialog.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_display_widget.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_dialog.cpp
|
||||
src/client/ui/widgets/visual_deck_storage/deck_preview/deck_preview_tag_item_widget.cpp
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "deck_preview_tag_addition_widget.h"
|
||||
|
||||
#include "../../../../../dialogs/dlg_convert_deck_to_cod_format.h"
|
||||
#include "../../../../../settings/cache_settings.h"
|
||||
#include "deck_preview_tag_deck_format_conversion_dialog.h"
|
||||
#include "deck_preview_tag_dialog.h"
|
||||
|
||||
#include <QFontMetrics>
|
||||
|
|
@ -56,7 +56,7 @@ void DeckPreviewTagAdditionWidget::mousePressEvent(QMouseEvent *event)
|
|||
}
|
||||
} else {
|
||||
// Show the dialog to the user
|
||||
DeckPreviewTagDeckFormatConversionDialog conversionDialog(parent);
|
||||
DialogConvertDeckToCodFormat conversionDialog(parent);
|
||||
if (conversionDialog.exec() == QDialog::Accepted) {
|
||||
parent->deckLoader->convertToCockatriceFormat(parent->parent->filePath);
|
||||
parent->parent->filePath = parent->deckLoader->getLastFileName();
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef DECK_PREVIEW_TAG_DECK_FORMAT_CONVERSION_DIALOG_H
|
||||
#define DECK_PREVIEW_TAG_DECK_FORMAT_CONVERSION_DIALOG_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class DeckPreviewTagDeckFormatConversionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeckPreviewTagDeckFormatConversionDialog(QWidget *parent = nullptr);
|
||||
void retranslateUi();
|
||||
|
||||
bool dontAskAgain() const;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QLabel *label;
|
||||
QCheckBox *dontAskAgainCheckbox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
|
||||
Q_DISABLE_COPY(DeckPreviewTagDeckFormatConversionDialog)
|
||||
};
|
||||
|
||||
#endif // DECK_PREVIEW_TAG_DECK_FORMAT_CONVERSION_DIALOG_H
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
#include "decklist.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFutureWatcher>
|
||||
|
|
@ -228,7 +229,7 @@ struct FormatDeckListForExport
|
|||
QString &sideBoardCards;
|
||||
// create main operator for struct, allowing the foreachcard to work.
|
||||
FormatDeckListForExport(QString &_mainBoardCards, QString &_sideBoardCards)
|
||||
: mainBoardCards(_mainBoardCards), sideBoardCards(_sideBoardCards){};
|
||||
: mainBoardCards(_mainBoardCards), sideBoardCards(_sideBoardCards) {};
|
||||
|
||||
void operator()(const InnerDecklistNode *node, const DecklistCardNode *card) const
|
||||
{
|
||||
|
|
@ -485,7 +486,7 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
|||
{
|
||||
// Change the file extension to .cod
|
||||
QFileInfo fileInfo(fileName);
|
||||
QString newFileName = fileInfo.path() + "/" + fileInfo.completeBaseName() + ".cod";
|
||||
QString newFileName = QDir::toNativeSeparators(fileInfo.path() + "/" + fileInfo.completeBaseName() + ".cod");
|
||||
|
||||
// Open the new file for writing
|
||||
QFile file(newFileName);
|
||||
|
|
@ -509,6 +510,7 @@ bool DeckLoader::convertToCockatriceFormat(QString fileName)
|
|||
default:
|
||||
qCWarning(DeckLoaderLog) << "Unsupported file format for conversion:" << fileName;
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
#include "deck_preview_tag_deck_format_conversion_dialog.h"
|
||||
#include "dlg_convert_deck_to_cod_format.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
DeckPreviewTagDeckFormatConversionDialog::DeckPreviewTagDeckFormatConversionDialog(QWidget *parent) : QDialog(parent)
|
||||
DialogConvertDeckToCodFormat::DialogConvertDeckToCodFormat(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Deck Format Conversion");
|
||||
layout = new QVBoxLayout(this);
|
||||
label = new QLabel();
|
||||
layout->addWidget(label);
|
||||
|
|
@ -26,14 +25,16 @@ DeckPreviewTagDeckFormatConversionDialog::DeckPreviewTagDeckFormatConversionDial
|
|||
retranslateUi();
|
||||
}
|
||||
|
||||
void DeckPreviewTagDeckFormatConversionDialog::retranslateUi()
|
||||
void DialogConvertDeckToCodFormat::retranslateUi()
|
||||
{
|
||||
label->setText(tr("You tried to add a tag to a .txt format deck. Tags can only be added to .cod format decks. Do "
|
||||
"you want to convert the deck to the .cod format?"));
|
||||
setWindowTitle(tr("Deck Format Conversion"));
|
||||
label->setText(
|
||||
tr("You tried to add a tag to a .txt format deck.\n Tags can only be added to .cod format decks.\n Do "
|
||||
"you want to convert the deck to the .cod format?"));
|
||||
dontAskAgainCheckbox->setText(tr("Remember and automatically apply choice in the future"));
|
||||
}
|
||||
|
||||
bool DeckPreviewTagDeckFormatConversionDialog::dontAskAgain() const
|
||||
bool DialogConvertDeckToCodFormat::dontAskAgain() const
|
||||
{
|
||||
return dontAskAgainCheckbox->isChecked();
|
||||
}
|
||||
29
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h
Normal file
29
cockatrice/src/dialogs/dlg_convert_deck_to_cod_format.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
#define DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class DialogConvertDeckToCodFormat : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogConvertDeckToCodFormat(QWidget *parent);
|
||||
void retranslateUi();
|
||||
|
||||
bool dontAskAgain() const;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QLabel *label;
|
||||
QCheckBox *dontAskAgainCheckbox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
|
||||
Q_DISABLE_COPY(DialogConvertDeckToCodFormat)
|
||||
};
|
||||
|
||||
#endif // DIALOG_CONVERT_DECK_TO_COD_FORMAT_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue