Author: mir3x Date: Fri Sep 19 09:58:03 2014 New Revision: 26502 URL: http://svn.gna.org/viewcvs/freeciv?rev=26502&view=rev Log: Added new dialog with full GPL license.
See patch #5218 Modified: branches/S2_5/client/gui-qt/menu.cpp branches/S2_5/client/gui-qt/menu.h Modified: branches/S2_5/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=26502&r1=26501&r2=26502&view=diff ============================================================================== --- branches/S2_5/client/gui-qt/menu.cpp (original) +++ branches/S2_5/client/gui-qt/menu.cpp Fri Sep 19 09:58:03 2014 @@ -19,6 +19,7 @@ #include <QApplication> #include <QMainWindow> #include <QMessageBox> +#include <QScrollArea> // common #include "game.h" @@ -28,6 +29,7 @@ // client #include "control.h" +#include "helpdata.h" // gui-qt #include "qtg_cxxside.h" @@ -84,6 +86,36 @@ text = tile_get_info_text(newtile, FALSE, 0); tile_virtual_destroy(newtile); return text; +} + +/************************************************************************** + Displays dialog with scrollbars, like QMessageBox with ok button +**************************************************************************/ +void fc_message_box::info(QWidget *parent, const QString &title, + const QString &message) { + setParent(parent); + setWindowTitle(title); + setWindowFlags(Qt::Window); + QVBoxLayout *vb = new QVBoxLayout; + label = new QLabel; + label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + label->setContentsMargins(2, 2, 2, 2); + label->setWordWrap(true); + label->setText(message); + scroll = new QScrollArea(this); + scroll->setWidget(label); + scroll->setWidgetResizable(true); + + ok_button = new QPushButton(this); + connect(ok_button, SIGNAL(clicked()), this, SLOT(close())); + ok_button->setText(_("Roger that")); + + vb->addWidget(scroll); + vb->addWidget(ok_button); + setLayout(vb); + setFixedHeight(400); + setFixedWidth(600); + show(); } /**************************************************************************** @@ -1081,17 +1113,20 @@ ****************************************************************************/ void mr_menu::slot_menu_copying() { - QMessageBox info(this); - QString s = QString::fromUtf8(_("Freeciv is covered by the GPL. ")) - + QString::fromUtf8(_("See file COPYING distributed with " - "Freeciv for full license text.")); - - info.setText(s); - info.setStandardButtons(QMessageBox::Ok); - info.setDefaultButton(QMessageBox::Cancel); - info.setIcon(QMessageBox::Information); - info.setWindowTitle(_("Copying")); - info.exec(); + fc_message_box *inf = new fc_message_box; + const struct help_item *pitem; + int idx; + QString s,ds; + + if (!(pitem = get_help_item_spec(Q_(HELP_COPYING_ITEM), + HELP_ANY , &idx))) { + log_error("Failed to find %s entry in help", Q_(HELP_COPYING_ITEM)); + return; + } + ds = QString(pitem->text); + + s = QString(Q_(HELP_COPYING_ITEM)); + inf->info(gui()->central_wdg, s, ds); } /*************************************************************************** Modified: branches/S2_5/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=26502&r1=26501&r2=26502&view=diff ============================================================================== --- branches/S2_5/client/gui-qt/menu.h (original) +++ branches/S2_5/client/gui-qt/menu.h Fri Sep 19 09:58:03 2014 @@ -23,12 +23,16 @@ #endif // Qt +#include <QDialog> #include <QMenuBar> // client #include "control.h" +class QLabel; +class QPushButton; class QSignalMapper; +class QScrollArea; /** used for indicating menu about current option - for renaming * and enabling disbaling */ @@ -85,6 +89,23 @@ }; /************************************************************************** + Custom dialog to show information +**************************************************************************/ +class fc_message_box : public QDialog +{ + Q_OBJECT + +public: + fc_message_box() {}; + void info(QWidget *parent, const QString &title, const QString &mess); + +private: + QLabel *label; + QScrollArea *scroll; + QPushButton *ok_button; +}; + +/************************************************************************** Class representing global menus in gameview **************************************************************************/ class mr_menu : public QMenuBar _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits