aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
commit7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch)
tree27fb39be241fdb5ac2734c574de678977d1856d0 /libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp')
-rw-r--r--libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp165
1 files changed, 165 insertions, 0 deletions
diff --git a/libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp b/libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp
new file mode 100644
index 0000000..d686c58
--- /dev/null
+++ b/libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.cpp
@@ -0,0 +1,165 @@
+#include "checkboxwordwrap.h"
+
+#include <QStyle>
+#include <QStyleOptionButton>
+
+CheckBoxWordWrap::CheckBoxWordWrap(QWidget *parent)
+ : QCheckBox (parent)
+ , m_hMainLayout(new QHBoxLayout(this))
+ , m_label(new ClickableLabel(this))
+{
+ init();
+}
+
+CheckBoxWordWrap::CheckBoxWordWrap(const QString &text, QWidget *parent)
+ : QCheckBox (parent)
+ , m_hMainLayout(new QHBoxLayout(this))
+ , m_label(new ClickableLabel(text, this))
+{
+ init();
+}
+
+CheckBoxWordWrap::~CheckBoxWordWrap()
+{
+ delete m_label;
+ delete m_hMainLayout;
+}
+
+bool CheckBoxWordWrap::isWordWrap() const
+{
+ return m_label->wordWrap();
+}
+
+void CheckBoxWordWrap::setWordWrap(bool wordwrap)
+{
+ m_label->setWordWrap(wordwrap);
+}
+
+QString CheckBoxWordWrap::text() const
+{
+ return m_label->text();
+}
+
+void CheckBoxWordWrap::setText(const QString &text)
+{
+ m_label->setText(text);
+}
+
+QSize CheckBoxWordWrap::sizeHint() const
+{
+ QFontMetrics fm(m_label->font());
+ QRect r = m_label->rect();
+ r.setLeft(r.left()+m_label->indent()+separation);
+ QRect bRect = fm.boundingRect(r, int(Qt::AlignLeft | Qt::AlignVCenter | Qt::TextWordWrap), m_label->text());
+ QSize ret = QSize(QWidget::sizeHint().width(), bRect.height());
+ return ret;
+}
+
+void CheckBoxWordWrap::labelIsClicked()
+{
+ setChecked(!isChecked());
+}
+
+void CheckBoxWordWrap::resizeEvent(QResizeEvent *event)
+{
+ QWidget::resizeEvent(event);
+ updateGeometry();
+}
+
+void CheckBoxWordWrap::init()
+{
+ setLayout(m_hMainLayout);
+ QStyleOptionButton opt;
+ initStyleOption(&opt);
+ int indicatorW = style()->pixelMetric(QStyle::PixelMetric::PM_IndicatorWidth, &opt, this);
+ // Useless in our case, we only need the indicator width
+ //int indicatorH = style()->pixelMetric(QStyle::PixelMetric::PM_IndicatorHeight, &opt, this);
+ m_hMainLayout->setContentsMargins(0, 0, 0, 0);
+ m_hMainLayout->addWidget(m_label);
+ m_label->setIndent(indicatorW+separation);
+ m_label->setWordWrap(true);
+
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ connect(m_label, SIGNAL(clicked()), this, SLOT(labelIsClicked()));
+}
+
+
+RadioButtonWordWrap::RadioButtonWordWrap(QWidget* parent)
+ : QRadioButton(parent)
+ , m_hMainLayout(new QHBoxLayout(this))
+ , m_label(new ClickableLabel(this))
+{
+ init();
+}
+
+RadioButtonWordWrap::RadioButtonWordWrap(const QString& text, QWidget* parent)
+ : QRadioButton(parent)
+ , m_hMainLayout(new QHBoxLayout(this))
+ , m_label(new ClickableLabel(text, this))
+{
+ init();
+}
+
+RadioButtonWordWrap::~RadioButtonWordWrap()
+{
+ delete m_label;
+ delete m_hMainLayout;
+}
+
+bool RadioButtonWordWrap::isWordWrap() const
+{
+ return m_label->wordWrap();
+}
+
+void RadioButtonWordWrap::setWordWrap(bool wordwrap)
+{
+ m_label->setWordWrap(wordwrap);
+}
+
+QString RadioButtonWordWrap::text() const
+{
+ return m_label->text();
+}
+
+void RadioButtonWordWrap::setText(const QString& text)
+{
+ m_label->setText(text);
+}
+
+QSize RadioButtonWordWrap::sizeHint() const
+{
+ QFontMetrics fm(m_label->font());
+ QRect r = m_label->rect();
+ r.setLeft(r.left() + m_label->indent() + separation);
+ QRect bRect = fm.boundingRect(r, int(Qt::AlignLeft | Qt::AlignVCenter | Qt::TextWordWrap), m_label->text());
+ QSize ret = QSize(QWidget::sizeHint().width(), bRect.height());
+ return ret;
+}
+
+void RadioButtonWordWrap::labelIsClicked()
+{
+ setChecked(!isChecked());
+}
+
+void RadioButtonWordWrap::resizeEvent(QResizeEvent* event)
+{
+ QWidget::resizeEvent(event);
+ updateGeometry();
+}
+
+void RadioButtonWordWrap::init()
+{
+ setLayout(m_hMainLayout);
+ QStyleOptionButton opt;
+ initStyleOption(&opt);
+ int indicatorW = style()->pixelMetric(QStyle::PixelMetric::PM_IndicatorWidth, &opt, this);
+ // Useless in our case, we only need the indicator width
+ //int indicatorH = style()->pixelMetric(QStyle::PixelMetric::PM_IndicatorHeight, &opt, this);
+ m_hMainLayout->setContentsMargins(0, 0, 0, 0);
+ m_hMainLayout->addWidget(m_label);
+ m_label->setIndent(indicatorW + separation);
+ m_label->setWordWrap(true);
+
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ connect(m_label, SIGNAL(clicked()), this, SLOT(labelIsClicked()));
+}