--- /dev/null
+#include "about.h"
+
+AboutDialog::AboutDialog(const char *iconFile, const char *title)
+ : QDialog()
+{
+ setWindowTitle(title);
+ QHBoxLayout *mlayout = new QHBoxLayout();
+ QLabel *iconshow = new QLabel();
+ iconshow->setPixmap(QPixmap(iconFile));
+
+ rlayout = new QVBoxLayout();
+ mlayout->addWidget(iconshow);
+ mlayout->addLayout(rlayout);
+ setLayout(mlayout);
+}
+
+void AboutDialog::setIntro(const QString &text)
+{
+ // Place to the first item of rlayout
+ if (rlayout->count() == 0) {
+ // No item yet, add one
+ rlayout->addWidget(new QLabel(text));
+ }
+ else {
+ // First item has existed, replace it.
+ QWidget *child = (QWidget *)rlayout->itemAt(0);
+ rlayout->removeWidget(child);
+ rlayout->insertWidget(0, new QLabel(text));
+ }
+}
+
+void AboutDialog::addAuthor(const QString &name)
+{
+ // Place from the second item of rlayout
+ if (rlayout->count() == 0) {
+ // No first item, add empty one.
+ rlayout->addWidget(new QLabel(""));
+ }
+ // Add from the second
+ rlayout->addWidget(new QLabel(name));
+}
--- /dev/null
+#ifndef ABOUT_H
+#define ABOUT_H
+
+#include <QtGui/QDialog>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QLabel>
+
+class AboutDialog: public QDialog
+{
+ Q_OBJECT
+public:
+ explicit AboutDialog(const char *iconFile, const char *title);
+
+ void setIntro(const QString &text);
+ void addAuthor(const QString &name);
+
+private:
+ QVBoxLayout *rlayout;
+};
+
+#endif // ABOUT_H
connect(wordinput, SIGNAL(returnPressed()), this, SLOT(startLookup()));
connect(btnLookup, SIGNAL(clicked()), this, SLOT(startLookup()));
+
+ /* Icon */
+ QIcon *icon = new QIcon();
+ icon->addFile(ICONFILE);
+ setWindowIcon(*icon);
+
+ /* About Dialog */
+ aboutDialog = new AboutDialog(ICONFILE, "MVerbiste");
+ aboutDialog->setIntro(trUtf8("A French conjugation utility for Maemo and MeeGo"));
+ aboutDialog->addAuthor(QString::fromUtf8("Nguyễn Hồng Quân <ng.hong.quan@gmail.com>\nPierre Sarrazin <sarrazip@sarrazip.com>"));
+
+ /* Menu */
+ QMenu *menu = ui->menuBar->addMenu(tr("Top menu"));
+ QAction *act_about = menu->addAction(tr("About"));
+ connect(act_about, SIGNAL(triggered()), aboutDialog, SLOT(show()));
}
MainWindow::~MainWindow()
{
delete ui;
delete freVerbDic;
+ delete aboutDialog;
}
void MainWindow::setOrientation(ScreenOrientation orientation)
#include <QtGui/QScrollArea>
#include <QtGui/QLabel>
#include <QtGui/QTableWidget>
+#include <QtGui/QMessageBox>
/* Verbiste */
#include <iostream>
#include <string.h>
#include <verbiste/FrenchVerbDictionary.h>
#include "gui/conjugation.h"
+#include "about.h"
#ifndef QT_NO_DEBUG
#include <QtCore/QDebug>
void showExpanded();
void initverbiste();
QVBoxLayout* makeResultCell(const VVS &tenseIterator,
- const std::string &tenseName,
- const std::string &inputWord,
- FrenchVerbDictionary *verbDict);
+ const std::string &tenseName,
+ const std::string &inputWord,
+ FrenchVerbDictionary *verbDict);
public slots:
void startLookup();
QPushButton *btnClear; // Clear button
QLineEdit *wordinput; // Word input
QPushButton *btnLookup; // Lookup button
+ QMessageBox *msgbox;
std::string langCode;
FrenchVerbDictionary *freVerbDic;
+ AboutDialog *aboutDialog;
ResultPage* addResultPage(const std::string &labelText);
#ifndef QT_NO_DEBUG
# by adapting the examples below.
# file1.source = myfile
# dir1.source = mydir
-DEPLOYMENTFOLDERS = xmldata # file1 dir1
+DEPLOYMENTFOLDERS = xmldata icon # file1 dir1
xmldata.source = data
+icon.source = icons
symbian:TARGET.UID3 = 0xE214283E
verbiste/misc-types.cpp \
verbiste/FrenchVerbDictionary.cpp \
verbiste/c-api.cpp \
- gui/conjugation.cpp
+ gui/conjugation.cpp \
+ about.cpp
HEADERS += mainwindow.h \
verbiste/Trie.h \
verbiste/misc-types.h \
verbiste/FrenchVerbDictionary.h \
verbiste/c-api.h \
- gui/conjugation.h
+ gui/conjugation.h \
+ about.h
FORMS += mainwindow.ui
# Please do not modify the following two lines. Required for deployment.
verbiste/Makefile.in \
verbiste/Makefile.am \
gui/Makefile.in \
- gui/Makefile.am
+ gui/Makefile.am \
+ icons/mverbiste.svg \
+ icons/mverbiste160.png
# To build verbiste
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += libxml-2.0
+# For verbiste
DEFINES += ICONV_CONST=
-simulator {
- DEFINES += LIBDATADIR=\\\"$$PWD/data\\\"
-}
-
simulator { # Build to run on simulator.
DEFINES += LIBDATADIR=\\\"$$PWD/data\\\"
+ DEFINES +=ICONFILE=\\\"$$PWD/icons/mverbiste160.png\\\"
}
else {
# installPrefix must be explicitly exported from deployment.pri first
DEFINES += LIBDATADIR=\\\"$${installPrefix}/data\\\"
+ DEFINES +=ICONFILE=\\\"$${installPrefix}/icons/mverbiste160.png\\\"
}