Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 208 → Rev 209

/trunk/Scribus/scribus.desktop
1,24 → 1,11
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=scribus
Name[en_US]=scribus
Comment=
Comment[en_US]=
Name=Scribus
Comment=Desktop Publishing
Exec=scribus %f
GenericName=
GenericName[en_US]=
Icon=/usr/local/lib/scribus/icons/scribusicon.png
Icon=scribusicon.png
MimeType=scd,scd.gz,sla,sla.gz
Name=scribus
Name[en_US]=scribus
Path=
ServiceTypes=
SwallowExec=
SwallowTitle=Scribus
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
Categories=Office;Application;
StartupWMClass=scribus
/trunk/Scribus/ChangeLogCVS
1,4 → 1,10
Changes since Version 1.1.5
25.02.2004 Included 2 Patches from Allessandro Rimoldini for the
Story Editor and the main.cpp file.
Fixed bugs with Textframes.
Display of Textframes should look now the same in all Magnifications.
Updated scribus.desktop file.
 
24.02.2004 Fixed Bug with wrong Gradients when copying Objects.
Moved the Documentation files to $prefix/share/scribus
Fixed Problems with Editing Styles changing unexpectedly Textframes.
/trunk/Scribus/scribus/story.cpp
438,7 → 438,22
void StoryEditor::closeEvent(QCloseEvent *event)
{
if (!event->isAccepted())
Do_leave();
{
if (TextChanged)
{
int t = QMessageBox::warning(this, tr("Warning"),
tr("Do you want save your changes?"),
QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
if (t == QMessageBox::Yes)
accept();
else if (t == QMessageBox::Cancel)
return;
else if (t == QMessageBox::No)
reject();
}
else
reject();
}
}
 
void StoryEditor::Do_leave()
/trunk/Scribus/scribus/scpainter.cpp
486,7 → 486,7
#else
strokeColor = ( 0 << 24 ) | ( color.blue() << 16 ) | ( color.green() << 8 ) | color.red();
#endif
double ratio = m_zoomFactor;//sqrt(pow(affine[0], 2) + pow(affine[3], 2)) / sqrt(2);
double ratio = m_zoomFactor; //sqrt(pow(affine[0], 2) + pow(affine[3], 2)) / sqrt(2);
if( m_array.count() > 0 )
{
// there are dashes to be rendered
/trunk/Scribus/scribus/pageitem.cpp
216,7 → 216,7
QColor tmp;
FPointArray CL;
QPointArray cl;
QPainter pf, pp;
QPainter pf, pp, pf2;
PageItem *nb;
QPoint pt1, pt2;
FPoint gv, ColBound;
518,6 → 518,9
break;
case 4:
p->save();
pf2.begin(Parent);
pf2.translate(Xpos, Ypos);
pf2.rotate(Rot);
if ((Pcolor != "None") || (GrType != 0))
{
p->setupPolygon(&PoLine);
585,7 → 588,7
nb = NextBox;
}
Doc->Vorlagen[0].LineSpa = LineSp;
QRegion cl = QRegion(pf.xForm(Clip));
QRegion cl = QRegion(pf2.xForm(Clip));
for (a=0; a<OwnPage->Items.count(); ++a)
{
if (((OwnPage->Items.at(a)->ItemNr > ItemNr)
597,7 → 600,7
pp.begin(Parent);
// pp.translate(OwnPage->Items.at(a)->Xpos*sc, OwnPage->Items.at(a)->Ypos*sc);
// pp.scale(sc, sc);
pp.scale(sc, sc);
// pp.scale(sc, sc);
pp.translate(OwnPage->Items.at(a)->Xpos, OwnPage->Items.at(a)->Ypos);
pp.rotate(OwnPage->Items.at(a)->Rot);
if (OwnPage->Items.at(a)->Textflow2)
660,7 → 663,9
OFs2 = 0;
aSpa = 0;
absa = 0;
MaxChars = 0;
MaxText = Ptext.count();
StartOfCol = true;
for (a = 0; a < MaxText; ++a)
{
hl = Ptext.at(a);
670,7 → 675,6
absa = hl->cab;
if (a == 0)
{
StartOfCol = true;
if (BackBox != 0)
{
nb = BackBox;
771,7 → 775,7
TopOffset = asce;
pt1 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(CurY+BotOffset));
pt2 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(ceil(CurY-TopOffset)));
while ((!cl.contains(pf.xForm(pt1))) || (!cl.contains(pf.xForm(pt2))))
while ((!cl.contains(pf2.xForm(pt1))) || (!cl.contains(pf2.xForm(pt2))))
{
fBorder = true;
CurX++;
796,7 → 800,6
CurX = ColBound.x();
ColBound = FPoint(ColBound.x(), ColBound.y()+RExtra+lineCorr);
CurY = asce+TExtra+lineCorr+1;
// CurY = TExtra+lineCorr;
if ((a > 0) && (Ptext.at(a-1)->ch == QChar(13)))
{
if (chx != QChar(13))
807,7 → 810,6
CurX += Doc->Vorlagen[hl->cab].Indent;
if (DropCmode)
desc2 = -(*Doc->AllFonts)[hl->cfont]->numDescender * Doc->Vorlagen[hl->cab].LineSpa * Doc->Vorlagen[hl->cab].DropLin;
// CurY = TExtra+lineCorr;
CurY += Doc->Vorlagen[hl->cab].Avor;
if (DropCmode)
DropLines = Doc->Vorlagen[hl->cab].DropLin;
829,6 → 831,7
CurX += Extra;
fBorder = false;
}
StartOfCol = false;
if (RTab)
{
if (((hl->ch == ".") && (TabCode == 2)) ||
893,7 → 896,7
CurX += (wide+hl->cextra) / 2;
pt1 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(CurY+desc+BExtra+lineCorr));
pt2 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(ceil(CurY-asce)));
if ((!cl.contains(pf.xForm(pt1))) || (!cl.contains(pf.xForm(pt2))) || (CurX+RExtra+lineCorr > ColBound.y()))
if ((!cl.contains(pf2.xForm(pt1))) || (!cl.contains(pf2.xForm(pt2))) || (CurX+RExtra+lineCorr > ColBound.y()))
outs = true;
Zli = new ZZ;
Zli->Zeich = chx;
953,13 → 956,13
tcli.setPoint(1, QPoint(qRound(hl->xp+wide), qRound(maxDY-DropLines*Doc->Vorlagen[absa].LineSpa)));
tcli.setPoint(2, QPoint(qRound(hl->xp+wide), qRound(maxDY)));
tcli.setPoint(3, QPoint(qRound(hl->xp), qRound(maxDY)));
cm = QRegion(pf.xForm(tcli));
cm = QRegion(pf2.xForm(tcli));
cl = cl.subtract(cm);
}
if ((hl->ch == QChar(13)) || (outs))
{
RTab = false;
StartOfCol = false;
// StartOfCol = false;
TabCode = 0;
if (outs)
{
997,7 → 1000,7
pt2 = QPoint(qRound(EndX), static_cast<int>(ceil(CurY-asce)));
EndX++;
}
while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
while ((cl.contains(pf2.xForm(pt1))) && (cl.contains(pf2.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
if (Doc->Vorlagen[absa].Ausri == 2)
OFs = EndX - LastXp;
if (Doc->Vorlagen[absa].Ausri == 1)
1057,7 → 1060,7
pt2 = QPoint(qRound(EndX), static_cast<int>(ceil(CurY-asce)));
EndX++;
}
while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
while ((cl.contains(pf2.xForm(pt1))) && (cl.contains(pf2.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
if (Doc->Vorlagen[absa].Ausri == 2)
OFs = EndX - CurX - Extra - lineCorr;
if (Doc->Vorlagen[absa].Ausri == 1)
1116,7 → 1119,7
double BotOffset = desc+BExtra+lineCorr;
pt1 = QPoint(qRound(CurX), static_cast<int>(CurY+BotOffset));
pt2 = QPoint(qRound(CurX), static_cast<int>(ceil(CurY-asce)));
while ((!cl.contains(pf.xForm(pt1))) || (!cl.contains(pf.xForm(pt2))))
while ((!cl.contains(pf2.xForm(pt1))) || (!cl.contains(pf2.xForm(pt2))))
{
CurX++;
if (CurX+RExtra+lineCorr > ColBound.y())
1125,7 → 1128,7
CurY += Doc->Vorlagen[hl->cab].LineSpa;
if ((CurY+BExtra+lineCorr > Height) && (CurrCol+1 == Cols))
{
nrc = a;
nrc = BuPos2;
goto NoRoom;
}
if (AbsHasDrop)
1193,7 → 1196,6
LiList.at(LiList.count()-1)->yco = hl->yp;
for (uint zc = 0; zc<BuPos3; ++zc)
{
StartOfCol = false;
Zli2 = LiList.at(zc);
if (Zli2->Farb != "None")
{
1238,7 → 1240,7
pt2 = QPoint(qRound(EndX), static_cast<int>(ceil(CurY-asce)));
EndX++;
}
while ((cl.contains(pf.xForm(pt1))) && (cl.contains(pf.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
while ((cl.contains(pf2.xForm(pt1))) && (cl.contains(pf2.xForm(pt2))) && (EndX+RExtra+lineCorr < ColBound.y()));
if (Doc->Vorlagen[absa].Ausri == 2)
OFs = EndX - CurX - Extra - lineCorr;
if (Doc->Vorlagen[absa].Ausri == 1)
1281,7 → 1283,6
}
for (uint zc = 0; zc<LiList.count(); ++zc)
{
StartOfCol = false;
Zli2 = LiList.at(zc);
if (Zli2->Farb != "None")
{
1299,9 → 1300,9
desc = qRound((*Doc->AllFonts)[Zli2->ZFo]->numDescender * (-Zli2->Siz / 10.0));
asce = qRound((*Doc->AllFonts)[Zli2->ZFo]->numAscent * (Zli2->Siz / 10.0));
p->setFillMode(1);
p->setBrush(darkBlue);
p->setBrush(darkBlue);
if (!Doc->RePos)
p->drawRect(Zli2->xco, Zli2->yco-asce, wide+1, asce+desc);
p->drawRect(Zli2->xco, Zli2->yco-asce, wide+1, asce+desc);
p->setBrush(white);
}
if (!Doc->RePos)
1317,9 → 1318,11
}
MaxChars = Ptext.count();
Redrawn = true;
pf2.end();
p->restore();
break;
NoRoom: if (NextBox != 0)
NoRoom: pf2.end();
if (NextBox != 0)
{
nrc2 = Ptext.count();
for (uint ss=nrc; ss<nrc2; ++ss)
/trunk/Scribus/scribus/libabout/about.cpp
54,7 → 54,7
tabLayout1->addWidget( PixmapLabel1 );
BuildID = new QLabel( tab, "BB" );
BuildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1. %2 %3 ").arg(24).arg("February").arg(2004);
QString bu = tr("%1. %2 %3 ").arg(25).arg("February").arg(2004);
#ifdef HAVE_CMS
bu += "C";
#else
/trunk/Scribus/scribus/plugins/scriptplugin/doc/en/Makefile.am
1,7 → 1,7
####### kdevelop will overwrite this part!!! (begin)##########
 
 
EXTRA_DIST = index.html node1.html node10.html node11.html node12.html node13.html node14.html node15.html node16.html node17.html node18.html node2.html node3.html Scripter.png node9.html node8.html node7.html node6.html node5.html node4.html Manual.css node19.html
EXTRA_DIST = index.html node1.html node10.html node11.html node12.html node13.html node14.html node15.html node16.html node17.html node18.html node2.html node3.html scribus_head.png Scripter.png node9.html node8.html node7.html node6.html node5.html node4.html Manual.css node19.html
 
install-data-local:
$(mkinstalldirs) $(prefix)/share/scribus/doc/en/Scripter/
31,6 → 31,8
$(mkinstalldirs) $(prefix)/share/scribus/doc/en/Scripter/
$(INSTALL_DATA) $(srcdir)/node3.html $(prefix)/share/scribus/doc/en/Scripter/node3.html
$(mkinstalldirs) $(prefix)/share/scribus/doc/en/Scripter/
$(INSTALL_DATA) $(srcdir)/scribus_head.png $(prefix)/share/scribus/doc/en/Scripter/scribus_head.png
$(mkinstalldirs) $(prefix)/share/scribus/doc/en/Scripter/
$(INSTALL_DATA) $(srcdir)/Scripter.png $(prefix)/share/scribus/doc/en/Scripter/Scripter.png
$(mkinstalldirs) $(prefix)/share/scribus/doc/en/Scripter/
$(INSTALL_DATA) $(srcdir)/node9.html $(prefix)/share/scribus/doc/en/Scripter/node9.html
63,6 → 65,7
-rm -f $(prefix)/share/scribus/doc/en/Scripter/node18.html
-rm -f $(prefix)/share/scribus/doc/en/Scripter/node2.html
-rm -f $(prefix)/share/scribus/doc/en/Scripter/node3.html
-rm -f $(prefix)/share/scribus/doc/en/Scripter/scribus_head.png
-rm -f $(prefix)/share/scribus/doc/en/Scripter/Scripter.png
-rm -f $(prefix)/share/scribus/doc/en/Scripter/node9.html
-rm -f $(prefix)/share/scribus/doc/en/Scripter/node8.html
/trunk/Scribus/scribus/plugins/scriptplugin/doc/en/index.html
35,7 → 35,7
<BR>
<!--End of Navigation Panel-->
 
<center><IMG SRC="../scribus_head.png" NAME="Graphic1" ALT="Scribus Logo" ALIGN=MIDDLE WIDTH=400 HEIGHT=79 BORDER=0></center><BR>
<center><IMG SRC="scribus_head.png" NAME="Graphic1" ALT="Scribus Logo" ALIGN=MIDDLE WIDTH=400 HEIGHT=79 BORDER=0></center><BR>
 
<h1 align="CENTER">Scripting Scribus with Python</h1>
<div>
/trunk/Scribus/scribus/plugins/scriptplugin/doc/en/scribus_head.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: Scribus/scribus/main.cpp
===================================================================
--- Scribus/scribus/main.cpp (revision 208)
+++ Scribus/scribus/main.cpp (revision 209)
@@ -4,6 +4,8 @@
begin : Fre Apr 6 21:47:55 CEST 2001
copyright : (C) 2001 by Franz Schmid
email : Franz.Schmid@altmuehlnet.de
+ copyright : (C) 2004 by Alessandro Rimoldi
+ email : http://ideale.ch/contact
***************************************************************************/
/***************************************************************************
@@ -20,9 +22,17 @@
#include <qstring.h>
#include <qtranslator.h>
#include <qfileinfo.h>
+#include <qfile.h>
#include <qdir.h>
#include <qtextcodec.h>
#include <cstdlib>
+
+#include <iostream>
+
+#define SCRIBUS_LIB PREL "/lib/scribus/"
+#define SCRIBUS_PLUGIN PREL "/lib/scribus/plugins/"
+#define BASE_QM "scribus"
+
#include "scribus.h"
#if (_MSC_VER >= 1200)
@@ -31,130 +41,179 @@
#include "config.h"
#endif
-#include <iostream>
-using namespace std;
+QString lang = "";
+bool showSplash = true;
+bool useGui = true;
+QString file;
+void showUsage();
+int mainGui(int argc, char **argv);
+QString getLang(QString lang);
+void installTranslators(QApplication *app, QString lang);
+
+
int main(int argc, char *argv[])
{
- QString pfad = PREL;
- pfad += "/lib/scribus/";
- QApplication app(argc, argv);
- QString Arg1, lang;
- lang = "";
- if (argc > 1)
- Arg1 = QString(app.argv()[1]);
- QTranslator tor( 0 );
- if (argc > 1)
- {
- if (Arg1 == "--lang")
- {
- if (QString(argv[2]) != "en")
- {
- lang = QString(argv[2]);
- tor.load( QString(pfad+"scribus.") + QString(argv[2]), "." );
- app.installTranslator( &tor );
- }
- }
- else
- {
- if (QString(QTextCodec::locale()).left(5) == "en_GB")
- tor.load( QString(pfad+"scribus.") + "en_GB", "." );
- else
- tor.load( QString(pfad+"scribus.") + QString(QTextCodec::locale()).left(2), "." );
- lang = QString(QTextCodec::locale()).left(2);
- app.installTranslator( &tor );
- }
- }
- else
- {
- lang = QString(QTextCodec::locale()).left(2);
- if (QString(QTextCodec::locale()).left(5) == "en_GB")
- tor.load( QString(pfad+"scribus.") + "en_GB", "." );
- else
- tor.load( QString(pfad+"scribus.") + QString(QTextCodec::locale()).left(2), "." );
- app.installTranslator( &tor );
- }
- pfad = PREL;
- pfad += "/lib/scribus/plugins/";
- QDir d(pfad, "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
- if ((d.exists()) && (d.count() != 0))
- {
- for (uint dc = 0; dc < d.count(); ++dc)
- {
- QFileInfo fi(pfad + d[dc]);
- QString ext = fi.extension(false).lower();
- if (ext == "qm")
- {
- QString ext2 = fi.extension(true).lower();
- ext2 = ext2.left(2);
- if (ext2 == lang)
- {
- QTranslator *tox = new QTranslator(0);
- tox->load(QString(pfad+d[dc]), ".");
- app.installTranslator(tox);
- }
- }
- }
- }
- if (argc > 1)
- {
- if (Arg1 == "--version")
- {
- cout << "Scribus Version " << VERSION << endl;
-// app.unlock();
- return 0;
- }
- if (Arg1 == "--help")
- {
- cout << endl;
- cout << "Scribus, a DTP-Program" << endl;
- cout << endl;
- cout << "Usage:" << endl;
- cout << "scribus --version -> prints Version-Number and exits." << endl;
- cout << "scribus --help -> prints this Info and exits." << endl;
- cout << "scribus --lang xx -> uses xx as Shortcut for a Language." << endl;
- cout << "scribus \"String\" -> Interprets \"String\" as Filename" << endl;
- cout << " for a Document and tries to open it." << endl;
- cout << endl;
-// app.unlock();
- return 0;
- }
- if ((Arg1 != "--lang") && (Arg1 != "--help") && (Arg1 != "--version") && (Arg1 != "--nosplash"))
- {
- QFileInfo fi = QFileInfo(QFile::decodeName(app.argv()[1]));
- if (!fi.exists())
- {
- cout << "File does not exist, aborting." << endl;
- cout << endl;
- cout << "Usage:" << endl;
- cout << "scribus --version -> prints Version-Number and exits." << endl;
- cout << "scribus --help -> prints this Info and exits." << endl;
- cout << "scribus --lang xx -> uses xx as Shortcut for a Language." << endl;
- cout << "scribus \"String\" -> Interprets \"String\" as Filename" << endl;
- cout << " for a Document and tries to open it." << endl;
- cout << endl;
-// app.unlock();
- return 0;
- }
- }
- }
-
- app.processEvents();
- ScribusApp *scribus = new ScribusApp();
- scribus->initGui();
- if (scribus->NoFonts)
- {
- exit(EXIT_FAILURE);
- }
- app.setMainWidget(scribus);
- app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
+ QString arg = "";
- scribus->show();
- scribus->ShowSubs();
- if (argc > 1)
- {
- if ((Arg1 != "--lang") && (Arg1 != "--help") && (Arg1 != "--version"))
- scribus->LadeDoc(QFile::decodeName(app.argv()[1]));
- }
- return app.exec();
+ arg = argv[1];
+ if (arg == "--version") {
+ std::cout << "Scribus Version " << VERSION << std::endl;
+ return 0;
+ } else if (arg == "--help") {
+ std::cout << std::endl;
+ std::cout << "Scribus, a DTP-Program" << std::endl;
+ showUsage();
+ return 0;
+ }
+
+ for(int i = 1; i < argc; i++) {
+ arg = argv[i];
+ if ((arg == "--lang") && (++i < argc)) {
+ lang = argv[i];
+ } else if (arg == "--no-splash") {
+ showSplash = false;
+ } else if (arg == "--no-gui") {
+ useGui = false;
+ } else {
+ file = QFile::decodeName(argv[i]);
+ if (!QFileInfo(file).exists()) {
+ std::cout << std::endl;
+ if (file.left(2) == "--") {
+ std::cout << "Invalid argument: " << file << std::endl;
+ } else {
+ std::cout << "File " << file << "does not exist, aborting." << std::endl;
+ }
+ showUsage();
+ return 0;
+ }
+ }
+ }
+
+ if (useGui)
+ return mainGui(argc, argv);
}
+
+/*!
+ \fn void showUsage()
+ \author Franz Schmid
+ \author Alessandro Rimoldi
+ \date Mon Feb 9 14:07:46 CET 2004
+ \brief If no argument specified the lang, returns the one in the locales
+ \param lang QString a two letter string describing the lang environement
+ \retval QString A string describing the language environement
+ */
+void showUsage()
+{
+ std::cout << std::endl;
+ std::cout << "Usage: scribus [option ... ] [file]" << std::endl;
+ std::cout << "Options:" << std::endl;
+ std::cout << "--lang xx Uses xx as shortcut for a language" << std::endl;
+ std::cout << "--help Print help (this message) and exit" << std::endl;
+ std::cout << "--version Output version information and exit" << std::endl;
+ std::cout << std::endl;
+}
+
+/*!
+ \fn int mainGui(int argc, char **argv)
+ \author Franz Schmid
+ \author Alessandro Rimoldi
+ \date Mon Feb 9 14:07:46 CET 2004
+ \brief Launches the Gui
+ \param int Number of arguments passed to Scribus
+ \param char *argv list of the arguments passed to Scribus
+ \retval int Error code from the execution of Scribus
+ */
+int mainGui(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ lang = getLang(QString(lang));
+
+ if (lang != "")
+ installTranslators(&app, lang);
+
+ app.processEvents();
+
+ ScribusApp *scribus = new ScribusApp();
+ scribus->initGui();
+ if (scribus->NoFonts)
+ exit(EXIT_FAILURE);
+ app.setMainWidget(scribus);
+ app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
+
+ scribus->show();
+ scribus->ShowSubs();
+ if (file != "")
+ scribus->LadeDoc(file);
+
+ return app.exec();
+}
+
+/*!
+ \fn void installTranslators(QApplication *app, QString lang)
+ \author Franz Schmid
+ \author Alessandro Rimoldi
+ \date Mon Feb 9 14:07:46 CET 2004
+ \brief If the lang argument is empty, returns the value in the locales
+
+ The lang is always a two character code, except for "en_GB" where
+ the whole string is returned. For all the other locales starting
+ with "en", no locale is returned.
+
+ \param lang QString a two letter string describing the lang environement
+ \retval QString A string describing the language environement
+ */
+QString getLang(QString lang)
+{
+ if (lang == "") {
+ QString locale = QString(QTextCodec::locale());
+ if (locale.left(5) == "en_GB") {
+ lang = "en_GB";
+ } else if (locale.left(2) != "en") {
+ lang = locale.left(2);
+ }
+ } else if (lang.left(2) == "en") {
+ lang = "";
+ } else {
+ lang = lang.left(2);
+ }
+ return lang;
+}
+
+/*!
+ \fn void installTranslators(QApplication *app, QString lang)
+ \author Franz Schmid
+ \author Alessandro Rimoldi
+ \date Mon Feb 9 14:07:46 CET 2004
+ \brief Loads the translations for Scribus and for the Plugins
+ \param app QApplication pointer to the application object
+ \param lang QString a two letter string describing the lang environement
+ \retval void
+ */
+void installTranslators(QApplication *app, QString lang)
+{
+ QTranslator *trans = new QTranslator(0);
+
+ QString path = SCRIBUS_LIB;
+ path += BASE_QM;
+
+ trans->load(QString(path + '.' + lang), ".");
+ app->installTranslator(trans);
+
+ /* ! the en_GB localisations cannot be loaded... ! */
+ path = SCRIBUS_PLUGIN;
+ QDir dir(path , "*.*", QDir::Name, QDir::Files | QDir::NoSymLinks);
+ if (dir.exists() && (dir.count() != 0)) {
+ for (uint i = 0; i < dir.count(); ++i) {
+ QFileInfo file(path + dir[i]);
+ if ((file.extension(false).lower() == "qm")
+ && (file.extension(true).lower().left(2) == lang)) {
+ trans = new QTranslator(0);
+ trans->load(QString(path + dir[i]), ".");
+ app->installTranslator(trans);
+ }
+
+ }
+ }
+}