DolphinQt: Ensure skylanders QDateTimeEdit shows a four digit year without forcing dd-mm-yyyy format.
This commit is contained in:
parent
adafe1f347
commit
149a3721ff
|
@ -318,6 +318,8 @@ add_executable(dolphin-emu
|
||||||
QtUtils/ParallelProgressDialog.h
|
QtUtils/ParallelProgressDialog.h
|
||||||
QtUtils/PartiallyClosableTabWidget.cpp
|
QtUtils/PartiallyClosableTabWidget.cpp
|
||||||
QtUtils/PartiallyClosableTabWidget.h
|
QtUtils/PartiallyClosableTabWidget.h
|
||||||
|
QtUtils/QtUtils.cpp
|
||||||
|
QtUtils/QtUtils.h
|
||||||
QtUtils/SetWindowDecorations.cpp
|
QtUtils/SetWindowDecorations.cpp
|
||||||
QtUtils/SetWindowDecorations.h
|
QtUtils/SetWindowDecorations.h
|
||||||
QtUtils/SignalBlocking.h
|
QtUtils/SignalBlocking.h
|
||||||
|
|
|
@ -197,6 +197,7 @@
|
||||||
<ClCompile Include="QtUtils\ModalMessageBox.cpp" />
|
<ClCompile Include="QtUtils\ModalMessageBox.cpp" />
|
||||||
<ClCompile Include="QtUtils\NonDefaultQPushButton.cpp" />
|
<ClCompile Include="QtUtils\NonDefaultQPushButton.cpp" />
|
||||||
<ClCompile Include="QtUtils\PartiallyClosableTabWidget.cpp" />
|
<ClCompile Include="QtUtils\PartiallyClosableTabWidget.cpp" />
|
||||||
|
<ClCompile Include="QtUtils\QtUtils.cpp" />
|
||||||
<ClCompile Include="QtUtils\SetWindowDecorations.cpp" />
|
<ClCompile Include="QtUtils\SetWindowDecorations.cpp" />
|
||||||
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
|
<ClCompile Include="QtUtils\UTF8CodePointCountValidator.cpp" />
|
||||||
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
|
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
|
||||||
|
@ -404,6 +405,7 @@
|
||||||
<ClInclude Include="QtUtils\FromStdString.h" />
|
<ClInclude Include="QtUtils\FromStdString.h" />
|
||||||
<QtMoc Include="QtUtils\ParallelProgressDialog.h" />
|
<QtMoc Include="QtUtils\ParallelProgressDialog.h" />
|
||||||
<QtMoc Include="QtUtils\PartiallyClosableTabWidget.h" />
|
<QtMoc Include="QtUtils\PartiallyClosableTabWidget.h" />
|
||||||
|
<ClInclude Include="QtUtils\QtUtils.h" />
|
||||||
<ClInclude Include="QtUtils\SetWindowDecorations.h" />
|
<ClInclude Include="QtUtils\SetWindowDecorations.h" />
|
||||||
<QtMoc Include="QtUtils\UTF8CodePointCountValidator.h" />
|
<QtMoc Include="QtUtils\UTF8CodePointCountValidator.h" />
|
||||||
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
|
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2024 Dolphin Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||||
|
|
||||||
|
#include <QDateTimeEdit>
|
||||||
|
|
||||||
|
namespace QtUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
void ShowFourDigitYear(QDateTimeEdit* widget)
|
||||||
|
{
|
||||||
|
if (!widget->displayFormat().contains(QStringLiteral("yyyy")))
|
||||||
|
{
|
||||||
|
// Always show the full year, no matter what the locale specifies. Otherwise, two-digit years
|
||||||
|
// will always be interpreted as in the 21st century.
|
||||||
|
widget->setDisplayFormat(
|
||||||
|
widget->displayFormat().replace(QStringLiteral("yy"), QStringLiteral("yyyy")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace QtUtils
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright 2024 Dolphin Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
class QDateTimeEdit;
|
||||||
|
|
||||||
|
namespace QtUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
void ShowFourDigitYear(QDateTimeEdit* widget);
|
||||||
|
|
||||||
|
}
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
#include "DolphinQt/Config/ConfigControls/ConfigBool.h"
|
||||||
|
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||||
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
||||||
#include "DolphinQt/Settings.h"
|
#include "DolphinQt/Settings.h"
|
||||||
|
|
||||||
|
@ -168,13 +169,7 @@ void AdvancedPane::CreateLayout()
|
||||||
m_custom_rtc_datetime->setDisplayFormat(m_custom_rtc_datetime->displayFormat().replace(
|
m_custom_rtc_datetime->setDisplayFormat(m_custom_rtc_datetime->displayFormat().replace(
|
||||||
QStringLiteral("mm"), QStringLiteral("mm:ss")));
|
QStringLiteral("mm"), QStringLiteral("mm:ss")));
|
||||||
|
|
||||||
if (!m_custom_rtc_datetime->displayFormat().contains(QStringLiteral("yyyy")))
|
QtUtils::ShowFourDigitYear(m_custom_rtc_datetime);
|
||||||
{
|
|
||||||
// Always show the full year, no matter what the locale specifies. Otherwise, two-digit years
|
|
||||||
// will always be interpreted as in the 21st century.
|
|
||||||
m_custom_rtc_datetime->setDisplayFormat(m_custom_rtc_datetime->displayFormat().replace(
|
|
||||||
QStringLiteral("yy"), QStringLiteral("yyyy")));
|
|
||||||
}
|
|
||||||
m_custom_rtc_datetime->setDateTimeRange(QDateTime({2000, 1, 1}, {0, 0, 0}, Qt::UTC),
|
m_custom_rtc_datetime->setDateTimeRange(QDateTime({2000, 1, 1}, {0, 0, 0}, Qt::UTC),
|
||||||
QDateTime({2099, 12, 31}, {23, 59, 59}, Qt::UTC));
|
QDateTime({2099, 12, 31}, {23, 59, 59}, Qt::UTC));
|
||||||
m_custom_rtc_datetime->setTimeSpec(Qt::UTC);
|
m_custom_rtc_datetime->setTimeSpec(Qt::UTC);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "Core/IOS/USB/Emulated/Skylanders/Skylander.h"
|
#include "Core/IOS/USB/Emulated/Skylanders/Skylander.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
|
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||||
|
|
||||||
SkylanderModifyDialog::SkylanderModifyDialog(QWidget* parent, u8 slot)
|
SkylanderModifyDialog::SkylanderModifyDialog(QWidget* parent, u8 slot)
|
||||||
|
@ -168,8 +169,9 @@ void SkylanderModifyDialog::PopulateSkylanderOptions(QVBoxLayout* layout)
|
||||||
edit_nick->setValidator(
|
edit_nick->setValidator(
|
||||||
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^\\p{L}{0,15}$")), this));
|
new QRegularExpressionValidator(QRegularExpression(QStringLiteral("^\\p{L}{0,15}$")), this));
|
||||||
edit_playtime->setValidator(new QIntValidator(0, INT_MAX, this));
|
edit_playtime->setValidator(new QIntValidator(0, INT_MAX, this));
|
||||||
edit_last_reset->setDisplayFormat(QStringLiteral("dd/MM/yyyy hh:mm"));
|
|
||||||
edit_last_placed->setDisplayFormat(QStringLiteral("dd/MM/yyyy hh:mm"));
|
QtUtils::ShowFourDigitYear(edit_last_reset);
|
||||||
|
QtUtils::ShowFourDigitYear(edit_last_placed);
|
||||||
|
|
||||||
edit_toy_code->setToolTip(tr("The toy code for this figure. Only available for real figures."));
|
edit_toy_code->setToolTip(tr("The toy code for this figure. Only available for real figures."));
|
||||||
edit_money->setToolTip(tr("The amount of money this Skylander has. Between 0 and 65000"));
|
edit_money->setToolTip(tr("The amount of money this Skylander has. Between 0 and 65000"));
|
||||||
|
|
Loading…
Reference in New Issue