Some changes in look of xdxf dialog on desktop
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 06:37:17 +0000 (08:37 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 7 Sep 2010 06:37:17 +0000 (08:37 +0200)
src/mdictionary/gui/MainWindow.cpp
src/plugins/xdxf/XdxfDialog.cpp
src/plugins/xdxf/XdxfDialog.h

index c5a6cc1..a26c999 100644 (file)
@@ -85,8 +85,6 @@ void MainWindow::initializeUI() {
     initializeSearchWidgets();
 
     initializeMenu();
-
-
 }
 
 void MainWindow::initializeSearchWidgets() {
index c34b50a..0927061 100644 (file)
@@ -31,6 +31,10 @@ XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
     this->plugin = plugin;
     this->type = type;
 
+
+    cacheToolTip = tr("Optimize for quicker searches (may take some time)");
+    accentsToolTip = tr("Strip accents (searching takes more time, but spelling don't have to be exact)");
+
     initializeUI();
 
     connect(cacheCheckBox, SIGNAL(toggled(bool)),
@@ -39,23 +43,22 @@ XdxfDialog::XdxfDialog(XdxfPlugin *plugin,
     connect(accentsCheckBox, SIGNAL(toggled(bool)),
             this, SLOT(setAccents(bool)));
 
-    connect(accentsInfoToolButton, SIGNAL(clicked()),
-             this, SLOT(showAccentsInfo()));
+    #ifdef Q_WS_MAEMO_5
+        connect(accentsInfoToolButton, SIGNAL(clicked()),
+                 this, SLOT(showAccentsInfo()));
 
-    connect(cacheInfoToolButton, SIGNAL(clicked()),
-             this, SLOT(showCacheInfo()));
+        connect(cacheInfoToolButton, SIGNAL(clicked()),
+                 this, SLOT(showCacheInfo()));
+    #endif
 
     if(type == New) {
         connect(browseButton, SIGNAL(clicked()),
                 this, SLOT(selectFile()));
-
-        connect(addButton, SIGNAL(clicked()),
-                this, SLOT(accept()));
-    }
-    else {
-        connect(saveButton, SIGNAL(clicked()),
-                this, SLOT(accept()));
     }
+
+    connect(confirmButton, SIGNAL(clicked()),
+            this, SLOT(accept()));
+
 }
 
 
@@ -64,15 +67,17 @@ void XdxfDialog::initializeUI() {
     widget = new QWidget;
     widget->setLayout(mainVerticalLayout);
 
+    infoLabel = new QLabel;
+    infoLabel->setWordWrap(true);
+
     if(type == New) {
         setWindowTitle(tr("Add new XDXF dictionary"));
 
-
         browseLayout = new QHBoxLayout;
         browseButton = new QPushButton(tr("Browse"));
-        browseLabel = new QLabel(tr("Dictionary file: not selected"));
+        infoLabel->setText(tr("Dictionary file: not selected"));
 
-        browseLayout->addWidget(browseLabel, 0, Qt::AlignLeft);
+        browseLayout->addWidget(infoLabel, 0, Qt::AlignLeft);
         browseLayout->addWidget(browseButton, 0, Qt::AlignRight);
 
         mainVerticalLayout->addLayout(browseLayout);
@@ -80,34 +85,33 @@ void XdxfDialog::initializeUI() {
     else {
         setWindowTitle(tr("XDXF Settings"));
 
-
-        infoLabel = new QLabel;
-
         infoLabel->setText(tr("Plugin: ") + plugin->type().toUpper() +"\n" +
                        tr("From: ") + plugin->langFrom() + "\n" +
                        tr("To: ") + plugin->langTo() + "\n" +
                        tr("Description: ") + plugin->name() + "\n" +
                        tr("License: ") + plugin->infoNote());
-        infoLabel->setWordWrap(true);
         mainVerticalLayout->addWidget(infoLabel);
     }
 
-    accentsCheckBox = new QCheckBox(tr("Strip accents"));
-    accentsInfoToolButton = new QToolButton;
-    accentsInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
-
     accentsLayout = new QHBoxLayout;
-    accentsLayout->addWidget(accentsCheckBox);
-    accentsLayout->addWidget(accentsInfoToolButton);
-
-
-    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches"));
-    cacheInfoToolButton = new QToolButton;
-    cacheInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
+    accentsCheckBox = new QCheckBox(tr("Strip accents"));
+    accentsCheckBox->setToolTip(accentsToolTip);
+    accentsLayout->addWidget(accentsCheckBox); 
+    #ifdef Q_WS_MAEMO_5
+        accentsInfoToolButton = new QToolButton;
+        accentsInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
+        accentsLayout->addWidget(accentsInfoToolButton);
+    #endif
 
     cacheLayout = new QHBoxLayout;
+    cacheCheckBox = new QCheckBox(tr("Optimize for quicker searches"));
+    cacheCheckBox->setToolTip(cacheToolTip);
     cacheLayout->addWidget(cacheCheckBox);
-    cacheLayout->addWidget(cacheInfoToolButton);
+    #ifdef Q_WS_MAEMO_5
+        cacheInfoToolButton = new QToolButton;
+        cacheInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
+        cacheLayout->addWidget(cacheInfoToolButton);
+    #endif
 
     mainVerticalLayout->addLayout(cacheLayout);
     mainVerticalLayout->addLayout(accentsLayout);
@@ -143,23 +147,29 @@ void XdxfDialog::initializeUI() {
         }
     }
 
+    confirmButton = new QPushButton;
+    mainVerticalLayout->addWidget(confirmButton);
     if(type == New) {
-        addButton = new QPushButton(tr("Add"));
-        mainVerticalLayout->addWidget(addButton);
+        confirmButton->setText(tr("Add"));
     }
     else {
-        saveButton = new QPushButton(tr("Save settings"));
-        mainVerticalLayout->addWidget(saveButton);
+        confirmButton->setText(tr("Save settings"));
     }
 
     scrollArea = new QScrollArea;
     scrollArea->setWidget(widget);
     scrollArea->setWidgetResizable(true);
-    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    #ifdef Q_WS_MAEMO_5
+        scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    #endif
 
     layout = new QHBoxLayout;
     layout->addWidget(scrollArea);
     setLayout(layout);
+
+    #ifndef Q_WS_MAEMO_5
+        setMinimumSize(400,200);
+    #endif
 }
 
 
@@ -189,7 +199,7 @@ void XdxfDialog::selectFile() {
                                      NULL);
 
     if (!fileName.isEmpty()) {
-        browseLabel->setText(tr("Dictionary file: %1").arg(fileName));
+        infoLabel->setText(tr("Dictionary file: %1").arg(fileName));
         _dictionaryFilePath = fileName;
     }
 }
@@ -230,12 +240,13 @@ Settings* XdxfDialog::getSettings() {
     return _settings;
 }
 
-void XdxfDialog::showCacheInfo() {
-    Q_EMIT notify(Notify::Warning, tr("Optimize for quicker searches (may take some time)"));
-}
+#ifdef Q_WS_MAEMO_5
+    void XdxfDialog::showCacheInfo() {
+        Q_EMIT notify(Notify::Warning, cacheToolTip);
+    }
 
-void XdxfDialog::showAccentsInfo() {
-    Q_EMIT notify(Notify::Warning, tr("Strip accents (searching takes more "
-                                   "time, but spelling don't have to be exact)"));
-}
+    void XdxfDialog::showAccentsInfo() {
+        Q_EMIT notify(Notify::Warning, accentsToolTip);
+    }
+#endif
 
index d1c8225..c5bea58 100644 (file)
@@ -35,7 +35,8 @@ class XdxfDialog : public QDialog
 public:
     enum XdxfDialogType {New, Change};
 
-    explicit XdxfDialog(XdxfPlugin* plugin = 0, XdxfDialogType type = New,
+    explicit XdxfDialog(XdxfPlugin* plugin = 0,
+                        XdxfDialogType type = New,
                         QWidget *parent = 0);
 
     Settings* getSettings();
@@ -52,28 +53,35 @@ private Q_SLOTS:
     void setGenerateCache(bool);
     void setAccents(bool);
 
-    void showCacheInfo();
-    void showAccentsInfo();
+    #ifdef Q_WS_MAEMO_5
+        void showCacheInfo();
+        void showAccentsInfo();
+    #endif
 
 
 private:
     void initializeUI();
 
-    QLabel* browseLabel;
+    QLabel* infoLabel;
     QPushButton* browseButton;
     QHBoxLayout* browseLayout;
 
-    QLabel* infoLabel;
 
     QCheckBox* cacheCheckBox;
     QCheckBox* accentsCheckBox;
     QHBoxLayout* cacheLayout;
     QHBoxLayout* accentsLayout;
-    QToolButton* cacheInfoToolButton;
-    QToolButton* accentsInfoToolButton;
 
-    QPushButton* saveButton;
-    QPushButton* addButton;
+    QString cacheToolTip;
+    QString accentsToolTip;
+
+    #ifdef Q_WS_MAEMO_5
+        QToolButton* cacheInfoToolButton;
+        QToolButton* accentsInfoToolButton;
+    #endif
+
+
+    QPushButton* confirmButton;
 
     QString _dictionaryFilePath;