Qt: Make memory card convert dialog translatable

This commit is contained in:
Stenzek 2023-06-30 22:38:07 +10:00 committed by Connor McLaughlin
parent d757360f4e
commit a705a69022
2 changed files with 128 additions and 163 deletions

View File

@ -30,6 +30,13 @@ MemoryCardConvertDialog::MemoryCardConvertDialog(QWidget* parent, QString select
: QDialog(parent)
{
m_ui.setupUi(this);
// For some reason, setting these in the .ui doesn't work..
m_ui.conversionTypeDescription->setFrameStyle(QFrame::Sunken);
m_ui.conversionTypeDescription->setFrameShape(QFrame::WinPanel);
m_ui.note->setFrameStyle(QFrame::Sunken);
m_ui.note->setFrameShape(QFrame::WinPanel);
m_selectedCard = selectedCard;
std::optional<AvailableMcdInfo> srcCardInfo = FileMcd_GetCardInfo(m_selectedCard.toStdString());
@ -49,22 +56,22 @@ MemoryCardConvertDialog::MemoryCardConvertDialog(QWidget* parent, QString select
switch (m_srcCardInfo.type)
{
case MemoryCardType::File:
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, "Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card.");
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, tr("Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card."));
break;
case MemoryCardType::Folder:
switch (m_ui.conversionTypeSelect->currentData().toInt())
{
case 8:
SetType(MemoryCardType::File, MemoryCardFileType::PS2_8MB, "A standard, 8 MB Memory Card. Most compatible, but smallest capacity.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_8MB, tr("A standard, 8 MB Memory Card. Most compatible, but smallest capacity."));
break;
case 16:
SetType(MemoryCardType::File, MemoryCardFileType::PS2_16MB, "2x larger than a standard Memory Card. May have some compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_16MB, tr("2x larger than a standard Memory Card. May have some compatibility issues."));
break;
case 32:
SetType(MemoryCardType::File, MemoryCardFileType::PS2_32MB, "4x larger than a standard Memory Card. Likely to have compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_32MB, tr("4x larger than a standard Memory Card. Likely to have compatibility issues."));
break;
case 64:
SetType(MemoryCardType::File, MemoryCardFileType::PS2_64MB, "8x larger than a standard Memory Card. Likely to have compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_64MB, tr("8x larger than a standard Memory Card. Likely to have compatibility issues."));
break;
default:
//: MemoryCardType should be left as-is.
@ -153,7 +160,7 @@ bool MemoryCardConvertDialog::SetupPicklist()
{
case MemoryCardType::File:
m_ui.conversionTypeSelect->addItems({"Folder"});
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, "Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card.");
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, tr("Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card."));
break;
case MemoryCardType::Folder:
// Compute which file types should be allowed.
@ -183,7 +190,7 @@ bool MemoryCardConvertDialog::SetupPicklist()
if (sizeBytes < CardCapacity::_8_MB)
{
m_ui.conversionTypeSelect->addItem("8 MB File", 8);
m_ui.conversionTypeSelect->addItem(tr("8 MB File"), 8);
if (!typeSet)
{
@ -194,7 +201,7 @@ bool MemoryCardConvertDialog::SetupPicklist()
if (sizeBytes < CardCapacity::_16_MB)
{
m_ui.conversionTypeSelect->addItem("16 MB File", 16);
m_ui.conversionTypeSelect->addItem(tr("16 MB File"), 16);
if (!typeSet)
{
@ -205,7 +212,7 @@ bool MemoryCardConvertDialog::SetupPicklist()
if (sizeBytes < CardCapacity::_32_MB)
{
m_ui.conversionTypeSelect->addItem("32 MB File", 32);
m_ui.conversionTypeSelect->addItem(tr("32 MB File"), 32);
if (!typeSet)
{
@ -216,7 +223,7 @@ bool MemoryCardConvertDialog::SetupPicklist()
if (sizeBytes < CardCapacity::_64_MB)
{
m_ui.conversionTypeSelect->addItem("64 MB File", 64);
m_ui.conversionTypeSelect->addItem(tr("64 MB File"), 64);
if (!typeSet)
{
@ -284,30 +291,30 @@ void MemoryCardConvertDialog::SetType(MemoryCardType type, MemoryCardFileType fi
{
m_type = type;
m_fileType = fileType;
m_ui.conversionTypeDescription->setPlainText(description);
m_ui.conversionTypeDescription->setText(QStringLiteral("<center>%1</center>").arg(description));
}
void MemoryCardConvertDialog::SetType_8()
{
SetType(MemoryCardType::File, MemoryCardFileType::PS2_8MB, "A standard, 8 MB Memory Card. Most compatible, but smallest capacity.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_8MB, tr("A standard, 8 MB Memory Card. Most compatible, but smallest capacity."));
}
void MemoryCardConvertDialog::SetType_16()
{
SetType(MemoryCardType::File, MemoryCardFileType::PS2_16MB, "2x larger as a standard Memory Card. May have some compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_16MB, tr("2x larger as a standard Memory Card. May have some compatibility issues."));
}
void MemoryCardConvertDialog::SetType_32()
{
SetType(MemoryCardType::File, MemoryCardFileType::PS2_32MB, "4x larger than a standard Memory Card. Likely to have compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_32MB, tr("4x larger than a standard Memory Card. Likely to have compatibility issues."));
}
void MemoryCardConvertDialog::SetType_64()
{
SetType(MemoryCardType::File, MemoryCardFileType::PS2_64MB, "8x larger than a standard Memory Card. Likely to have compatibility issues.");
SetType(MemoryCardType::File, MemoryCardFileType::PS2_64MB, tr("8x larger than a standard Memory Card. Likely to have compatibility issues."));
}
void MemoryCardConvertDialog::SetType_Folder()
{
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, "Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card.");
SetType(MemoryCardType::Folder, MemoryCardFileType::Unknown, tr("Uses a folder on your PC filesystem, instead of a file. Infinite capacity, while keeping the same compatibility as an 8 MB Memory Card."));
}

View File

@ -10,27 +10,9 @@
<x>0</x>
<y>0</y>
<width>440</width>
<height>320</height>
<height>282</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>440</width>
<height>320</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>440</width>
<height>320</height>
</size>
</property>
<property name="windowTitle">
<string>Convert Memory Card</string>
</property>
@ -40,141 +22,117 @@
<property name="modal">
<bool>false</bool>
</property>
<widget class="QGroupBox" name="conversionTypeGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>421</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Conversion Type</string>
</property>
<widget class="QComboBox" name="conversionTypeSelect">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>401</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>8 MB File</string>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="conversionTypeGroup">
<property name="title">
<string>Conversion Type</string>
</property>
</item>
<item>
<property name="text">
<string>16 MB File</string>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QComboBox" name="conversionTypeSelect">
<item>
<property name="text">
<string>8 MB File</string>
</property>
</item>
<item>
<property name="text">
<string>16 MB File</string>
</property>
</item>
<item>
<property name="text">
<string>32 MB File</string>
</property>
</item>
<item>
<property name="text">
<string>64 MB File</string>
</property>
</item>
<item>
<property name="text">
<string>Folder</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="conversionTypeDescription">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
</item>
<item>
<property name="text">
<string>32 MB File</string>
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="note">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
</item>
<item>
<property name="text">
<string>64 MB File</string>
<string>&lt;center&gt;&lt;strong&gt;Note:&lt;/strong&gt; Converting a Memory Card creates a &lt;strong&gt;COPY&lt;/strong&gt; of your existing Memory Card. It does &lt;strong&quot;&gt;NOT delete, modify, or replace&lt;/strong&gt; your existing Memory Card.&lt;/center&gt;</string>
</property>
</item>
<item>
<property name="text">
<string>Folder</string>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</item>
</widget>
</widget>
<widget class="QTextBrowser" name="note">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>421</width>
<height>61</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Note: Converting a Memory Card creates a COPY of your existing Memory Card. It does NOT delete, modify, or replace your existing Memory Card.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextBrowser" name="conversionTypeDescription">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>421</width>
<height>61</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>270</x>
<y>290</y>
<width>156</width>
<height>24</height>
</rect>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QGroupBox" name="progressGroup">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>421</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Progress</string>
</property>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>401</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</widget>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="progressGroup">
<property name="title">
<string>Progress</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>