-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start implementing extension info side.
- Loading branch information
Showing
12 changed files
with
397 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "settingsdialogextensioninfo.h" | ||
|
||
#include "ui_settingsdialogextensioninfo.h" | ||
|
||
#include <format> | ||
|
||
#include <uibase/formatters.h> | ||
|
||
using namespace MOBase; | ||
|
||
ExtensionListInfoWidget::ExtensionListInfoWidget(QWidget* parent) | ||
: QWidget(parent), ui{new Ui::ExtensionListInfoWidget()} | ||
{ | ||
ui->setupUi(this); | ||
|
||
ui->authorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); | ||
ui->authorLabel->setOpenExternalLinks(true); | ||
} | ||
|
||
void ExtensionListInfoWidget::setExtension(const IExtension& extension) | ||
{ | ||
m_extension = &extension; | ||
|
||
const auto& metadata = m_extension->metadata(); | ||
const auto& author = metadata.author(); | ||
|
||
if (author.homepage().isEmpty()) { | ||
ui->authorLabel->setText(metadata.author().name()); | ||
} else { | ||
ui->authorLabel->setText(QString::fromStdString( | ||
std::format("<a href=\"{}\">{}</a>", author.homepage(), author.name()))); | ||
} | ||
ui->descriptionLabel->setText(metadata.description()); | ||
ui->versionLabel->setText(metadata.version().string(Version::FormatCondensed)); | ||
|
||
if (metadata.type() == ExtensionType::THEME || | ||
metadata.type() == ExtensionType::TRANSLATION) { | ||
ui->enabledCheckbox->setChecked(true); | ||
ui->enabledCheckbox->setEnabled(false); | ||
ui->enabledCheckbox->setToolTip( | ||
tr("Translation and theme extensions cannot be disabled.")); | ||
} else { | ||
// TODO: | ||
// ui->enabledCheckbox->setChecked(); | ||
ui->enabledCheckbox->setEnabled(true); | ||
ui->enabledCheckbox->setToolTip(QString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef SETTINGSDIALOGEXTENSIONINFO_H | ||
#define SETTINGSDIALOGEXTENSIONINFO_H | ||
|
||
#include <QWidget> | ||
|
||
#include <uibase/extensions/extension.h> | ||
|
||
namespace Ui | ||
{ | ||
class ExtensionListInfoWidget; | ||
} | ||
|
||
class ExtensionListInfoWidget : public QWidget | ||
{ | ||
public: | ||
ExtensionListInfoWidget(QWidget* parent = nullptr); | ||
|
||
// set the extension to display | ||
// | ||
void setExtension(const MOBase::IExtension& extension); | ||
|
||
private: | ||
Ui::ExtensionListInfoWidget* ui; | ||
|
||
// currently displayed extension (default to nullptr) | ||
const MOBase::IExtension* m_extension{nullptr}; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.