this->backbone = backbone;
+ initializeUI();
+
+ connectBackbone();
+ connectSearchBar();
+ connectWordList();
+ connectTranslationWidget();
+ connectDictManager();
+ connectMenu();
+
+ setExactSearch(false);
+
+ setWindowTitle("mDictionary");
+}
+
+MainWindow::~MainWindow() {
+ delete ui;
+}
+
+
+void MainWindow::initializeUI() {
ui->setupUi(this);
//sets attribute to maemo's stacked window
menuWidget->addSubMenu(tr("About"), new QPushButton("About"));
ui->menuBar->addAction(menuWidget);
-
- connectBackbone();
- connectSearchBar();
- connectWordList();
- connectTranslationWidget();
- connectDictManager();
- connectMenu();
-
- setExactSearch(false);
-
- setWindowTitle("mDictionary");
-}
-
-MainWindow::~MainWindow() {
- delete ui;
}
-
void MainWindow::closeEvent(QCloseEvent *event) {
//reqest to stop all searches and close app
emit quit();
Backbone* backbone;
Ui::MainWindow *ui;
+ void initializeUI();
+
SearchBarWidget* searchBarWidget;
TranslationWidget* translationWidget;
p = p.transformed(m);
}
+
QIcon newIcon;
newIcon.addPixmap(p);
- QPainter painter(&p);
- painter.fillRect(p.rect(), QColor(0,0,0,192));
+ #ifdef Q_WS_MAEMO_5
+ QPainter painter(&p);
+ painter.fillRect(p.rect(), QColor(0,0,0,192));
- newIcon.addPixmap(p, QIcon::Disabled, QIcon::Off);
+ newIcon.addPixmap(p, QIcon::Disabled, QIcon::Off);
+ #endif
return newIcon;
}
searchPushButton = new QPushButton(tr("Search"));
searchPushButton->setMinimumWidth(150);
-
+ #ifndef Q_WS_MAEMO_5
+ searchPushButton->setMinimumHeight(
+ searchPushButton->sizeHint().height()*2);
+ #endif
searchWordLineEdit = new QLineEdit();
searchWordLineEdit->setMinimumWidth(300);
+ #ifndef Q_WS_MAEMO_5
+ searchWordLineEdit->setMinimumHeight(
+ searchWordLineEdit->sizeHint().height()*2);
+ #endif
+
//create layout for lineEdit to have clear button on it
clearSearchWordToolButton = new QToolButton();
- clearSearchWordToolButton->setIcon(QIcon::fromTheme("general_stop"));
- //tool buttons will have size 2 times smaller
- clearSearchWordToolButton->setMaximumSize(
- clearSearchWordToolButton->sizeHint().width()/2,
- clearSearchWordToolButton->sizeHint().height()/2);
+
+ #ifdef Q_WS_MAEMO_5
+ clearSearchWordToolButton->setIcon(QIcon::fromTheme("general_stop"));
+ //tool buttons will have size 2 times smaller
+ clearSearchWordToolButton->setMaximumSize(
+ clearSearchWordToolButton->sizeHint().height()/2,
+ clearSearchWordToolButton->sizeHint().height()/2);
+ #else
+ clearSearchWordToolButton->setIcon(QIcon::fromTheme("edit-clear"));
+ clearSearchWordToolButton->setMinimumSize(
+ clearSearchWordToolButton->sizeHint().height(),
+ clearSearchWordToolButton->sizeHint().height());
+ #endif
historyNextToolButton = new QToolButton();
- historyNextToolButton->setIcon(
- generateIcon(QIcon::fromTheme("general_forward")));
+ #ifdef Q_WS_MAEMO_5
+ historyNextToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("general_forward")));
+ #else
+ historyNextToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("go-next")));
+ historyNextToolButton->setMinimumSize(
+ clearSearchWordToolButton->sizeHint().height()*2,
+ clearSearchWordToolButton->sizeHint().height()*2);
+ #endif
historyPrevToolButton = new QToolButton();
- historyPrevToolButton->setIcon(
- generateIcon(QIcon::fromTheme("general_back")));
+ #ifdef Q_WS_MAEMO_5
+ historyPrevToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("general_back")));
+ #else
+ historyPrevToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("go-previous")));
+ historyPrevToolButton->setMinimumSize(
+ clearSearchWordToolButton->sizeHint().height()*2,
+ clearSearchWordToolButton->sizeHint().height()*2);
+ #endif
historyShowToolButton = new QToolButton();
- historyShowToolButton->setIcon(
- generateIcon(QIcon::fromTheme("general_back"), 90));
-
+ #ifdef Q_WS_MAEMO_5
+ historyShowToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("general_back"), 90));
+ #else
+ historyShowToolButton->setIcon(
+ generateIcon(QIcon::fromTheme("go-up")));
+ historyShowToolButton->setMinimumSize(
+ clearSearchWordToolButton->sizeHint().height()*2,
+ clearSearchWordToolButton->sizeHint().height()*2);
+ #endif
searchingProgressBar = new QProgressBar();
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "XdxfCachingDialog.h"
+#include "xdxfplugin.h"
+#include <QDebug>
+
+
+XdxfCachingDialog::XdxfCachingDialog(XdxfPlugin *parent) :
+ QDialog(0)
+{
+ verticalLayout = new QVBoxLayout;
+ setLayout(verticalLayout);
+
+ setWindowTitle(tr("Caching dictionary, please wait"));
+ cachingProgressBar = new QProgressBar;
+ cachingProgressBar->setMinimum(0);
+ cachingProgressBar->setMaximum(100);
+ cachingProgressBar->setTextVisible(true);
+
+ cancelButton = new QPushButton(tr("Cancel"));
+
+
+ verticalLayout->addWidget(cachingProgressBar);
+ verticalLayout->addWidget(cancelButton);
+
+ connect(cancelButton, SIGNAL(clicked()),
+ this, SIGNAL(cancelCaching()));
+
+ connect(parent, SIGNAL(updateCachingProgress(int, int)),
+ this, SLOT(updateCachingProgress(int, int)));
+
+ time.start();
+}
+
+void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
+ cachingProgressBar->setValue(progress);
+
+
+ int seconds = float((100 - progress)*time) / (5*1000);
+
+ setWindowTitle(tr("Caching dictionary, please wait ") + "( " +
+ QString::number(seconds) + tr(" seconds left") + " )");
+
+}
+
+void XdxfCachingDialog::reject() {
+ return;
+}
--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef XDXFCACHINGDIALOG_H
+#define XDXFCACHINGDIALOG_H
+
+#include <QDialog>
+#include <QtGui>
+
+
+class XdxfPlugin;
+
+
+class XdxfCachingDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit XdxfCachingDialog(XdxfPlugin *parent = 0);
+
+Q_SIGNALS:
+ void cancelCaching();
+
+public Q_SLOTS:
+ void reject();
+
+private Q_SLOTS:
+ void cancelButtonClicked();
+ void updateCachingProgress(int, int);
+
+private:
+ QLabel* cachingLabel;
+ QProgressBar* cachingProgressBar;
+ QPushButton* cancelButton;
+ QVBoxLayout* verticalLayout;
+ QTime time;
+};
+
+#endif // XDXFCACHINGDIALOG_H