infoNote = "<center><h2><u>mDictionary</u></h2></center>";
comarchNote = "<center>Meamo/Meego Multilingual Dictionary</center>";
comarchNote += "<center>Copyright 2006-2010, Comarch S.A. <br>";
- comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">http://mdictionary.garage.maemo.org</a></center>";
- licenseNote = QString("<br><p><font size=\"small\">This program is free software: you can redistribute it and/or modify\n")+
- QString("it under the terms of the GNU General Public License as published by\n")+
- QString("the Free Software Foundation, either version 3 of the License, or\n")+
- QString("(at your option) any later version.<br>")+
- QString("This program is distributed in the hope that it will be useful,\n")+
- QString("but WITHOUT ANY WARRANTY; without even the implied warranty of\n")+
- QString("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")+
- QString("GNU General Public License for more details.<br>") +
- QString("You should have received a copy of the GNU General Public License<br>") +
- QString("along with this program. If not, see") +
- QString("<<a href=\"http://www.gnu.org/licenses/\">") +
- QString("http://www.gnu.org/licenses/</a>>.") +
- QString("</p></font>");
+ comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">"
+ "http://mdictionary.garage.maemo.org</a></center>";
+ licenseNote = QString("<br><p><font size=\"small\">This program is free"
+ "software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as"
+ "published by\n"
+ "the Free Software Foundation, either version 3 of the License,"
+ "or\n"
+ "(at your option) any later version.<br>"
+ "This program is distributed in the hope that it will be"
+ "useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty"
+ "of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
+ "See the\n"
+ "GNU General Public License for more details.<br>"
+ "You should have received a copy of the GNU General Public "
+ "License<br>"
+ "along with this program. If not, see"
+ "<<a href=\"http://www.gnu.org/licenses/\">"
+ "http://www.gnu.org/licenses/</a>>."
+ "</p></font>");
setWindowTitle(tr("About"));
mainLayout = new QVBoxLayout;
//! Implements bookmarks management widget
/*!
Allows user to show all or remove all bookmarks
- */
+*/
class BookmarksWidget : public QDialog
{
Q_OBJECT
#include <QDBusAbstractAdaptor>
#include "MainWindow.h"
+/*!
+ Implements dbus adapter which defines dbus interface for application.
+ Other application can use this interface to call mdictionary methods.
+*/
class DBusAdapter : public QDBusAbstractAdaptor
{
Q_OBJECT
explicit DBusAdapter(MainWindow* w);
public slots:
- void search(QString);
+ //! Search for given word
+ void search(QString word);
+
+ //! Shows application in foreground, can be used to trun on mdictionary
+ //! by another application
void showApplication();
private:
DictManagerWidget::DictManagerWidget(GUIInterface *parent) :
QDialog(parent) {
-
-
-
setWindowTitle(tr("Dictionaries"));
this->guiInterface = parent;
+ initalizeUI();
+}
+
+void DictManagerWidget::initalizeUI() {
verticalLayout = new QVBoxLayout;
setLayout(verticalLayout);
void DictManagerWidget::saveChanges() {
#ifndef Q_WS_MAEMO_5
- if(_save) {
+ if(_save) {
#else
- if(_changed &&
- QMessageBox::question(this, tr("Save"), tr("Do you want to save changes?"),
- QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
+ if(_changed &&
+ QMessageBox::question(this, tr("Save"),
+ tr("Do you want to save changes?"),
+ QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
#endif
QList<CommonDictInterface*> checkedDicts;
}
}
-void DictManagerWidget::hideEvent(QHideEvent *e)
-{
+void DictManagerWidget::hideEvent(QHideEvent *e) {
saveChanges();
QWidget::hideEvent(e);
}
}
void DictManagerWidget::removeButtonClicked() {
- qDebug()<<dictsHash.count();
if(QMessageBox::question(this, tr("Remove dictionary"),
tr("Do you want to remove selected dictionary?"),
- QMessageBox::Yes, QMessageBox::Cancel) == QMessageBox::Yes) {
+ QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
+
QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
if(selected.count() > 0) {
emit removeDictionary(dictsHash[selected[0]]);
It allows to change dicts states, add new dict, remove selected one or
change settings of selected dict. All changes are saved automatically after
hiding of this widget.
- */
+*/
class DictManagerWidget : public QDialog {
Q_OBJECT
public:
\param parent parent of this widget, which must be subclass of
GUIInterface, because it will use it to get info about loaded plugins
and dicts.
- */
+ */
explicit DictManagerWidget(GUIInterface *parent = 0);
protected:
Q_SIGNALS:
//! Emitted when hiding widget, it will save states of dictionaries
- /*! \param list of only active dictionaries
- */
+ /*!
+ \param list of only active dictionaries
+ */
void selectedDictionaries(QList<CommonDictInterface*>);
//! Emitted when user wants to add new dictionary
- /*! \param new dictionary returned by specific plugin dialog
- */
+ /*!
+ \param new dictionary returned by specific plugin dialog
+ */
void addDictionary(CommonDictInterface*);
//! Emitted when user wants to remove dictionary
- /*! \param dictionary which will be removed
- */
+ /*!
+ \param dictionary which will be removed
+ */
void removeDictionary(CommonDictInterface*);
+public Q_SLOTS:
+ #ifndef Q_WS_MAEMO_5
+ void save();
+ #endif
private Q_SLOTS:
- /*! Shows plugin select dialog and then specific plugin add new dictionary
+ /*!
+ Shows plugin select dialog and then specific plugin add new dictionary
dialog, which will return new CommonDictInterface* object, which is
- later passed as parameter of addDictionary signal*/
+ later passed as parameter of addDictionary signal
+ */
void addNewDictButtonClicked();
- /*! Passes selected dictionary from list as parameter of removeDictionary
- signal */
+ /*!
+ Passes selected dictionary from list as parameter of removeDictionary
+ signal
+ */
void removeButtonClicked();
+
+ //! user select one of items
void itemSelected(QListWidgetItem*);
- /*! Shows plugin's settings dialog*/
+ //! Shows plugin's settings dialog
void settingsButtonClicked();
- //! Each change of state (that needs to be saved) should call this to indicate state change
+ //! Each change of state (that needs to be saved) should call this to
+ //! indicate state change
void changed();
//! saves changes
void saveChanges();
private:
+ void initalizeUI();
QPushButton* addNewDictButton;
QPushButton* removeDictButton;
QPushButton* settingsButton;
//holds association between items on list and CommonDictInterface objects
QHash<QListWidgetItem*, CommonDictInterface*> dictsHash;
GUIInterface* guiInterface;
+
bool _changed;
void refreshDictsList();
+
#ifndef Q_WS_MAEMO_5
QPushButton* closeButton;
bool _save;
-
- public Q_SLOTS:
- void save();
#endif
};
/*!
Shows list of loaded dictionaries plugins.
Static function addNewdict will return selected plugin.
- */
+*/
class DictTypeSelectDialog : public QDialog {
Q_OBJECT
public:
if(isInExactSearch()) {
QList<Translation*> exactTranslation;
if(checkExactSearch(searchResult, exactTranslation)) {
- qDebug()<<exactTranslation.count();
Q_EMIT searchTranslations(exactTranslation);
}
else {
if(!buttonsInitialized)
initButtons();
#endif
- webkit->repaint(this->rect());
- update(this->rect());
+
+ // webkit->repaint(this->rect());
+ // update(this->rect());
QString trans;
QString t;
webkit->setHtml(trans, QUrl().fromLocalFile("/"));
- webkit->repaint(this->rect());
- update(this->rect());
+ //webkit->repaint(this->rect());
+ //update(this->rect());
- Q_EMIT updateSize();
+ // Q_EMIT updateSize();
}
QString TranslationWidget::XslConversion(QString translation)
showButtonsButton->move(QPoint(x,y));
showButtonsButton->show();
-//==================================================================
+
+
x = width() - zoomOutButton->sizeHint().width();
y = height() - 2*zoomOutButton->sizeHint().height();
zoomOutButtonAnimation->setEndValue(QPoint(x,y));
zoomOutButtonAnimation->setDuration(200);
zoomOutButtonAnimation->setEasingCurve(QEasingCurve::InOutBack);
-//==================================================================
+
+
+
x = width() - zoomInButton->sizeHint().width();
y = height() - 3*zoomInButton->sizeHint().height();
zoomInButton->move(QPoint(x, height()));
zoomInButtonAnimation->setEndValue(QPoint(x,y));
zoomInButtonAnimation->setDuration(400);
zoomInButtonAnimation->setEasingCurve(QEasingCurve::InOutBack);
-//==================================================================
+
+
+
x = 0;
y = height() - copyButton->sizeHint().height();
copyButtonAnimation->setEndValue(QPoint(x,y));
copyButtonAnimation->setDuration(200);
copyButtonAnimation->setEasingCurve(QEasingCurve::InOutBack);
-//==================================================================
+
+
+
x = 0;
y = height() - 2*copyButton->sizeHint().height();
selectAllButtonAnimation->setEndValue(QPoint(x,y));
selectAllButtonAnimation->setDuration(400);
selectAllButtonAnimation->setEasingCurve(QEasingCurve::InOutBack);
-//==================================================================
+
+
+
x = 0;
y = height() - 3*copyButton->sizeHint().height();
searchButtonAnimation->setEndValue(QPoint(x,y));
searchButtonAnimation->setDuration(600);
searchButtonAnimation->setEasingCurve(QEasingCurve::InOutBack);
-//==================================================================
+
+
+
buttonsAnimation = new QParallelAnimationGroup(this);
buttonsAnimation->addAnimation(zoomInButtonAnimation);
explicit TranslationWidget(QWidget *parent = 0);
Q_SIGNALS:
- void updateSize();
-
void search(QString);
public Q_SLOTS:
QToolButton* zoomOutToolButton;
TranslationTextEdit *webkit;
QString xslt;
+
#ifdef Q_WS_MAEMO_5
QToolButton* zoomInButton;
QToolButton* zoomOutButton;
void grabZoomKeys(bool);
#endif
+
QVBoxLayout *verticalLayout;
QHBoxLayout* horizontalLayout;
GUIInterface* guiinterface;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
- qDebug()<<QLibraryInfo::location(QLibraryInfo::TranslationsPath);
a.installTranslator(&qtTranslator);
QTranslator myTranslator;