2001-08-19 13:25:15 +00:00
|
|
|
/**
|
|
|
|
* \file QAbout.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-08-19 13:25:15 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author Kalle Dalheimer
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-08-19 13:25:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2003-09-29 10:50:51 +00:00
|
|
|
#include "debug.h"
|
2001-08-21 01:14:54 +00:00
|
|
|
#include "support/lstrings.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
#include "support/std_sstream.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2003-03-10 03:13:28 +00:00
|
|
|
#include "ButtonController.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "ControlAboutlyx.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qpushbutton.h>
|
2001-08-21 01:14:54 +00:00
|
|
|
#include <qtextview.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QAboutDialog.h"
|
2001-08-23 21:21:50 +00:00
|
|
|
#include "Qt2BC.h"
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QAbout.h"
|
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
using lyx::support::prefixIs;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
2001-08-29 15:37:39 +00:00
|
|
|
using std::getline;
|
2003-09-08 00:33:41 +00:00
|
|
|
|
2003-09-05 18:02:24 +00:00
|
|
|
using std::istringstream;
|
|
|
|
using std::ostringstream;
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
2001-08-29 15:37:39 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2003-09-05 18:02:24 +00:00
|
|
|
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2003-03-09 20:29:58 +00:00
|
|
|
QAbout::QAbout(Dialog & parent)
|
2003-05-22 15:42:50 +00:00
|
|
|
: base_class(parent, _("About LyX"))
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QAbout::build_dialog()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
dialog_.reset(new QAboutDialog);
|
2001-08-19 13:25:15 +00:00
|
|
|
connect(dialog_.get()->closePB, SIGNAL(clicked()),
|
2001-08-25 03:00:19 +00:00
|
|
|
this, SLOT(slotClose()));
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
dialog_->copyright->setText(toqstr(controller().getCopyright()));
|
2002-01-31 13:15:33 +00:00
|
|
|
dialog_->copyright->append("\n");
|
2002-12-17 20:37:13 +00:00
|
|
|
dialog_->copyright->append(toqstr(controller().getLicense()));
|
2002-01-31 13:15:33 +00:00
|
|
|
dialog_->copyright->append("\n");
|
2002-12-17 20:37:13 +00:00
|
|
|
dialog_->copyright->append(toqstr(controller().getDisclaimer()));
|
2002-01-31 13:15:33 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
dialog_->versionLA->setText(toqstr(controller().getVersion()));
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
// The code below should depend on a autoconf test. (Lgb)
|
2002-12-09 16:35:17 +00:00
|
|
|
#if 1
|
2002-10-20 01:48:28 +00:00
|
|
|
// There are a lot of buggy stringstream implementations..., but the
|
|
|
|
// code below will work on all of them (I hope). The drawback with
|
|
|
|
// this solutions os the extra copying. (Lgb)
|
|
|
|
|
|
|
|
ostringstream in;
|
2001-08-21 01:14:54 +00:00
|
|
|
controller().getCredits(in);
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-11-04 02:12:42 +00:00
|
|
|
istringstream ss(in.str());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-21 01:14:54 +00:00
|
|
|
string s;
|
2002-10-20 01:48:28 +00:00
|
|
|
ostringstream out;
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-21 01:14:54 +00:00
|
|
|
while (getline(ss, s)) {
|
|
|
|
if (prefixIs(s, "@b"))
|
2002-10-20 01:48:28 +00:00
|
|
|
out << "<b>" << s.substr(2) << "</b>";
|
|
|
|
else if (prefixIs(s, "@i"))
|
|
|
|
out << "<i>" << s.substr(2) << "</i>";
|
|
|
|
else
|
|
|
|
out << s;
|
|
|
|
out << "<br>";
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
// Good stringstream implementations can handle this. It avoids
|
|
|
|
// some copying, and should thus be faster and use less memory. (Lgb)
|
|
|
|
// I'll make this the default for a short while to see if anyone
|
|
|
|
// see the error...
|
|
|
|
stringstream in;
|
|
|
|
controller().getCredits(in);
|
|
|
|
in.seekg(0);
|
|
|
|
string s;
|
|
|
|
ostringstream out;
|
|
|
|
|
|
|
|
while (getline(in, s)) {
|
|
|
|
if (prefixIs(s, "@b"))
|
|
|
|
out << "<b>" << s.substr(2) << "</b>";
|
2001-08-21 01:14:54 +00:00
|
|
|
else if (prefixIs(s, "@i"))
|
2002-10-20 01:48:28 +00:00
|
|
|
out << "<i>" << s.substr(2) << "</i>";
|
2001-08-21 01:14:54 +00:00
|
|
|
else
|
2002-10-20 01:48:28 +00:00
|
|
|
out << s;
|
|
|
|
out << "<br>";
|
2001-08-21 01:14:54 +00:00
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
#endif
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2003-09-15 12:00:03 +00:00
|
|
|
dialog_->creditsTV->setText(toqstr(out.str()));
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-08-29 02:04:31 +00:00
|
|
|
// try to resize to a good size
|
|
|
|
dialog_->copyright->hide();
|
|
|
|
dialog_->setMinimumSize(dialog_->copyright->sizeHint());
|
|
|
|
dialog_->copyright->show();
|
|
|
|
dialog_->setMinimumSize(dialog_->sizeHint());
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
// Manage the cancel/close button
|
2003-03-10 03:13:28 +00:00
|
|
|
bcview().setCancel(dialog_->closePB);
|
2001-08-19 13:25:15 +00:00
|
|
|
bc().refresh();
|
|
|
|
}
|