+/*******************************************************************************
+
+ 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 "MainWindow.h"
#include "ui_MainWindow.h"
-MainWindow::MainWindow(QWidget *parent) :
+MainWindow::MainWindow(Backbone *backbone, QWidget *parent):
QMainWindow(parent),
ui(new Ui::MainWindow) {
+
+ this->backbone = backbone;
+
ui->setupUi(this);
setAttribute(Qt::WA_Maemo5StackedWindow);
- searchBarWidget = new SearchBarWidget();
- wordListWidget = new WordListWidget();
- translationWidget = new TranslationWidget(this);
+ searchBarWidget = new SearchBarWidget(backbone);
+ wordListWidget = new WordListWidget(backbone);
+ translationWidget = new TranslationWidget(backbone, this);
+ menuWidget = new MenuWidget(this);
+
+
+ menuWidget->addSubMenu(tr("Dictionaries"), new QPushButton("Dictionaries"));
+ menuWidget->addSubMenu(tr("Settings"), new QPushButton("Settings"));
+ menuWidget->addSubMenu(tr("About"), new QPushButton("About"));
+
+ ui->menuBar->addAction(menuWidget);
+
connect(wordListWidget, SIGNAL(clicked(QModelIndex)),
translationWidget, SLOT(show(QModelIndex)));
ui->centralWidget->layout()->addWidget(searchBarWidget);
+ connect(this, SIGNAL(quit()),
+ backbone, SLOT(quit()));
+
+ connect(backbone, SIGNAL(closeOk()),
+ this, SLOT(closeOk()));
}
MainWindow::~MainWindow() {
void MainWindow::closeEvent(QCloseEvent *event) {
if(searchBarWidget->isSearching()) {
- emit stopSearching();
+ emit quit();
event->ignore();
}
}