2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiAbout.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Kalle Dalheimer
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiAbout.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
2007-09-03 05:59:32 +00:00
|
|
|
#include "gettext.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QTextBrowser>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
using lyx::support::prefixIs;
|
|
|
|
|
|
|
|
using std::getline;
|
|
|
|
|
|
|
|
using std::istringstream;
|
|
|
|
using std::ostringstream;
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-04-24 11:32:09 +00:00
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
GuiAbout::GuiAbout(GuiDialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
: GuiView<GuiAboutDialog>(parent, _("About LyX"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiAbout::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
dialog_.reset(new GuiAboutDialog);
|
2006-03-05 17:24:44 +00:00
|
|
|
connect(dialog_.get()->closePB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(slotClose()));
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
dialog_->copyrightTB->setPlainText(toqstr(controller().getCopyright()));
|
2007-03-26 15:58:00 +00:00
|
|
|
dialog_->copyrightTB->append("");
|
|
|
|
dialog_->copyrightTB->append(toqstr(controller().getLicense()));
|
|
|
|
dialog_->copyrightTB->append("");
|
2006-05-04 07:31:46 +00:00
|
|
|
dialog_->copyrightTB->append(toqstr(controller().getDisclaimer()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
dialog_->versionLA->setText(toqstr(controller().getVersion()));
|
|
|
|
|
|
|
|
// The code below should depend on a autoconf test. (Lgb)
|
|
|
|
#if 1
|
|
|
|
// 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;
|
|
|
|
controller().getCredits(in);
|
|
|
|
|
|
|
|
istringstream ss(in.str());
|
|
|
|
|
|
|
|
string s;
|
|
|
|
ostringstream out;
|
|
|
|
|
|
|
|
while (getline(ss, s)) {
|
|
|
|
if (prefixIs(s, "@b"))
|
|
|
|
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>";
|
|
|
|
else if (prefixIs(s, "@i"))
|
|
|
|
out << "<i>" << s.substr(2) << "</i>";
|
|
|
|
else
|
|
|
|
out << s;
|
|
|
|
out << "<br>";
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-11-04 12:46:00 +00:00
|
|
|
dialog_->creditsTB->setHtml(toqstr(out.str()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
// try to resize to a good size
|
2006-05-04 07:31:46 +00:00
|
|
|
dialog_->copyrightTB->hide();
|
|
|
|
dialog_->setMinimumSize(dialog_->copyrightTB->sizeHint());
|
|
|
|
dialog_->copyrightTB->show();
|
2006-03-05 17:24:44 +00:00
|
|
|
dialog_->setMinimumSize(dialog_->sizeHint());
|
|
|
|
|
|
|
|
// Manage the cancel/close button
|
2007-09-03 05:59:32 +00:00
|
|
|
bc().setCancel(dialog_->closePB);
|
|
|
|
//FIXME bc().refresh();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 11:32:09 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiAbout_moc.cpp"
|