Mercurial > minori
comparison src/gui/dialog/information.cpp @ 65:26721c28bf22
*: avoid usage of (to|from)StdString
in Qt5 (and probably Qt6 as well) these functions are only
available (or even usable) if Qt and Minori were built with the
*same standard headers*, which may not be the case in some
circumstances. hence, we'll use our own conversion functions,
which we probably should use anyway.
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Sun, 01 Oct 2023 23:26:35 -0400 |
| parents | fe719c109dbc |
| children | 6481c5aed3e1 |
comparison
equal
deleted
inserted
replaced
| 64:fe719c109dbc | 65:26721c28bf22 |
|---|---|
| 65 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 65 main_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
| 66 | 66 |
| 67 id = anime.GetId(); | 67 id = anime.GetId(); |
| 68 /* anime title header text */ | 68 /* anime title header text */ |
| 69 TextWidgets::Title* anime_title = | 69 TextWidgets::Title* anime_title = |
| 70 new TextWidgets::Title(QString::fromStdString(anime.GetUserPreferredTitle()), main_widget); | 70 new TextWidgets::Title(Strings::ToQString(anime.GetUserPreferredTitle()), main_widget); |
| 71 | 71 |
| 72 /* tabbed widget */ | 72 /* tabbed widget */ |
| 73 QTabWidget* tabbed_widget = new QTabWidget(main_widget); | 73 QTabWidget* tabbed_widget = new QTabWidget(main_widget); |
| 74 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | 74 tabbed_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
| 75 | 75 |
| 148 CREATE_SUBSECTION({ | 148 CREATE_SUBSECTION({ |
| 149 subsection->layout()->addWidget(new QLabel(tr("Status:"), subsection)); | 149 subsection->layout()->addWidget(new QLabel(tr("Status:"), subsection)); |
| 150 | 150 |
| 151 QStringList string_list; | 151 QStringList string_list; |
| 152 for (unsigned int i = 0; i < ARRAYSIZE(Anime::ListStatuses); i++) | 152 for (unsigned int i = 0; i < ARRAYSIZE(Anime::ListStatuses); i++) |
| 153 string_list.append(QString::fromStdString(Translate::ToString(Anime::ListStatuses[i]))); | 153 string_list.append(Strings::ToQString(Translate::ToString(Anime::ListStatuses[i]))); |
| 154 | 154 |
| 155 QComboBox* combo_box = new QComboBox(subsection); | 155 QComboBox* combo_box = new QComboBox(subsection); |
| 156 combo_box->addItems(string_list); | 156 combo_box->addItems(string_list); |
| 157 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, | 157 connect(combo_box, QOverload<int>::of(&QComboBox::currentIndexChanged), this, |
| 158 [this](int i) { status = Anime::ListStatuses[i]; }); | 158 [this](int i) { status = Anime::ListStatuses[i]; }); |
| 176 subsection->layout()->addWidget(new QLabel(tr("Notes:"), subsection)); | 176 subsection->layout()->addWidget(new QLabel(tr("Notes:"), subsection)); |
| 177 | 177 |
| 178 QLineEdit* line_edit = new QLineEdit(subsection); | 178 QLineEdit* line_edit = new QLineEdit(subsection); |
| 179 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { | 179 connect(line_edit, &QLineEdit::textChanged, this, [this](const QString& text) { |
| 180 /* this sucks but I don't really want to implement anything smarter :) */ | 180 /* this sucks but I don't really want to implement anything smarter :) */ |
| 181 notes = text.toStdString(); | 181 notes = Strings::ToUtf8String(text); |
| 182 }); | 182 }); |
| 183 line_edit->setText(QString::fromStdString(notes = anime.GetUserNotes())); | 183 line_edit->setText(Strings::ToQString(notes = anime.GetUserNotes())); |
| 184 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); | 184 line_edit->setPlaceholderText(tr("Enter your notes about this anime")); |
| 185 subsection->layout()->addWidget(line_edit); | 185 subsection->layout()->addWidget(line_edit); |
| 186 }); | 186 }); |
| 187 }); | 187 }); |
| 188 CREATE_SECTION(sg_anime_list_content, { | 188 CREATE_SECTION(sg_anime_list_content, { |
| 228 CREATE_FULL_WIDTH_SECTION(sg_local_content, { | 228 CREATE_FULL_WIDTH_SECTION(sg_local_content, { |
| 229 /* Alternative titles */ | 229 /* Alternative titles */ |
| 230 CREATE_FULL_WIDTH_SUBSECTION({ | 230 CREATE_FULL_WIDTH_SUBSECTION({ |
| 231 subsection->layout()->addWidget(new QLabel(tr("Alternative titles:"), subsection)); | 231 subsection->layout()->addWidget(new QLabel(tr("Alternative titles:"), subsection)); |
| 232 | 232 |
| 233 QLineEdit* line_edit = new QLineEdit(QString::fromStdString(anime.GetUserNotes()), subsection); | 233 QLineEdit* line_edit = new QLineEdit(Strings::ToQString(anime.GetUserNotes()), subsection); |
| 234 line_edit->setPlaceholderText( | 234 line_edit->setPlaceholderText( |
| 235 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); | 235 tr("Enter alternative titles here, separated by a semicolon (i.e. Title 1; Title 2)")); |
| 236 subsection->layout()->addWidget(line_edit); | 236 subsection->layout()->addWidget(line_edit); |
| 237 | 237 |
| 238 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); | 238 QCheckBox* checkbox = new QCheckBox(tr("Use the first alternative title to search for torrents")); |
