From: Mateusz Półrola Date: Mon, 30 Aug 2010 07:39:52 +0000 (+0200) Subject: Changed button labels in google plugin X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=92db990e531a31cf1986f3cb16ad6f95d357f138;p=mdictionary Changed button labels in google plugin --- diff --git a/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp b/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp index 39c1aec..555a143 100644 --- a/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp +++ b/trunk/src/plugins/google/src/GoogleSettingsDialog.cpp @@ -26,9 +26,11 @@ #include "GoogleSettingsDialog.h" #include -GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,QString langTo,QString langFrom) : - QDialog(parent) -{ +GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent, + QString langTo, + QString langFrom, + QString acceptButtonLabel) : + QDialog(parent) { QMap languages; languages=GooglePlugin::initLanguages(); @@ -45,9 +47,12 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,QString langTo,QStrin #ifdef Q_WS_MAEMO_5 - changeLangButton=new QPushButton(QIcon::fromTheme("general_refresh"),tr("")); + changeLangButton=new + QPushButton( + QIcon::fromTheme("general_refresh"),tr("")); #else - changeLangButton=new QPushButton(QIcon::fromTheme("object-flip-vertical"),tr("")); + changeLangButton=new QPushButton( + QIcon::fromTheme("object-flip-vertical"),tr("")); #endif langFromLabel = new QLabel("From:"); langToLabel = new QLabel(" To: "); @@ -58,22 +63,22 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,QString langTo,QStrin setWindowTitle(tr("Google Settings")); - verticalLayout = new QVBoxLayout(this); - langLayout = new QVBoxLayout(this); - langFromLayout = new QHBoxLayout(this); - langToLayout = new QHBoxLayout(this); - changelangLayout = new QHBoxLayout(this); + verticalLayout = new QVBoxLayout; + langLayout = new QVBoxLayout; + langFromLayout = new QHBoxLayout; + langToLayout = new QHBoxLayout; + changelangLayout = new QHBoxLayout; setLayout(verticalLayout); - infoLabel = new QLabel(this); + infoLabel = new QLabel; infoLabel->setText(tr("Plugin:GoogleTranslator \n")+ tr("From: ") + languages.key(langFrom) + "\n" + tr("To: ") + languages.key(langTo)); verticalLayout->addWidget(infoLabel); - langFromComboBox = new QComboBox(this); - langToComboBox = new QComboBox(this); + langFromComboBox = new QComboBox; + langToComboBox = new QComboBox; int i=0; foreach(QString langs,languages.keys()){ if(langs==languages.key(langTo)) @@ -100,15 +105,19 @@ GoogleSettingsDialog::GoogleSettingsDialog(QWidget *parent,QString langTo,QStrin langToComboBox->setCurrentIndex(actualLangTo); langFromComboBox->setCurrentIndex(actualLangFrom); - saveButton = new QPushButton(tr("Save settings"),this); + saveButton = new QPushButton(acceptButtonLabel); verticalLayout->addWidget(saveButton); setModal(true); - connect(saveButton, SIGNAL(clicked()),this, SLOT(accept())); - connect(langFromComboBox, SIGNAL(activated(int)),this, SLOT(activatedFrom(int))); - connect(langToComboBox, SIGNAL(activated(int)),this, SLOT(activatedTo(int))); - connect(changeLangButton, SIGNAL(clicked()),this, SLOT(changeLangButtonClicked())); + connect(saveButton, SIGNAL(clicked()), + this, SLOT(accept())); + connect(langFromComboBox, SIGNAL(activated(int)), + this, SLOT(activatedFrom(int))); + connect(langToComboBox, SIGNAL(activated(int)), + this, SLOT(activatedTo(int))); + connect(changeLangButton, SIGNAL(clicked()), + this, SLOT(changeLangButtonClicked())); } void GoogleSettingsDialog::activatedFrom(int index) { @@ -138,23 +147,34 @@ QString GoogleSettingsDialog::langTo() { return _langTo; } -Settings* GoogleSettingsDialog::getSettings(QWidget *parent,QString langTo,QString langFrom) { - GoogleSettingsDialog settingsDialog(parent,langTo,langFrom); +Settings* GoogleSettingsDialog::getSettings(QWidget *parent, + QString langTo, + QString langFrom, + QString acceptButtonLabel) { + GoogleSettingsDialog settingsDialog(parent, + langTo, + langFrom, + acceptButtonLabel); QMap languages; languages=GooglePlugin::initLanguages(); if(settingsDialog.exec()==QDialog::Accepted) { Settings *settings = new Settings(); settings->setValue("langTo",languages.value(settingsDialog.langTo())); - settings->setValue("langFrom",languages.value(settingsDialog.langFrom())); + settings->setValue("langFrom", + languages.value(settingsDialog.langFrom())); settings->setValue("connectionAccept","true"); return settings; } return 0; } -void GoogleSettingsDialog::changeSettings(GooglePlugin* plugin, QWidget *parent) { +void GoogleSettingsDialog::changeSettings(GooglePlugin* plugin, + QWidget *parent) { Settings *settings = new Settings(); - settings=getSettings(parent,plugin->settings()->value("langTo"),plugin->settings()->value("langFrom")); + settings=getSettings(parent, + plugin->settings()->value("langTo"), + plugin->settings()->value("langFrom"), + tr("Save changes")); if(settings) plugin->setSettings(settings); } diff --git a/trunk/src/plugins/google/src/GoogleSettingsDialog.h b/trunk/src/plugins/google/src/GoogleSettingsDialog.h index 13ae5ee..866bda2 100644 --- a/trunk/src/plugins/google/src/GoogleSettingsDialog.h +++ b/trunk/src/plugins/google/src/GoogleSettingsDialog.h @@ -38,7 +38,10 @@ class GoogleSettingsDialog : public QDialog { Q_OBJECT public: - explicit GoogleSettingsDialog(QWidget *parent = 0,QString langTo ="",QString langFrom =""); + explicit GoogleSettingsDialog(QWidget *parent = 0, + QString langTo ="", + QString langFrom ="", + QString acceptButtonLabel = tr("Add")); /*! \param parent parent widget on which will be displayed dialog @@ -46,7 +49,10 @@ public: \param langFrom language witch is display in the comboBox as a startup item \returns function return settings to GooglePlugin */ - static Settings* getSettings(QWidget *parent,QString langTo ="",QString langFrom =""); + static Settings* getSettings(QWidget *parent, + QString langTo ="", + QString langFrom ="", + QString acceptButtonLabel = tr("Add")); /*! function set a new settings in plugin;