different ways
\param QString text of the notification
*/
- void notify(Notify::NotifyType, QString, QWidget* parent = 0);
+ void notify(Notify::NotifyType, QString);
protected:
virtual void changeSettings(QWidget *parent = 0) = 0;
Q_SIGNALS:
- void notify(Notify::NotifyType, QString, QWidget* parent = 0);
+ void notify(Notify::NotifyType, QString);
};
#endif // DICTDIALOG_H
dict->setHash(++_dictNum); // Hash must be uniqe in every session but not between
_dicts[dict] = active;
connect(dict, SIGNAL(settingsChanged()), this, SLOT(dictUpdated()));
- connect(dict, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)), this,
- SIGNAL(notify(Notify::NotifyType,QString, QWidget*)));
+ connect(dict, SIGNAL(notify(Notify::NotifyType,QString)), this,
+ SIGNAL(notify(Notify::NotifyType,QString)));
}
}
if(!exists) {
_plugins.append(plugin);
plugin->retranslate();
- connect(plugin, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)),
- this, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)));
+ connect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
}
}
}
different ways
\param QString text of the notification
*/
- void notify(Notify::NotifyType, QString, QWidget*parent = 0);
+ void notify(Notify::NotifyType, QString);
private Q_SLOTS:
void bookmarksListReady();
CommonDictInterface* selectedPlugin =
DictTypeSelectDialog::addNewDict(
guiInterface->getPlugins(),
- menuWidget->applicationMenu());
+ this->parentWidget());
if(selectedPlugin != NULL) {
Settings* settings =
- selectedPlugin->dictDialog()->addNewDictionary(menuWidget->applicationMenu());
+ selectedPlugin->dictDialog()->addNewDictionary(this->parentWidget());
if(settings != NULL) {
CommonDictInterface* newDict = selectedPlugin->getNew(settings);
#endif
QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
if(selected.count() > 0) {
- dictsHash[selected[0]]->dictDialog()->changeSettings(menuWidget->applicationMenu());
+ dictsHash[selected[0]]->dictDialog()->changeSettings(this->parentWidget());
}
refreshDictsList();
}
*/
explicit DictManagerWidget(GUIInterface *parent = 0);
- void setMenuWidget(MenuWidget *w) {menuWidget = w;}
-
protected:
void showEvent(QShowEvent *e);
void hideEvent(QHideEvent *e);
QPushButton* closeButton;
bool _save;
#endif
-
- MenuWidget* menuWidget;
};
#endif // DICTMANAGERWIDGET_H
menuBar = new QMenuBar();
setMenuBar(menuBar);
+ notifyManager = new NotifyManager(this);
+
initializeSearchWidgets();
initializeMenu();
- notifyManager = new NotifyManager(this);
+
}
void MainWindow::initializeSearchWidgets() {
menuBar->addAction(menuWidget);
- dictManagerWidget->setMenuWidget(menuWidget);
+ connect(menuWidget, SIGNAL(setApplicationMenu(QWidget*)),
+ notifyManager, SLOT(setMenu(QWidget*)));
#else
dictionariesAction = menuBar->addAction(tr("Dictionaries"));
connect(dictionariesAction, SIGNAL(triggered()),
}
-void MainWindow::showNotification(Notify::NotifyType type, QString text, QWidget* parent) {
- notifyManager->showNotification(type, text, parent);
+void MainWindow::showNotification(Notify::NotifyType type, QString text) {
+ notifyManager->showNotification(type, text);
}
void MainWindow::connectBackbone() {
connect(backbone, SIGNAL(searchCanceled()),
this, SIGNAL(setIdle()));
- connect(backbone, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)),
- this, SLOT(showNotification(Notify::NotifyType,QString, QWidget*)));
+ connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SLOT(showNotification(Notify::NotifyType,QString)));
}
void MainWindow::connectSearchBar() {
\param type type of notification
\param message notification message
*/
- void showNotification(Notify::NotifyType type, QString message, QWidget *parent=0);
+ void showNotification(Notify::NotifyType type, QString message);
private Q_SLOTS:
//! Disables menu
tabWidget = new MenuTabWidget();
tabWidget->setStyleSheet("QTabWidget::tab-bar {alignment: center;}");
+ applicationMenu = 0;
+
}
MenuWidget::~MenuWidget() {
}
}
-QWidget* MenuWidget::createWidget(QWidget *) {
+QWidget* MenuWidget::createWidget(QWidget *parent) {
/*When we have request to create new widget we return tabWidget.
When the menu is closing, tabWidget will receive hideEvent which will set
its parent to NULL and prevent it from delete, so we can still use this
widget*/
+ if(applicationMenu==0) {
+ applicationMenu = parent;
+ Q_EMIT setApplicationMenu(applicationMenu);
+ }
return tabWidget;
}
-QWidget* MenuWidget::applicationMenu() {
- return tabWidget->parentWidget();
-}
void MenuWidget::hideMenu() {
tabWidget->parentWidget()->hide();
*/
void removeSubMenu(QString title);
- QWidget* applicationMenu();
+Q_SIGNALS:
+ void setApplicationMenu(QWidget*);
public Q_SLOTS:
/*!
void showMenu();
protected:
- MenuTabWidget* tabWidget;
QWidget* createWidget(QWidget *parent);
+
+private:
+ MenuTabWidget* tabWidget;
+ QWidget* applicationMenu;
};
#endif // MENUWIDGET_H
NotifyManager::NotifyManager(QObject *parent) :
QObject(parent)
{
-
+ menu = 0;
}
}
}
-void NotifyManager::showNotification(Notify::NotifyType type, QString text, QWidget* parent) {
+void NotifyManager::showNotification(Notify::NotifyType type, QString text) {
if(activeNotifies.contains(text)) {
return;
}
- if(parent == 0)
+ QWidget* parent;
+
+ if(menu && menu->isVisible())
+ parent = menu;
+ else
parent = qobject_cast<QWidget*>(this->parent());
+
#ifdef Q_WS_MAEMO_5
QMaemo5InformationBox* mbox =
new QMaemo5InformationBox(parent);
connect(mbox, SIGNAL(finished(int)), this, SLOT(notificationClosed()));
mbox->exec();
}
+
+void NotifyManager::setMenu(QWidget *w) {
+ menu = w;
+ qDebug()<<w<<"mM";
+}
\param text text of notification
\sa Notify::NotifyType
*/
- void showNotification(Notify::NotifyType type, QString text, QWidget*parent=0);
+ void showNotification(Notify::NotifyType type, QString text);
//! Refresh all notifications when stacked widgets changes
void screenChanged();
+ void setMenu(QWidget*);
+
private slots:
//! Informs that notification was closed and can be deleted
void notificationClosed();
private:
QHash<QString, QDialog*> activeNotifies;
+ QWidget* menu;
};
#endif // NOTIFYMANAGER_H
void XdxfDialog::accept() {
if(type == New && _dictionaryFilePath.isEmpty()) {
- Q_EMIT notify(Notify::Warning, tr("File path is not set"), this);
+ Q_EMIT notify(Notify::Warning, tr("File path is not set"));
return;
}
}
void XdxfDialog::showCacheInfo() {
- Q_EMIT notify(Notify::Info, tr("Optimize for quicker searches (may take some time)"), this);
+ Q_EMIT notify(Notify::Warning, tr("Optimize for quicker searches (may take some time)"));
}
void XdxfDialog::showAccentsInfo() {
- Q_EMIT notify(Notify::Info, tr("Strip accents (searching takes more "
- "time, but spelling don't have to be exact)"), this);
+ Q_EMIT notify(Notify::Warning, tr("Strip accents (searching takes more "
+ "time, but spelling don't have to be exact)"));
}
Settings* getSettings();
Q_SIGNALS:
- void notify(Notify::NotifyType, QString, QWidget*);
+ void notify(Notify::NotifyType, QString);
public Q_SLOTS:
void accept();
qDebug()<<parent;
XdxfDialog d(0, XdxfDialog::New, parent);
- connect(&d, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)),
- this, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)));
+ connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
if(d.exec() == QDialog::Accepted) {
return d.getSettings();
void XdxfDictDialog::changeSettings(QWidget * parent) {
XdxfDialog d(plugin, XdxfDialog::Change, parent);
- connect(&d, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)),
- this, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)));
+ connect(&d, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
if(d.exec() == QDialog::Accepted) {
plugin->setSettings(d.getSettings());
_settings = new Settings();
_dictDialog = new XdxfDictDialog(this, this);
- connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)),
- this, SIGNAL(notify(Notify::NotifyType,QString, QWidget*)));
+ connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
cachingDialog = new XdxfCachingDialog(this);
CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
XdxfPlugin *plugin = new XdxfPlugin();
+ connect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
if(settings && plugin->setSettings(settings)) {
return plugin;
}