Skip to content

Commit

Permalink
Start: Invert sense of checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Apr 26, 2024
1 parent 5eea14d commit e61ebc0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/Mod/Start/Gui/PreCompiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <QCoreApplication>
#include <QFile>
#include <QFileIconProvider>
#include <QFrame>
#include <QGridLayout>
#include <QGuiApplication>
#include <QHBoxLayout>
Expand Down
45 changes: 23 additions & 22 deletions src/Mod/Start/Gui/StartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef _PreComp_
#include <QApplication>
#include <QCheckBox>
#include <QFrame>
#include <QGridLayout>
#include <QLabel>
#include <QListView>
Expand Down Expand Up @@ -76,6 +77,7 @@ gsl::owner<QPushButton*> createNewButton(const NewButton& newButton)
mainLayout->addWidget(iconLabel);
QIcon baseIcon(newButton.iconPath);
iconLabel->setPixmap(baseIcon.pixmap(newFileIconSize, newFileIconSize));
iconLabel->setPixmap(baseIcon.pixmap(newFileIconSize, newFileIconSize));

auto textLayout = gsl::owner<QVBoxLayout*>(new QVBoxLayout);
auto textLabelLine1 = gsl::owner<QLabel*>(new QLabel(button));
Expand Down Expand Up @@ -104,7 +106,6 @@ StartView::StartView(Gui::Document* pcDocument, QWidget* parent)
, _examplesLabel {nullptr}
, _recentFilesLabel {nullptr}
, _showOnStartupCheckBox {nullptr}
, _rewriteLabel {nullptr}
{
setObjectName(QLatin1String("StartView"));
auto hGrp = App::GetApplication().GetParameterGroupByPath(
Expand All @@ -119,19 +120,6 @@ StartView::StartView(Gui::Document* pcDocument, QWidget* parent)
auto layout = gsl::owner<QVBoxLayout*>(new QVBoxLayout(scrolledWidget));
layout->setSizeConstraint(QLayout::SizeConstraint::SetMinAndMaxSize);

// New WB notice: temporary to explain why all your setting disappeared
_rewriteLabel = gsl::owner<QLabel*>(new QLabel());
_rewriteLabel->setWordWrap(true);
layout->addWidget(_rewriteLabel);

// Launch start automatically?
_showOnStartupCheckBox = gsl::owner<QCheckBox*>(new QCheckBox());
bool showOnStartup = hGrp->GetBool("ShowOnStartup", true);
_showOnStartupCheckBox->setCheckState(showOnStartup ? Qt::CheckState::Checked
: Qt::CheckState::Unchecked);
connect(_showOnStartupCheckBox, &QCheckBox::toggled, this, &StartView::showOnStartupChanged);
layout->addWidget(_showOnStartupCheckBox);

auto firstStart = hGrp->GetBool("FirstStart2024", true); // NOLINT
if (firstStart) {
auto firstStartRegion = gsl::owner<QHBoxLayout*>(new QHBoxLayout);
Expand All @@ -140,8 +128,22 @@ StartView::StartView(Gui::Document* pcDocument, QWidget* parent)
firstStartRegion->addWidget(firstStartWidget);
firstStartRegion->addStretch();
layout->addLayout(firstStartRegion);

// Try to further differentiate the checkbox below, when the First Start box is shown
auto line = new QFrame();

Check warning on line 133 in src/Mod/Start/Gui/StartView.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

initializing non-owner 'QFrame *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
layout->addWidget(line);
}

// Launch start automatically?
_showOnStartupCheckBox = gsl::owner<QCheckBox*>(new QCheckBox());
bool showOnStartup = hGrp->GetBool("ShowOnStartup", true);
_showOnStartupCheckBox->setCheckState(showOnStartup ? Qt::CheckState::Unchecked
: Qt::CheckState::Checked);
connect(_showOnStartupCheckBox, &QCheckBox::toggled, this, &StartView::showOnStartupChanged);
layout->addWidget(_showOnStartupCheckBox);

_newFileLabel = gsl::owner<QLabel*>(new QLabel());
layout->addWidget(_newFileLabel);
auto flowLayout = gsl::owner<FlowLayout*>(new FlowLayout);
Expand Down Expand Up @@ -406,7 +408,11 @@ void StartView::showOnStartupChanged(bool checked)
{
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
hGrp->SetBool("ShowOnStartup", checked);
hGrp->SetBool(
"ShowOnStartup",
!checked); // The sense of this option has been reversed: the checkbox actually says
// "*Don't* show on startup" now, but the option is preserved in its
// original sense, so is stored inverted.
}

void StartView::changeEvent(QEvent* event)
Expand All @@ -430,11 +436,6 @@ void StartView::retranslateUi()
_recentFilesLabel->setText(h1Start + tr("Recent Files") + h1End);

QString application = QString::fromUtf8(App::Application::Config()["ExeName"].c_str());

Check warning on line 438 in src/Mod/Start/Gui/StartView.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

unused QString [-Wclazy-unused-non-trivial-variable]
_showOnStartupCheckBox->setText(tr("Show this view when starting %1").arg(application));

_rewriteLabel->setText(
tr("NOTE: The Start Workbench has been completely rewritten to remove all "
"network access, and to remove its dependency on Chromium. This is still a "
"work-in-progress, and not all settings from the previous version of Start "
"have been migrated yet."));
_showOnStartupCheckBox->setText(
tr("Don't show this Start page again (start with blank screen)"));
}
1 change: 0 additions & 1 deletion src/Mod/Start/Gui/StartView.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class StartGuiExport StartView: public Gui::MDIView
QLabel* _examplesLabel;
QLabel* _recentFilesLabel;
QCheckBox* _showOnStartupCheckBox;
QLabel* _rewriteLabel;


}; // namespace StartGui
Expand Down

0 comments on commit e61ebc0

Please sign in to comment.