--- /dev/null
+#include "MainWindow.h"
+#include "ui_MainWindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
--- /dev/null
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+ class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>800</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="SearchBarWidget" name="widget" native="true">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>23</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QToolBar" name="mainToolBar">
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>SearchBarWidget</class>
+ <extends>QWidget</extends>
+ <header>gui/SearchBarWidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+/*******************************************************************************
+
+ 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 "SearchBarWidget.h"
+#include <QDebug>
+
+
+
+SearchBarWidget::SearchBarWidget(QWidget *parent) :
+ QWidget(parent) {
+
+ initializeUI();
+
+ setMaximumHeight(150);
+
+ isSearching = false;
+
+ connect(searchPushButton, SIGNAL(clicked()),
+ this, SLOT(searchPushButtonClicked()));
+
+ connect(historyNextToolButton, SIGNAL(clicked()),
+ this, SLOT(historyNextToolButtonClicked()));
+
+ connect(historyPrevToolButton, SIGNAL(clicked()),
+ this, SLOT(historyPrevToolButtonClicked()));
+
+ connect(historyShowToolButton, SIGNAL(clicked()),
+ this, SLOT(historyShowToolButtonClicked()));
+
+ connect(clearSearchWordToolButton, SIGNAL(clicked()),
+ this, SLOT(clearSearchWordToolButtonClicked()));
+
+}
+
+SearchBarWidget::~SearchBarWidget() {
+
+}
+
+
+void SearchBarWidget::initializeUI() {
+ horizontalLayout = new QHBoxLayout();
+ verticalLayout = new QVBoxLayout();
+
+
+ searchPushButton = new QPushButton(tr("Search"));
+ searchPushButton->setMinimumWidth(200);
+
+
+ searchWordLineEdit = new QLineEdit();
+ searchWordLineEdit->setMinimumWidth(350);
+ //create layout for lineEdit to have clear button on it
+ QHBoxLayout* lineEditLayout = new QHBoxLayout;
+ searchWordLineEdit->setLayout(lineEditLayout);
+
+
+ clearSearchWordToolButton = new QToolButton();
+ clearSearchWordToolButton->setIcon(QIcon("sowa.svg"));
+ //tool buttons will have size 2 times smaller
+ clearSearchWordToolButton->setMaximumSize(
+ clearSearchWordToolButton->sizeHint().width()/2,
+ clearSearchWordToolButton->sizeHint().height()/2);
+
+
+ historyNextToolButton = new QToolButton();
+ historyNextToolButton->setIcon(QIcon("sowa.svg"));
+ historyNextToolButton->setMaximumSize(
+ historyNextToolButton->sizeHint().width()/2,
+ historyNextToolButton->sizeHint().height()/2);
+
+
+ historyPrevToolButton = new QToolButton();
+ historyPrevToolButton->setIcon(QIcon("sowa.svg"));
+ historyPrevToolButton->setMaximumSize(
+ historyPrevToolButton->sizeHint().width()/2,
+ historyPrevToolButton->sizeHint().height()/2);
+
+
+ historyShowToolButton = new QToolButton();
+ historyShowToolButton->setIcon(QIcon("sowa.svg"));
+ historyShowToolButton->setMaximumSize(
+ historyShowToolButton->sizeHint().width()/2,
+ historyShowToolButton->sizeHint().height()/2);
+
+
+ searchingProgressBar = new QProgressBar();
+ searchingProgressBar->setMinimum(0);
+ searchingProgressBar->setMaximum(0);
+ searchingProgressBar->hide();
+ searchingProgressBar->setMaximumHeight(50);
+
+
+
+ setLayout(verticalLayout);
+
+ verticalLayout->addWidget(searchingProgressBar);
+
+ //adding widgets to layout
+ horizontalLayout->addWidget(searchWordLineEdit);
+ horizontalLayout->addWidget(searchPushButton);
+ horizontalLayout->addWidget(historyPrevToolButton);
+ horizontalLayout->addWidget(historyShowToolButton);
+ horizontalLayout->addWidget(historyNextToolButton);
+
+ //adding clear toolButton to textEdit with right alignment
+ lineEditLayout->addWidget(clearSearchWordToolButton, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+
+ verticalLayout->addLayout(horizontalLayout);
+}
+
+
+void SearchBarWidget::searchPushButtonClicked() {
+ if(isSearching) {
+ emit stopSearching();
+ searchingProgressBar->hide();
+ searchPushButton->setText(tr("Search"));
+ setEnabled(true);
+ isSearching = false;
+ }
+ else {
+ emit searchForTranslations(searchWordLineEdit->text());
+ searchingProgressBar->show();
+ searchPushButton->setText(tr("Stop"));
+ setEnabled(false);
+ isSearching = true;
+ }
+}
+
+void SearchBarWidget::setEnabled(bool enabled) {
+ searchWordLineEdit->setEnabled(enabled);
+ historyNextToolButton->setEnabled(enabled);
+ historyPrevToolButton->setEnabled(enabled);
+ historyShowToolButton->setEnabled(enabled);
+}
+
+void SearchBarWidget::historyNextToolButtonClicked() {
+
+}
+
+void SearchBarWidget::historyPrevToolButtonClicked() {
+
+}
+
+void SearchBarWidget::historyShowToolButtonClicked() {
+
+}
+
+void SearchBarWidget::clearSearchWordToolButtonClicked() {
+ searchWordLineEdit->clear();
+}
+
+void SearchBarWidget::showHistoryListDialog() {
+
+}
--- /dev/null
+/*******************************************************************************
+
+ 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
+
+
+#ifndef SEARCHBARWIDGET_H
+#define SEARCHBARWIDGET_H
+
+#include <QWidget>
+#include <QtGui>
+
+
+//! Displays search bar
+/*!
+ Contains line edit field to input word which user would to find, and buttons
+ to browse search history
+*/
+class SearchBarWidget : public QWidget {
+ Q_OBJECT
+public:
+ explicit SearchBarWidget(QWidget *parent = 0);
+ ~SearchBarWidget();
+
+Q_SIGNALS:
+ void searchForTranslations(QString);
+ void stopSearching();
+
+public Q_SLOTS:
+ //! Enable or disable search word line edit and history buttons
+ /*!
+ While searching it disables only history button and line edit.
+ Search/Stop button is always enabled
+ */
+ void setEnabled(bool);
+
+private Q_SLOTS:
+ void clearSearchWordToolButtonClicked();
+ void searchPushButtonClicked();
+ void historyPrevToolButtonClicked();
+ void historyNextToolButtonClicked();
+ void historyShowToolButtonClicked();
+
+private:
+ QLineEdit* searchWordLineEdit;
+ QToolButton* clearSearchWordToolButton;
+ QPushButton* searchPushButton;
+ QToolButton* historyPrevToolButton;
+ QToolButton* historyNextToolButton;
+ QToolButton* historyShowToolButton;
+ QHBoxLayout* horizontalLayout;
+ QProgressBar* searchingProgressBar;
+
+ QVBoxLayout* verticalLayout;
+
+ bool isSearching;
+
+ void initializeUI();
+ void showHistoryListDialog();
+};
+
+#endif // SEARCHBARWIDGET_H
+++ /dev/null
-/*******************************************************************************
-
- 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.
-
-*******************************************************************************/
-
-#include "searchbarwidget.h"
-
-SearchBarWidget::SearchBarWidget(QWidget *parent) :
- QWidget(parent)
-{
-}
+++ /dev/null
-/*******************************************************************************
-
- 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.
-
-*******************************************************************************/
-
-#ifndef SEARCHBARWIDGET_H
-#define SEARCHBARWIDGET_H
-
-#include <QWidget>
-
-class SearchBarWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit SearchBarWidget(QWidget *parent = 0);
-
-signals:
-
-public slots:
-
-};
-
-#endif // SEARCHBARWIDGET_H
SOURCES += main.cpp\
- mainwindow.cpp \
- gui/searchbarwidget.cpp
+ MainWindow.cpp \
+ gui/SearchBarWidget.cpp
-HEADERS += mainwindow.h \
- gui/searchbarwidget.h
+HEADERS += MainWindow.h \
+ gui/SearchBarWidget.h
-FORMS += mainwindow.ui
+FORMS += MainWindow.ui
#include <QtGui/QApplication>
-#include "mainwindow.h"
+#include "MainWindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
+ w.resize(800,480);
return a.exec();
}
+++ /dev/null
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainWindow)
-{
- ui->setupUi(this);
-}
-
-MainWindow::~MainWindow()
-{
- delete ui;
-}
+++ /dev/null
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-namespace Ui {
- class MainWindow;
-}
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(QWidget *parent = 0);
- ~MainWindow();
-
-private:
- Ui::MainWindow *ui;
-};
-
-#endif // MAINWINDOW_H
+++ /dev/null
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>MainWindow</string>
- </property>
- <widget class="QMenuBar" name="menuBar" />
- <widget class="QToolBar" name="mainToolBar" />
- <widget class="QWidget" name="centralWidget" />
- <widget class="QStatusBar" name="statusBar" />
- </widget>
- <layoutDefault spacing="6" margin="11" />
- <pixmapfunction></pixmapfunction>
- <resources/>
- <connections/>
-</ui>