Skip to content

Commit

Permalink
Final stretch, translations gone for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaiser committed Apr 15, 2014
1 parent b4c2386 commit 28e8a14
Show file tree
Hide file tree
Showing 29 changed files with 78 additions and 9,613 deletions.
48 changes: 42 additions & 6 deletions dialogs/namingdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,31 @@
<string>Naming Options - Lightscreen</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QWidget" name="container" native="true">
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="margin">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<item>
Expand All @@ -36,7 +54,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="namePageLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
Expand Down Expand Up @@ -88,10 +115,19 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<property name="leftMargin">
<number>0</number>
</property>
<property name="margin">
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
Expand Down Expand Up @@ -125,7 +161,7 @@
<string notr="true">margin-left: 4px</string>
</property>
<property name="text">
<string notr="true"> &lt;a href=&quot;http://lightscreen.sourceforge.net/help/date&quot;&gt;[?]&lt;/a&gt;</string>
<string notr="true"> &lt;a href=&quot;http://lightscreen.com.ar/help#date&quot;&gt;[?]&lt;/a&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
68 changes: 1 addition & 67 deletions dialogs/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,9 @@ void OptionsDialog::checkUpdatesNow()
Updater::instance()->checkWithFeedback();
}

void OptionsDialog::languageChange(QString language)
{
os::translate(language);
}

void OptionsDialog::loadSettings()
{
settings()->sync();
os::translate(settings()->value("options/language").toString()); // Why? Don't ask me, I'm just the programmer.

setUpdatesEnabled(false);

if (!settings()->contains("file/format")) {
Expand Down Expand Up @@ -194,16 +187,6 @@ void OptionsDialog::loadSettings()
ui.cursorCheckBox->setVisible(false);
ui.cursorCheckBox->setChecked(false);
#endif

//TODO: Must replace with not-stupid system
QString lang = settings()->value("language").toString();
int index = ui.languageComboBox->findText(lang);

if (index == -1)
index = ui.languageComboBox->findText("English");

ui.languageComboBox->setCurrentIndex(index);

settings()->endGroup();

settings()->beginGroup("actions");
Expand Down Expand Up @@ -264,11 +247,6 @@ void OptionsDialog::openUrl(QString url)
}
}

void OptionsDialog::rejected()
{
languageChange(settings()->value("options/language").toString()); // Revert language to default.
}

