mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
123cc28dba
Index: src/frontends/qt4/QCitationDialog.C Index: src/frontends/qt4/QCitationDialog.h Index: src/frontends/qt4/ui/QCitationFindUi.ui Index: src/frontends/qt4/QPrefsDialog.C Index: src/frontends/qt4/QPrefsDialog.h Index: src/frontends/qt4/ui/QPrefColorsUi.ui Index: src/frontends/qt4/ui/QPrefCopiersUi.ui Index: src/frontends/qt4/ui/QPrefFileformatsUi.ui Index: src/frontends/qt4/ui/QPrefConvertersUi.ui Index: src/frontends/qt4/QParagraphDialog.C no more qt3 drag n drop: Index: src/frontends/qt4/QWorkArea.C as discussed on list: Index: src/frontends/qt4/QLyXKeySym.C Index: src/frontends/qt4/QLyXKeySym.h bit of repair here: Index: src/frontends/qt4/ui/QAboutUi.ui Index: src/frontends/qt4/QAbout.C bit of cleaning here (no separate color column, but rather icon) Index: src/frontends/qt4/QBranches.C got rid of this altogether: Index: src/frontends/qt4/qcoloritem.C Index: src/frontends/qt4/qcoloritem.h Index: src/frontends/qt4/Makefile.am + filedialog to qt4 one git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13805 a592a061-630c-0410-9148-cb99ea01b6c8
132 lines
3.0 KiB
C
132 lines
3.0 KiB
C
/**
|
|
* \file QAbout.C
|
|
* 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>
|
|
|
|
#include "QAbout.h"
|
|
#include "QAboutDialog.h"
|
|
#include "Qt2BC.h"
|
|
#include "qt_helpers.h"
|
|
|
|
#include "controllers/ButtonController.h"
|
|
#include "controllers/ControlAboutlyx.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include <sstream>
|
|
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QTextCodec>
|
|
#include <QTextBrowser>
|
|
|
|
using lyx::support::prefixIs;
|
|
|
|
using std::getline;
|
|
|
|
using std::istringstream;
|
|
using std::ostringstream;
|
|
using std::string;
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
|
|
|
|
QAbout::QAbout(Dialog & parent)
|
|
: base_class(parent, _("About LyX"))
|
|
{
|
|
}
|
|
|
|
|
|
void QAbout::build_dialog()
|
|
{
|
|
dialog_.reset(new QAboutDialog);
|
|
connect(dialog_.get()->closePB, SIGNAL(clicked()),
|
|
this, SLOT(slotClose()));
|
|
|
|
dialog_->copyrightTB->setPlainText(toqstr(controller().getCopyright()));
|
|
dialog_->copyrightTB->append("\n");
|
|
dialog_->copyrightTB->append(toqstr(controller().getLicense()));
|
|
dialog_->copyrightTB->append("\n");
|
|
dialog_->copyrightTB->append(toqstr(controller().getDisclaimer()));
|
|
|
|
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
|
|
|
|
// Try and grab the latin1 codec
|
|
QTextCodec * const codec =
|
|
QTextCodec::codecForName("ISO8859-1");
|
|
if (!codec)
|
|
lyxerr << "Unable to find ISO8859-1 codec" << std::endl;
|
|
|
|
QString const qtext = codec ?
|
|
codec->toUnicode(out.str().c_str()) :
|
|
toqstr(out.str());
|
|
dialog_->creditsTB->setHtml(qtext);
|
|
|
|
// try to resize to a good size
|
|
dialog_->copyrightTB->hide();
|
|
dialog_->setMinimumSize(dialog_->copyrightTB->sizeHint());
|
|
dialog_->copyrightTB->show();
|
|
dialog_->setMinimumSize(dialog_->sizeHint());
|
|
|
|
// Manage the cancel/close button
|
|
bcview().setCancel(dialog_->closePB);
|
|
bc().refresh();
|
|
}
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|