virtual QString toHtml() const = 0;
//! \return whether given translation is taken from bookmarks
- virtual bool isBookmark() const {
+ virtual int isBookmark() const {
return _bookmark;
}
protected:
//! indicates whether this translation is in bookmark
- bool _bookmark;
+ int _bookmark;
};
_key = key;
_dictionaryInfo = dbName;
_bookmarks = bookmarks;
- _bookmark = 1;
+ _bookmark = 2;
}
//! \return word to be translated
while(it2.hasNext())
delete it2.next().value();
+ delete _history;
}
AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
{
+ setModal(true);
QString infoNote, licenseNote, comarchNote;
infoNote = "<center><h2><u>mDictionary</u></h2></center>";
comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
{
setWindowTitle(tr("Bookmarks"));
+ setModal(true);
+
verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
this->guiInterface = parent;
initalizeUI();
+
+ setModal(true);
}
void DictManagerWidget::initalizeUI() {
setMinimumSize(500,300);
closeButton = new QPushButton(tr("Save"));
buttonGroup->addWidget(closeButton);
+
+ setMinimumWidth(sizeHint().width()*1.2);
+ setMaximumWidth(sizeHint().width()*2);
+ setMinimumHeight(sizeHint().height());
+ setMaximumHeight(sizeHint().height()*2);
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
setExactSearch(false);
+ setMinimumSize(750, 400);
+
showMaximized();
searchBarWidget->setFocus();
}
MainWindow::~MainWindow() {
-
}
splitter->addWidget(welcomeScreenWidget);
splitter->setStretchFactor(1, 150);
- mainLayout->addWidget(splitter);
- mainLayout->addWidget(searchBarWidget);
+ mainLayout->addWidget(splitter, 1);
+ mainLayout->addWidget(searchBarWidget, 0, Qt::AlignBottom);
#endif
}
connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
this, SLOT(showNotification(Notify::NotifyType,QString)));
+
+ connect(backbone, SIGNAL(closeOk()),
+ this, SLOT(close()));
}
void MainWindow::connectSearchBar() {
#include <QDebug>
SettingsWidget::SettingsWidget(GUIInterface *parent) :
- QDialog(parent)
+ QDialog(parent)
{
guiInterface = parent;
setWindowTitle(tr("Settings"));
initalizeUI();
+
+ setModal(true);
}
void SettingsWidget::initalizeUI() {
footerLayout->addStretch(0);
footerLayout->addWidget(closeButton);
verticalLayout->addLayout(footerLayout);
+
+ setMinimumHeight(sizeHint().height());
+ setMaximumHeight(sizeHint().height());
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
#include "WordListWidget.h"
#include "WordListProxyStyle.h"
#include "../../include/translation.h"
+#include <QKeyEvent>
WordListWidget::WordListWidget(QWidget *parent):
model->sort(0);
resizeColumns();
+
+ setFocus();
}
void WordListWidget::wordClicked(QModelIndex index) {
}
else {
Q_EMIT removeBookmark(searchResult[item.data().toString()]);
+
+ Translation* t;
+ bool onlyBookmarks = true;
+ foreach(t, searchResult[item.data().toString()]) {
+ if(t->isBookmark() == 1) {
+ onlyBookmarks = false;
+ t->setBookmark(0);
+ }
+ }
+
+ if(onlyBookmarks) {
+ searchResult.remove(item.data().toString());
+ model->removeRow(item.row());
+ }
}
}
setColumnWidth(1, checkBoxWidth);
}
+void WordListWidget::keyPressEvent(QKeyEvent *event) {
+ QTreeView::keyPressEvent(event);
+
+ if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
+ if(selectedIndexes().count() == 0) return;
+
+ wordClicked(selectedIndexes().at(0));
+ }
+}
+
void WordListWidget::lockList() {
setEnabled(false);
}
//! side next to scroll bar
void resizeEvent(QResizeEvent *event);
-
+ //! Checks if user press return and if so displays translation of selected word
+ void keyPressEvent( QKeyEvent * event);
private Q_SLOTS:
//! Emits signal to show translation of clicked item. Signal is emitted
retranslate();
- Backbone backbone;
- MainWindow w(&backbone);
+ Backbone* backbone = new Backbone();
+ MainWindow* mainWindow = new MainWindow(backbone);
- DBusAdapter* adapter = new DBusAdapter(&w);
+ DBusAdapter* adapter = new DBusAdapter(mainWindow);
QDBusConnection::sessionBus().registerObject("/mainWindow",
- &w);
+ mainWindow);
QDBusConnection::sessionBus().registerService("com.comarch.mdictionary");
-
- w.show();
-
+ mainWindow->show();
if(search.count() > 0) {
- w.setExactSearch(true);
- w.searchExact(search[0]);
+ mainWindow->setExactSearch(true);
+ mainWindow->searchExact(search[0]);
}
- return a.exec();
+ int res = a.exec();
+
+ QDBusConnection::sessionBus().unregisterObject("/mainWindow");
+ QDBusConnection::sessionBus().unregisterService("com.comarch.mdictionary");
+
+ delete adapter;
+ delete mainWindow;
+ delete backbone;
+
+ return res;
}
verticalLayout->addWidget(confirmButton);
setModal(true);
+
+ setMinimumSize(sizeHint());
+ setMaximumSize(sizeHint());
}
void GoogleDialog::langFromChanged(int index) {
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
- bool isBookmark() const {
+ int isBookmark() const {
return _bookmark;
}
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
- bool isBookmark() const {
+ int isBookmark() const {
return _bookmark;
}
cancelButton = new QPushButton(tr("Cancel"),this);
- cachingLabel = new QLabel(this);
- cachingLabel->hide();
+ cachingTimeLabel = new QLabel(this);
+ cachingTimeLabel->hide();
+ #ifndef Q_WS_MAEMO_5
+ cachingLabel = new QLabel(this);
+ cachingLabel->setText(tr("Caching dictionary, please wait"));
+ verticalLayout->addWidget(cachingLabel, 0, Qt::AlignCenter);
+ #endif
- verticalLayout->addWidget(cachingLabel);
+
+ verticalLayout->addWidget(cachingTimeLabel);
verticalLayout->addWidget(cachingProgressBar);
verticalLayout->addWidget(cancelButton);
void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
cachingProgressBar->setValue(progress);
- if(!cachingLabel->isVisible())
- cachingLabel->show();
+ if(!cachingTimeLabel->isVisible())
+ cachingTimeLabel->show();
int seconds = float((100 - progress)*time) / (5*1000);
- cachingLabel->setText(tr("Estimated time left: ") +
+ cachingTimeLabel->setText(tr("Estimated time left: ") +
tr("%n second(s)", "", seconds));
if(progress >= 100)
this->accept();
private:
QLabel* cachingLabel;
+ QLabel* cachingTimeLabel;
QProgressBar* cachingProgressBar;
QPushButton* cancelButton;
QVBoxLayout* verticalLayout;
scrollArea->setLineWidth(0);
scrollArea->setMidLineWidth(0);
- scrollArea->setFrameStyle(QFrame::NoFrame);;
+ scrollArea->setFrameStyle(QFrame::NoFrame);
+
+ setMinimumSize(sizeHint().width()*1.2, sizeHint().height());
+ setMaximumSize(sizeHint().width()*2, sizeHint().height()*2);
}