_searchLimit = set.value("general/search_limit", 15).toInt();
_searchBookmarks = set.value("general/search_bookmarks",1).toBool();
_searchDicts = set.value("general/search_dictionaries",1).toBool();
+ _zoom = set.value("general/zoom", 1.0).toReal();
}
set->setValue("general/search_limit", _searchLimit);
set->setValue("general/search_bookmarks", _searchBookmarks);
set->setValue("general/search_dictionaries", _searchDicts);
+ set->setValue("general/zoom", _zoom);
}
_searchBookmarks = 1;
else
_searchBookmarks = 0;
+ _zoom = settings->value("zoom").toFloat();
+ if(!_zoom)
+ _zoom ++;
+
dictUpdated();
if(settings)
delete settings;
Settings * settings = new Settings();
settings->setValue("history_size", QString("%1").arg(_historyLen));
settings->setValue("search_limit", QString("%1").arg(_searchLimit));
+ settings->setValue("zoom", QString("%1").arg(_zoom));
if(_searchBookmarks)
settings->setValue("search_bookmarks", "true");
else
QString _configPath;
QString _dir;
int _historyLen;
+ qreal _zoom;
bool dryRun; // mainly for testing - when true then doesn't bother configs etc
bool stopped; // true when user stops searching/fetching
#include <QtGui>
#include "TranslationTextEdit.h"
+#include "TranslationWidget.h"
TranslationTextEdit::TranslationTextEdit(QWidget *parent) :
QWebView(parent)
{
+ realParent = qobject_cast<TranslationWidget*>(parent);
searchSelectedAction = new QAction(tr("Search"), this);
copySelectedAction = new QAction(tr("Copy"), this);
selectAllAction = new QAction(tr("Select All"), this);
void TranslationTextEdit::zoomIn() {
setZoomFactor(zoomFactor()*1.05);
+ realParent->updateZoom(zoomFactor());
+
}
void TranslationTextEdit::zoomOut() {
setZoomFactor(zoomFactor()*0.95);
+ realParent->updateZoom(zoomFactor());
}
void TranslationTextEdit::copy() {
#include <QTextEdit>
#include <QAction>
#include <QWebView>
+class TranslationWidget;
class TranslationTextEdit : public QWebView
{
QAction* searchSelectedAction;
QAction* copySelectedAction;
QAction* selectAllAction;
+ TranslationWidget* realParent;
};
#endif
TranslationWidget::TranslationWidget(QWidget *parent):
- QScrollArea(parent) {
+ QScrollArea(parent){
+
+ guiinterface = qobject_cast<GUIInterface*>(parent);
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
void TranslationWidget::initializeUI() {
webkit = new TranslationTextEdit(this);
+ Settings* set = guiinterface->settings();
+ qreal fac = set->value("zoom").toFloat();
+ if(!fac)
+ fac++;
+ webkit->setZoomFactor(fac);
QWidget*w = new QWidget(this);
verticalLayout = new QVBoxLayout(w);
#endif
+void TranslationWidget::updateZoom(qreal factor) {
+ Settings* set = guiinterface->settings();
+ set->setValue("zoom", QString("%1").arg(factor));
+ guiinterface->setSettings(set);
+}
+
+
#include <QXmlQuery>
#include "TranslationTextEdit.h"
#include <QPropertyAnimation>
+#include "../../includes/GUIInterface.h"
//! Displays translation of word found in dictionaries
/*!
//! Requests to show translation of word list passed as parameter.
void show(QStringList);
+ //! Updates users zoom preferences and sends its to backbone to be saved
+ void updateZoom(qreal);
+
protected:
#ifdef Q_WS_MAEMO_5
void keyPressEvent(QKeyEvent *);
#endif
QVBoxLayout *verticalLayout;
QHBoxLayout* horizontalLayout;
+ GUIInterface* guiinterface;
void initializeUI();
};