void OptionsDialog::saveSettings()
{
settings()->beginGroup("file");
Expand All @@ -289,8 +267,6 @@ void OptionsDialog::saveSettings()
settings()->setValue("message", ui.messageCheckBox->isChecked());
settings()->setValue("quality", ui.qualitySlider->value());
settings()->setValue("playSound", ui.playSoundCheckBox->isChecked());
// We save the explicit string because addition/removal of language files can cause it to change
settings()->setValue("language", ui.languageComboBox->currentText());
// This settings is inverted because the first iteration of the Updater did not have a settings but instead relied on the messagebox choice of the user.
settings()->setValue("disableUpdater", !ui.updaterCheckBox->isChecked());
settings()->setValue("magnify", ui.magnifyCheckBox->isChecked());
Expand Down Expand Up @@ -391,28 +367,7 @@ void OptionsDialog::viewHistory()

bool OptionsDialog::event(QEvent* event)
{
if (event->type() == QEvent::LanguageChange) {

// ComboBoxes revert to the first index when translated:
int naming = ui.namingComboBox->currentIndex();
int format = ui.formatComboBox->currentIndex();
int previewPosition = ui.previewPositionComboBox->currentIndex();
int previewAutoclose = ui.previewAutocloseActionComboBox->currentIndex();
int previewDefault = ui.previewDefaultActionComboBox->currentIndex();

ui.retranslateUi(this);

// Restoring comboboxes
ui.namingComboBox->setCurrentIndex(naming);
ui.formatComboBox->setCurrentIndex(format);
ui.previewPositionComboBox->setCurrentIndex(previewPosition);
ui.previewAutocloseActionComboBox->setCurrentIndex(previewAutoclose);
ui.previewDefaultActionComboBox->setCurrentIndex(previewDefault);

updatePreview();
resize(minimumSizeHint());
}
else if (event->type() == QEvent::Close || event->type() == QEvent::Hide) {
if (event->type() == QEvent::Close || event->type() == QEvent::Hide) {
settings()->setValue("geometry/optionsDialog", saveGeometry());

if (!settings()->contains("file/format")) {
Expand Down Expand Up @@ -476,11 +431,7 @@ void OptionsDialog::dialogButtonClicked(QAbstractButton *button)
if (msgBox.clickedButton() == dontRestoreButton)
return;

QString language = settings()->value("options/language").toString(); // Only maintain language.

settings()->clear();
settings()->setValue("options/language", language);

loadSettings();
}
}
Expand Down Expand Up @@ -548,7 +499,6 @@ void OptionsDialog::init()

connect(ui.buttonBox , SIGNAL(clicked(QAbstractButton*)), this , SLOT(dialogButtonClicked(QAbstractButton*)));
connect(ui.buttonBox , SIGNAL(accepted()) , this , SLOT(accepted()));
connect(ui.buttonBox , SIGNAL(rejected()) , this , SLOT(rejected()));
connect(ui.namingOptionsButton , SIGNAL(clicked()) , this , SLOT(namingOptions()));

connect(ui.prefixLineEdit , SIGNAL(textEdited(QString)) , this , SLOT(updatePreview()));
Expand Down Expand Up @@ -580,25 +530,9 @@ void OptionsDialog::init()
connect(ui.uploadCheckBox , SIGNAL(toggled(bool)), ui.previewDefaultActionComboBox, SLOT(setDisabled(bool)));
connect(ui.directoryCheckBox , SIGNAL(toggled(bool)), ui.directoryHotkeyWidget, SLOT(setEnabled(bool)));

connect(ui.moreInformationLabel, SIGNAL(linkActivated(QString)) , this, SLOT(openUrl(QString)));

connect(ui.languageComboBox , SIGNAL(currentIndexChanged(QString)), this, SLOT(languageChange(QString)));

connect(ui.mainLabel , SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
connect(ui.licenseAboutLabel, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
connect(ui.linksLabel, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));

//
// Languages
//

QDir languages(":/translations");

ui.languageComboBox->addItem("English");

foreach (QString language, languages.entryList()) {
ui.languageComboBox->addItem(language);
}
}

void OptionsDialog::namingOptions()
Expand Down
2 changes: 0 additions & 2 deletions dialogs/optionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ class OptionsDialog : public QDialog
public slots:
void accepted();
void checkUpdatesNow();
void languageChange(QString language);
void loadSettings();
void openUrl(QString url);
void rejected();
void saveSettings();
void updatePreview();
void viewHistory();
Expand Down
51 changes: 3 additions & 48 deletions dialogs/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Quality is related to file size and of course to readability and overall quality
<x>0</x>
<y>0</y>
<width>358</width>
<height>803</height>
<height>775</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down Expand Up @@ -733,50 +733,6 @@ Quality is related to file size and of course to readability and overall quality
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="languageLayout">
<item>
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>&amp;Language:</string>
</property>
<property name="buddy">
<cstring>languageComboBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="moreInformationLabel">
<property name="whatsThis">
<string>Click here to go to the Lightscreen homepage to learn more about translations.</string>
</property>
<property name="text">
<string>&lt;a href=&quot;http://lightscreen.sourceforge.net/translation&quot;&gt;More information..&lt;/a&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="languageSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1294,8 +1250,7 @@ Created by &lt;a href=&quot;http://ckaiser.com.ar&quot;&gt;Christian Kaiser&lt;/
<item>
<widget class="QLabel" name="licenseAboutLabel">
<property name="text">
<string>Released under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;GNU General Public License&lt;/a&gt;.&lt;br&gt;&lt;br&gt;
Special thanks goes to the &lt;a href=&quot;http://lightscreen.sourceforge.net/about&quot;&gt;Donators and Translators&lt;/a&gt;.</string>
<string>Released under the &lt;a href=&quot;http://www.gnu.org/licenses/gpl-2.0.html&quot;&gt;GNU General Public License&lt;/a&gt;.</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
Expand All @@ -1319,7 +1274,7 @@ Special thanks goes to the &lt;a href=&quot;http://lightscreen.sourceforge.net/a
<item>
<widget class="QLabel" name="linksLabel">
<property name="text">
<string>&lt;a href=&quot;https://sourceforge.net/projects/lightscreen/&quot;&gt;Visit Sourceforge project site&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://lightscreen.sourceforge.net/&quot;&gt;Visit Lightscreen home page&lt;/a&gt;</string>
<string>&lt;a href=&quot;https://github.com/ckaiser/Lightscreen/&quot;&gt;GitHub page&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://lightscreen.com.ar/&quot;&gt;Lightscreen home page&lt;/a&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
6 changes: 3 additions & 3 deletions dialogs/updaterdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "updaterdialog.h"
#include "../tools/os.h"

UpdaterDialog::UpdaterDialog() :
QProgressDialog("", tr("Cancel"), 0, 0)
UpdaterDialog::UpdaterDialog(QWidget *parent) :
QProgressDialog("", tr("Cancel"), 0, 0, parent)
{
setWindowTitle(tr("Updater - Lightscreen"));
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
Expand All @@ -47,7 +47,7 @@ QProgressDialog("", tr("Cancel"), 0, 0)
void UpdaterDialog::updateDone(bool result)
{
if (result) {
setLabelText(tr("There's a new version available,<br> please see <a href=\"http://lightscreen.sourceforge.net/whatsnew/%1\">the Lighscreen website</a>.").arg(qApp->applicationVersion()));
setLabelText(tr("There's a new version available,<br> please see <a href=\"http://lightscreen.com.ar/whatsnew/%1\">the Lighscreen website</a>.").arg(qApp->applicationVersion()));
}
else {
setLabelText(tr("No new versions available."));
Expand Down
2 changes: 1 addition & 1 deletion dialogs/updaterdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class UpdaterDialog : public QProgressDialog
Q_OBJECT

public:
UpdaterDialog();
UpdaterDialog(QWidget* parent = 0);

public slots:
void updateDone(bool result);
Expand Down
Loading

0 comments on commit 28e8a14

Please sign in to comment.