Commit 2536d43c authored by Florent D'Halluin's avatar Florent D'Halluin
Browse files

[yavgui] Add a help dialog.

* yavgui/src/Makefile.am: Add new files.
* yavgui/src/dialog_help.cc,
* yavgui/src/dialog_help.hh: New.  Simple help dialog.
* yavgui/src/gui.cc,
* yavgui/src/gui.hh: Add menu and action.
parent 892ffad6
2009-08-06 d-halluin <d-halluin@lrde.epita.fr>
[yavgui] Add a help dialog.
* yavgui/src/Makefile.am: Add new files.
* yavgui/src/dialog_help.cc,
* yavgui/src/dialog_help.hh: New. Simple help dialog.
* yavgui/src/gui.cc,
* yavgui/src/gui.hh: Add menu and action.
2009-08-06 d-halluin <d-halluin@lrde.epita.fr>
 
[yavgui] Delete states/transitions on double right click.
......
......@@ -23,6 +23,8 @@ COMMON_SOURCES = main.cc \
automaton_instance.cc \
dialog_eval.cc \
dialog_eval.moc.cc \
dialog_help.cc \
dialog_help.moc.cc \
dialog_get_instance.cc \
dialog_get_instance.moc.cc \
dialog_get_automaton_type.cc \
......
// dialog_help.cc: this file is part of Vaucanson.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2006 The Vaucanson Group.
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
/**
* @file dialog_help.cc
* @author Florent D'Halluin <d-halluin@lrde.epita.fr>
*
*
*/
#include "dialog_help.hh"
namespace gui
{
namespace dialogs
{
DialogHelp::DialogHelp()
{
QPushButton *closeButton = new QPushButton(tr("Close"));
connect(closeButton, SIGNAL(clicked()), this, SLOT(done()));
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
QString help = tr(
"Yavgui, a GUI for Vaucanson:\n"
"\n"
"Single right click: \tCreate a state/transition.\n"
"Double right click: \tDelete a state/transition.\n"
"Single left click: \tMove/adjust a state/transition.\n"
"Double left click: \tEdit a state/transition.\n"
"\n"
"Contact: d-halluin@lrde.epita.fr\n"
"\n"
"Copyright The Vaucanson Group, 2008, 2009.\n");
QLabel* label = new QLabel(help);
mainLayout->addWidget(label);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Yavgui help"));
}
void DialogHelp::done ()
{
emit close ();
}
} // ! namespace dialogs
} // ! namespace gui
// dialog_help.hh: this file is part of Vaucanson.
//
// Vaucanson, a generic library for finite state machines.
//
// Copyright (C) 2006 The Vaucanson Group.
//
// This program 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 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
// The Vaucanson Group consists of people listed in the `AUTHORS' file.
//
/**
* @file dialog_help.hh
* @author Florent D'Halluin <d-halluin@lrde.epita.fr>
*
*
*/
#ifndef DIALOG_HELP_HH_
# define DIALOG_HELP_HH_
# include <QtGui>
# include "common.hh"
# include "g_common.hh"
namespace gui
{
namespace dialogs
{
class DialogHelp : public QDialog
{
Q_OBJECT
public:
DialogHelp();
public slots:
void done();
};
} // ! namespace dialogs
} // ! namespace gui
#endif /* !DIALOG_HELP_HH_ */
......@@ -26,6 +26,7 @@
# include "gui.hh"
# include "exceptions.hh"
# include "dialog_help.hh"
# include "dialog_get_instance.hh"
# include "dialog_get_automaton_type.hh"
......@@ -101,7 +102,7 @@ namespace gui
this, SLOT(close_current_instance ()));
QAction* exit = new QAction(tr("Exit"), application_menu);
exit->setStatusTip (tr("Exit Gui"));
exit->setStatusTip (tr("Exit Yavgui"));
application_menu->addAction (exit);
QObject::connect (exit, SIGNAL(triggered ()),
application_, SLOT(quit ()));
......@@ -112,14 +113,16 @@ namespace gui
window_->menuBar()->addMenu (tr("All Commands"));
CommandList::Instance ()->add_command_menus (command_menu);
window_->setCentralWidget (center_);
QMenu* help_menu =
window_->menuBar()->addMenu (tr("Help"));
QAction* help = new QAction(tr("Help"), help_menu);
help->setStatusTip (tr("Yavgui help"));
help_menu->addAction (help);
QObject::connect (help, SIGNAL(triggered ()),
this, SLOT(help ()));
// FIXME: remove
// quit_ = new QPushButton (tr("Quit"));
// quit_->setFont (QFont ("Arial", 12, QFont::Bold));
// //quit_->setGeometry (10, 40, 180, 40);
// QObject::connect (quit_, SIGNAL(clicked ()),
// application_, SLOT(quit ()));
window_->setCentralWidget (center_);
text_->resize (1024, 40);
text_->setReadOnly (true);
......@@ -193,6 +196,11 @@ namespace gui
instances_[tabs_->currentIndex ()]->refresh (text_, automaton_menu_);
}
void Gui::help ()
{
dialogs::DialogHelp dlg;
dlg.exec();
}
void Gui::close_current_instance ()
{
......
......@@ -71,6 +71,7 @@ namespace gui
void select_instance (int index);
void close_current_instance ();
void refresh ();
void help ();
private:
// Private constructors due to the singleton nature
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment