/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremstandard.cpp |
---|
1,14 → 1,10 |
#include "loremstandard.h" |
#include "scribus.h" |
#include <qfile.h> |
#include <qdir.h> |
#include <qtextstream.h> |
LoremStandard::LoremStandard(QString u, uint para) |
LoremStandard::LoremStandard(uint para) |
{ |
paragraphs = para; |
url = u; |
} |
LoremStandard::~LoremStandard() |
17,7 → 13,7 |
QString LoremStandard::makeLorem() |
{ |
QFile f(PREL + QDir::convertSeparators(url)); |
QFile f("/home/subzero/devel/SCRIBUS/share/scribus/samples/LoremIpsum.txt"); |
if (f.open(IO_ReadOnly)) |
{ |
QTextStream stream(&f); |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremstandard.h |
---|
3,17 → 3,15 |
#include <qstringlist.h> |
class LoremStandard//: public QObject |
class LoremStandard |
{ |
//Q_OBJECT |
public: |
QString url; |
uint paragraphs; |
QStringList sentences; |
public: |
uint paragraphs; |
QStringList sentences; |
LoremStandard(QString u, uint para); |
~LoremStandard(); |
QString makeLorem(); |
LoremStandard(uint para); |
~LoremStandard(); |
QString makeLorem(); |
}; |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremconfig.cpp |
---|
1,11 → 1,7 |
#include "loremconfig.h" |
#include "prefsfile.h" |
#include <qdir.h> |
#define CFG "/home/subzero/devel/Subik/scribus-lorem-ipsum/lorem-ipsum/config/" |
extern PrefsFile *prefsFile; |
LoremInfo::LoremInfo(QString n, QString u, QString d, QString t) |
{ |
name = n; |
25,22 → 21,14 |
LoremInfo::~LoremInfo() |
{ |
} |
#include <iostream.h> |
LoremConfig::LoremConfig() |
{ |
// cfg |
prefs = prefsFile->getPluginContext("lorem-ipsum"); |
paragraphs = prefs->getUInt("paragraphs", 4); |
cout << endl << endl << paragraphs << endl; |
avgSentences = prefs->getUInt("avgSentences", 4); |
cout << avgSentences << endl; |
shouldStartWith = prefs->getBool("shouldStartWith", TRUE); |
cout << shouldStartWith << endl; |
errMsg = "OK"; |
// parse the main config |
QXmlSimpleReader reader; |
reader.setContentHandler(this); |
QFile *f = new QFile(PREL + QDir::convertSeparators("/share/scribus/lorem-ipsum/lorem-ipsum.xml")); |
QFile *f = new QFile(QString(CFG) + QString("/lorem-ipsum.xml")); |
if (!f->exists()) |
errMsg = "Config file doesn't exists"; |
QXmlInputSource* source = new QXmlInputSource(f); |
51,9 → 39,6 |
LoremConfig::~LoremConfig() |
{ |
prefs->set("paragraphs", paragraphs); |
prefs->getUInt("avgSentences", avgSentences); |
prefs->getBool("shouldStartWith", shouldStartWith); |
} |
bool LoremConfig::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs) |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremconfig.h |
---|
5,36 → 5,21 |
#include <qstringlist.h> |
#include <qptrlist.h> |
#include "scribus.h" |
#include "prefscontext.h" |
/*! This class holds basic info of each LI dictionary. |
\author Petr Vanek |
*/ |
class LoremInfo//: public QObject |
{ |
//Q_OBJECT |
public: |
/*! Name of the dictionary - it is shown in GUI */ |
QString name; |
/*! URL to the dictionary - filesystem, network... */ |
QString url; |
/*! Description of the dict. Shown in GUI */ |
QString description; |
/*! Type of the dict. This is a flag to decide "what to do" */ |
QString type; |
/*! Constructor with info filled */ |
LoremInfo(QString n, QString u, QString d, QString t); |
/*! Basic constructor */ |
LoremInfo(); |
/*! Nothing doing desc. */ |
~LoremInfo(); |
}; |
/*! Everything important for user is stored in this class. |
All LI dictionaries, parameters for generator and GUI. |
\author Petr Vanek |
*/ |
class LoremConfig: public QXmlDefaultHandler |
{ |
//Q_OBJECT |
41,25 → 26,10 |
public: |
/*! list of the LoremInfo instances */ |
QPtrList<LoremInfo> info; |
/*! Obsolete? Error message */ |
QString errMsg; |
/*! Preferences handler */ |
PrefsContext *prefs; |
/*! Number of the returning paragraphs */ |
uint paragraphs; |
/*! Average count of the sentences in the paragraph - it's used only |
sometimes */ |
uint avgSentences; |
/*! Should the LI start with obligatory "Lorem Ipsum"? */ |
bool shouldStartWith; |
/*! Reads configuration of this plugin */ |
LoremConfig(); |
/*! saves the config */ |
~LoremConfig(); |
/*! This is the XML reader method because this class is inherited from |
QXmlDefaultHandler - here I specify what to do with XML elements. |
*/ |
bool startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs); |
}; |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremturkey.cpp |
---|
1,11 → 1,10 |
#include "loremturkey.h" |
#include "scribus.h" |
#include <qfile.h> |
#include <qdir.h> |
#include <qdatetime.h> |
#include <qtextcodec.h> |
#define CFG "/home/subzero/devel/Subik/scribus-lorem-ipsum/lorem-ipsum/config/" |
#include <qtextcodec.h> |
LoremTurkey::LoremTurkey(QString file, uint par, uint sent, bool s) |
{ |
paragraphs = par; |
13,7 → 12,7 |
startWithLorem = s; |
// read data |
QFile f(PREL + QDir::convertSeparators("/share/scribus/lorem-ipsum/") + file); |
QFile f(CFG + file); |
if (f.open(IO_ReadOnly)) |
{ |
QTextStream stream(&f); |
42,7 → 41,7 |
{ |
QString lorem = ""; |
if (startWithLorem) |
lorem = "Lorem Ipsum. "; |
lorem = "Lorem Ipsum."; |
for (uint i = 0; i < paragraphs; ++i) |
lorem += makeParagraph(); |
return lorem.stripWhiteSpace(); |
63,12 → 62,10 |
// capitalize 1st char in the sentence |
lorem = lorem.left(1).upper() + lorem.right(lorem.length() - 1); |
for (uint i = 0; i < (4 + rand()%9); ++i) |
for (uint i = 0; i < 10; ++i) |
lorem += " " + makeWord(); |
//return lorem + ". "; |
if (rand()%1 == 1) |
return lorem + ". "; |
return lorem + ", "; |
return lorem + ". "; |
} |
QString LoremTurkey::makeWord() |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/config/lorem-ipsum.xml |
---|
1,7 → 1,5 |
<?xml version="1.0" encoding="utf8"?> |
<lorem> |
<file name="Default" url="/share/scribus/samples/LoremIpsum.txt" description="Standard Scribus Lorem" type="static"/> |
<file name="Bass" url="turkey-bass.txt" description="Yo, man!" type="turkey"/> |
<file name="czech" url="turkey-czech.txt" description="Czech with specials" type="turkey"/> |
<file name="czech ASCII" url="turkey-czech-ascii.txt" description="Czech L.I. in ASCII - without any special chars" type="turkey"/> |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/config/Makefile.am |
---|
1,20 → 1,0 |
EXTRA_DIST = lorem-ipsum.xml turkey-bass.txt turkey-czech-ascii.txt turkey-czech.txt turkey-default.txt |
install-data-local: |
$(mkinstalldirs) $(prefix)/share/scribus/lorem-ipsum/ |
$(INSTALL_DATA) $(srcdir)/lorem-ipsum.xml $(prefix)/share/scribus/lorem-ipsum/lorem-ipsum.xml |
$(mkinstalldirs) $(prefix)/share/scribus/lorem-ipsum/ |
$(INSTALL_DATA) $(srcdir)/turkey-bass.txt $(prefix)/share/scribus/lorem-ipsum/turkey-bass.txt |
$(mkinstalldirs) $(prefix)/share/scribus/lorem-ipsum/ |
$(INSTALL_DATA) $(srcdir)/turkey-czech-ascii.txt $(prefix)/share/scribus/lorem-ipsum/turkey-czech-ascii.txt |
$(mkinstalldirs) $(prefix)/share/scribus/lorem-ipsum/ |
$(INSTALL_DATA) $(srcdir)/turkey-czech.txt $(prefix)/share/scribus/lorem-ipsum/turkey-czech.txt |
$(mkinstalldirs) $(prefix)/share/scribus/lorem-ipsum/ |
$(INSTALL_DATA) $(srcdir)/turkey-default.txt $(prefix)/share/scribus/lorem-ipsum/turkey-default.txt |
uninstall-local: |
-rm -f $(prefix)/share/scribus/lorem-ipsum/lorem-ipsum.xml |
-rm -f $(prefix)/share/scribus/lorem-ipsum/turkey-bass.txt |
-rm -f $(prefix)/share/scribus/lorem-ipsum/turkey-czech-ascii.txt |
-rm -f $(prefix)/share/scribus/lorem-ipsum/turkey-czech.txt |
-rm -f $(prefix)/share/scribus/lorem-ipsum/turkey-default.txt |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremnetwork.cpp |
---|
1,15 → 1,13 |
#include "loremnetwork.h" |
#include <qurl.h> |
#include <iostream.h> |
LoremNetwork::LoremNetwork(QString u) |
{ |
url = u; |
lorem = ""; |
http = new QHttp; |
connect(http, SIGNAL(done(bool)), this, SLOT(fetchDone(bool))); |
qDebug(errorString()); |
cout << this << endl; |
connect(this, SIGNAL(done(bool)), this, SLOT(fetchDone(bool))); |
} |
LoremNetwork::~LoremNetwork() |
19,16 → 17,17 |
QString LoremNetwork::makeLorem() |
{ |
QUrl u(url); |
http->setHost(u.host()); |
http->get("/generator2?" + u.query()); |
qDebug(http->errorString()); |
setHost(u.host()); |
get("/generator2?" + u.query()); |
return lorem; |
} |
void LoremNetwork::fetchDone(bool error) |
{ |
qDebug(http->errorString()); |
if (error) |
lorem = "NETWORK error" + errorString(); |
else |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremnetwork.h |
---|
9,11 → 9,9 |
class LoremNetwork: public QHttp |
{ |
// Can't find Plug-in/undefined reference with Q_OBJECT |
Q_OBJECT |
public: |
QString url; |
QString lorem; |
QHttp *http; |
LoremNetwork(QString u); |
~LoremNetwork(); |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremdialog.cpp |
---|
1,7 → 1,7 |
/**************************************************************************** |
** Form implementation generated from reading ui file 'loremdialog.ui' |
** |
** Created: Út lis 23 19:05:01 2004 |
** Created: So lis 20 19:34:41 2004 |
** by: The User Interface Compiler ($Id$) |
** |
** WARNING! All changes made in this file will be lost! |
11,6 → 11,8 |
#include <qvariant.h> |
#include <qpushbutton.h> |
#include <qtabwidget.h> |
#include <qwidget.h> |
#include <qlabel.h> |
#include <qheader.h> |
#include <qlistview.h> |
35,44 → 37,114 |
setName( "LoremDialog" ); |
LoremDialogLayout = new QGridLayout( this, 1, 1, 11, 6, "LoremDialogLayout"); |
layout24 = new QVBoxLayout( 0, 0, 6, "layout24"); |
layout14 = new QVBoxLayout( 0, 0, 6, "layout14"); |
textLabel8 = new QLabel( this, "textLabel8" ); |
layout24->addWidget( textLabel8 ); |
tabWidget = new QTabWidget( this, "tabWidget" ); |
dictionaryView = new QListView( this, "dictionaryView" ); |
turkeyTab = new QWidget( tabWidget, "turkeyTab" ); |
turkeyTabLayout = new QGridLayout( turkeyTab, 1, 1, 11, 6, "turkeyTabLayout"); |
layout22 = new QVBoxLayout( 0, 0, 6, "layout22"); |
textLabel8 = new QLabel( turkeyTab, "textLabel8" ); |
layout22->addWidget( textLabel8 ); |
layout21 = new QHBoxLayout( 0, 0, 6, "layout21"); |
layout20 = new QVBoxLayout( 0, 0, 6, "layout20"); |
textLabel4 = new QLabel( turkeyTab, "textLabel4" ); |
layout20->addWidget( textLabel4 ); |
spacer2 = new QSpacerItem( 20, 180, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
layout20->addItem( spacer2 ); |
layout21->addLayout( layout20 ); |
dictionaryView = new QListView( turkeyTab, "dictionaryView" ); |
dictionaryView->addColumn( tr( "Name" ) ); |
dictionaryView->addColumn( tr( "Type" ) ); |
dictionaryView->addColumn( tr( "Description" ) ); |
dictionaryView->addColumn( tr( "Url" ) ); |
layout24->addWidget( dictionaryView ); |
layout21->addWidget( dictionaryView ); |
layout22->addLayout( layout21 ); |
layout7 = new QHBoxLayout( 0, 0, 6, "layout7"); |
textLabel5 = new QLabel( this, "textLabel5" ); |
textLabel5 = new QLabel( turkeyTab, "textLabel5" ); |
layout7->addWidget( textLabel5 ); |
turkeyParagraphs = new QSpinBox( this, "turkeyParagraphs" ); |
turkeyParagraphs = new QSpinBox( turkeyTab, "turkeyParagraphs" ); |
turkeyParagraphs->setMinValue( 1 ); |
turkeyParagraphs->setValue( 4 ); |
layout7->addWidget( turkeyParagraphs ); |
layout24->addLayout( layout7 ); |
layout22->addLayout( layout7 ); |
layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); |
textLabel6 = new QLabel( this, "textLabel6" ); |
textLabel6 = new QLabel( turkeyTab, "textLabel6" ); |
layout8->addWidget( textLabel6 ); |
avgSentences = new QSpinBox( this, "avgSentences" ); |
avgSentences = new QSpinBox( turkeyTab, "avgSentences" ); |
avgSentences->setMinValue( 1 ); |
avgSentences->setValue( 5 ); |
layout8->addWidget( avgSentences ); |
layout24->addLayout( layout8 ); |
layout22->addLayout( layout8 ); |
shouldStartLorem = new QCheckBox( this, "shouldStartLorem" ); |
shouldStartLorem->setChecked( TRUE ); |
layout24->addWidget( shouldStartLorem ); |
turkeyStartLorem = new QCheckBox( turkeyTab, "turkeyStartLorem" ); |
turkeyStartLorem->setChecked( TRUE ); |
layout22->addWidget( turkeyStartLorem ); |
turkeyTabLayout->addLayout( layout22, 0, 0 ); |
tabWidget->insertTab( turkeyTab, QString("") ); |
networkTab = new QWidget( tabWidget, "networkTab" ); |
networkTabLayout = new QGridLayout( networkTab, 1, 1, 11, 6, "networkTabLayout"); |
layout19 = new QVBoxLayout( 0, 0, 6, "layout19"); |
textLabel7 = new QLabel( networkTab, "textLabel7" ); |
layout19->addWidget( textLabel7 ); |
layout18 = new QHBoxLayout( 0, 0, 6, "layout18"); |
layout16 = new QVBoxLayout( 0, 0, 6, "layout16"); |
textLabel4_2 = new QLabel( networkTab, "textLabel4_2" ); |
layout16->addWidget( textLabel4_2 ); |
spacer3 = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
layout16->addItem( spacer3 ); |
layout18->addLayout( layout16 ); |
networkView = new QListView( networkTab, "networkView" ); |
networkView->addColumn( tr( "Name" ) ); |
networkView->addColumn( tr( "Description" ) ); |
networkView->addColumn( tr( "Url" ) ); |
layout18->addWidget( networkView ); |
layout19->addLayout( layout18 ); |
networkTabLayout->addLayout( layout19, 0, 0 ); |
tabWidget->insertTab( networkTab, QString("") ); |
standardTab = new QWidget( tabWidget, "standardTab" ); |
QWidget* privateLayoutWidget = new QWidget( standardTab, "layout5" ); |
privateLayoutWidget->setGeometry( QRect( 10, 10, 250, 114 ) ); |
layout5 = new QVBoxLayout( privateLayoutWidget, 11, 6, "layout5"); |
textLabel3 = new QLabel( privateLayoutWidget, "textLabel3" ); |
layout5->addWidget( textLabel3 ); |
layout1 = new QHBoxLayout( 0, 0, 6, "layout1"); |
textLabel1 = new QLabel( privateLayoutWidget, "textLabel1" ); |
layout1->addWidget( textLabel1 ); |
standardParaBox = new QSpinBox( privateLayoutWidget, "standardParaBox" ); |
standardParaBox->setMinValue( 1 ); |
standardParaBox->setValue( 4 ); |
layout1->addWidget( standardParaBox ); |
layout5->addLayout( layout1 ); |
tabWidget->insertTab( standardTab, QString("") ); |
layout14->addWidget( tabWidget ); |
layout3 = new QHBoxLayout( 0, 0, 6, "layout3"); |
spacer1 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
layout3->addItem( spacer1 ); |
85,11 → 157,11 |
cancelButton = new QPushButton( this, "cancelButton" ); |
layout2->addWidget( cancelButton ); |
layout3->addLayout( layout2 ); |
layout24->addLayout( layout3 ); |
layout14->addLayout( layout3 ); |
LoremDialogLayout->addLayout( layout24, 0, 0 ); |
LoremDialogLayout->addLayout( layout14, 0, 0 ); |
languageChange(); |
resize( QSize(647, 527).expandedTo(minimumSizeHint()) ); |
resize( QSize(689, 557).expandedTo(minimumSizeHint()) ); |
clearWState( WState_Polished ); |
// signals and slots connections |
112,14 → 184,24 |
void LoremDialog::languageChange() |
{ |
setCaption( tr( "Lorem Ipsum" ) ); |
textLabel8->setText( tr( "<p>Select dictionary:</p>" ) ); |
textLabel8->setText( tr( "<p>This is based on the Turkey (turkey.sf.net) dummy text generator, which means it generates dummy texts.</p>" ) ); |
textLabel4->setText( tr( "Dictionary:" ) ); |
dictionaryView->header()->setLabel( 0, tr( "Name" ) ); |
dictionaryView->header()->setLabel( 1, tr( "Type" ) ); |
dictionaryView->header()->setLabel( 2, tr( "Description" ) ); |
dictionaryView->header()->setLabel( 3, tr( "Url" ) ); |
dictionaryView->header()->setLabel( 1, tr( "Description" ) ); |
dictionaryView->header()->setLabel( 2, tr( "Url" ) ); |
textLabel5->setText( tr( "Paragraphs:" ) ); |
textLabel6->setText( tr( "AVG. Sentences:" ) ); |
shouldStartLorem->setText( tr( "Should Start with Lorem Ipsum" ) ); |
turkeyStartLorem->setText( tr( "Should Start with Lorem Ipsum" ) ); |
tabWidget->changeTab( turkeyTab, tr( "Turkey" ) ); |
textLabel7->setText( tr( "<p><b>This feature requires network connection!</b> Here you can access large Lorem Ipsum library at lorem-ipsum.info</p>" ) ); |
textLabel4_2->setText( tr( "Dictionary:" ) ); |
networkView->header()->setLabel( 0, tr( "Name" ) ); |
networkView->header()->setLabel( 1, tr( "Description" ) ); |
networkView->header()->setLabel( 2, tr( "Url" ) ); |
tabWidget->changeTab( networkTab, tr( "lorem-ipsum.info" ) ); |
textLabel3->setText( tr( "<p>This is wrapper around classical piece of the Lorem Ipsum distributed with Scribus</p>" ) ); |
textLabel1->setText( tr( "Paragraphs:" ) ); |
tabWidget->changeTab( standardTab, tr( "Standard" ) ); |
okButton->setText( tr( "&OK" ) ); |
okButton->setAccel( QKeySequence( tr( "Alt+O" ) ) ); |
cancelButton->setText( tr( "&Cancel" ) ); |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremdialog.h |
---|
1,7 → 1,7 |
/**************************************************************************** |
** Form interface generated from reading ui file 'loremdialog.ui' |
** |
** Created: Út lis 23 19:04:41 2004 |
** Created: So lis 20 19:34:29 2004 |
** by: The User Interface Compiler ($Id$) |
** |
** WARNING! All changes made in this file will be lost! |
17,6 → 17,8 |
class QHBoxLayout; |
class QGridLayout; |
class QSpacerItem; |
class QTabWidget; |
class QWidget; |
class QLabel; |
class QListView; |
class QListViewItem; |
32,13 → 34,24 |
LoremDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
~LoremDialog(); |
QTabWidget* tabWidget; |
QWidget* turkeyTab; |
QLabel* textLabel8; |
QLabel* textLabel4; |
QListView* dictionaryView; |
QLabel* textLabel5; |
QSpinBox* turkeyParagraphs; |
QLabel* textLabel6; |
QSpinBox* avgSentences; |
QCheckBox* shouldStartLorem; |
QCheckBox* turkeyStartLorem; |
QWidget* networkTab; |
QLabel* textLabel7; |
QLabel* textLabel4_2; |
QListView* networkView; |
QWidget* standardTab; |
QLabel* textLabel3; |
QLabel* textLabel1; |
QSpinBox* standardParaBox; |
QPushButton* okButton; |
QPushButton* cancelButton; |
48,9 → 61,21 |
protected: |
QGridLayout* LoremDialogLayout; |
QVBoxLayout* layout24; |
QVBoxLayout* layout14; |
QGridLayout* turkeyTabLayout; |
QVBoxLayout* layout22; |
QHBoxLayout* layout21; |
QVBoxLayout* layout20; |
QSpacerItem* spacer2; |
QHBoxLayout* layout7; |
QHBoxLayout* layout8; |
QGridLayout* networkTabLayout; |
QVBoxLayout* layout19; |
QHBoxLayout* layout18; |
QVBoxLayout* layout16; |
QSpacerItem* spacer3; |
QVBoxLayout* layout5; |
QHBoxLayout* layout1; |
QHBoxLayout* layout3; |
QSpacerItem* spacer1; |
QHBoxLayout* layout2; |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/Makefile.am |
---|
9,9 → 9,9 |
libloremipsum_la_LDFLAGS = -version-info 0:0:0 |
libloremipsum_la_METASOURCES = AUTO |
libloremipsum_la_SOURCES = loremconfig.cpp loremipsum.cpp loremnetwork.cpp loremturkey.cpp loremdialog.cpp loremstandard.cpp |
libloremipsum_la_SOURCES = loremconfig.cpp loremipsum.cpp loremnetwork.cpp loremturkey.cpp loremdialog.cpp loremstandard.cpp |
EXTRA_DIST = loremconfig.cpp loremconfig.h loremipsum.cpp loremipsum.h loremnetwork.cpp loremnetwork.h loremturkey.cpp loremturkey.h loremdialog.cpp loremdialog.h loremdialog.ui.h loremstandard.cpp loremstandard.h |
EXTRA_DIST = loremconfig.cpp loremconfig.h loremipsum.cpp loremipsum.h loremnetwork.cpp loremnetwork.h loremturkey.cpp loremturkey.h loremdialog.cpp loremdialog.h loremdialog.ui.h loremstandard.cpp loremstandard.h |
KDE_OPTIONS = qtonly |
AM_LDFLAGS = -s $(LIBFREETYPE_LIBS) |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremdialog.ui |
---|
10,8 → 10,8 |
<rect> |
<x>0</x> |
<y>0</y> |
<width>647</width> |
<height>527</height> |
<width>689</width> |
<height>557</height> |
</rect> |
</property> |
<property name="caption"> |
23,138 → 23,377 |
</property> |
<widget class="QLayoutWidget" row="0" column="0"> |
<property name="name"> |
<cstring>layout24</cstring> |
<cstring>layout14</cstring> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<widget class="QTabWidget"> |
<property name="name"> |
<cstring>textLabel8</cstring> |
<cstring>tabWidget</cstring> |
</property> |
<property name="text"> |
<string><p>Select dictionary:</p></string> |
</property> |
</widget> |
<widget class="QListView"> |
<column> |
<property name="text"> |
<string>Name</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Type</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Description</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Url</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<property name="name"> |
<cstring>dictionaryView</cstring> |
</property> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout7</cstring> |
</property> |
<hbox> |
<widget class="QWidget"> |
<property name="name"> |
<cstring>unnamed</cstring> |
<cstring>turkeyTab</cstring> |
</property> |
<widget class="QLabel"> |
<attribute name="title"> |
<string>Turkey</string> |
</attribute> |
<grid> |
<property name="name"> |
<cstring>textLabel5</cstring> |
<cstring>unnamed</cstring> |
</property> |
<property name="text"> |
<string>Paragraphs:</string> |
</property> |
</widget> |
<widget class="QSpinBox"> |
<widget class="QLayoutWidget" row="0" column="0"> |
<property name="name"> |
<cstring>layout22</cstring> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel8</cstring> |
</property> |
<property name="text"> |
<string><p>This is based on the Turkey (turkey.sf.net) dummy text generator, which means it generates dummy texts.</p></string> |
</property> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout21</cstring> |
</property> |
<hbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout20</cstring> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel4</cstring> |
</property> |
<property name="text"> |
<string>Dictionary:</string> |
</property> |
</widget> |
<spacer> |
<property name="name"> |
<cstring>spacer2</cstring> |
</property> |
<property name="orientation"> |
<enum>Vertical</enum> |
</property> |
<property name="sizeType"> |
<enum>Expanding</enum> |
</property> |
<property name="sizeHint"> |
<size> |
<width>20</width> |
<height>180</height> |
</size> |
</property> |
</spacer> |
</vbox> |
</widget> |
<widget class="QListView"> |
<column> |
<property name="text"> |
<string>Name</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Description</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Url</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<property name="name"> |
<cstring>dictionaryView</cstring> |
</property> |
</widget> |
</hbox> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout7</cstring> |
</property> |
<hbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel5</cstring> |
</property> |
<property name="text"> |
<string>Paragraphs:</string> |
</property> |
</widget> |
<widget class="QSpinBox"> |
<property name="name"> |
<cstring>turkeyParagraphs</cstring> |
</property> |
<property name="minValue"> |
<number>1</number> |
</property> |
<property name="value"> |
<number>4</number> |
</property> |
</widget> |
</hbox> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout8</cstring> |
</property> |
<hbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel6</cstring> |
</property> |
<property name="text"> |
<string>AVG. Sentences:</string> |
</property> |
</widget> |
<widget class="QSpinBox"> |
<property name="name"> |
<cstring>avgSentences</cstring> |
</property> |
<property name="minValue"> |
<number>1</number> |
</property> |
<property name="value"> |
<number>5</number> |
</property> |
</widget> |
</hbox> |
</widget> |
<widget class="QCheckBox"> |
<property name="name"> |
<cstring>turkeyStartLorem</cstring> |
</property> |
<property name="text"> |
<string>Should Start with Lorem Ipsum</string> |
</property> |
<property name="checked"> |
<bool>true</bool> |
</property> |
</widget> |
</vbox> |
</widget> |
</grid> |
</widget> |
<widget class="QWidget"> |
<property name="name"> |
<cstring>networkTab</cstring> |
</property> |
<attribute name="title"> |
<string>lorem-ipsum.info</string> |
</attribute> |
<grid> |
<property name="name"> |
<cstring>turkeyParagraphs</cstring> |
<cstring>unnamed</cstring> |
</property> |
<property name="minValue"> |
<number>1</number> |
</property> |
<property name="value"> |
<number>4</number> |
</property> |
</widget> |
</hbox> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout8</cstring> |
</property> |
<hbox> |
<widget class="QLayoutWidget" row="0" column="0"> |
<property name="name"> |
<cstring>layout19</cstring> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel7</cstring> |
</property> |
<property name="text"> |
<string><p><b>This feature requires network connection!</b> Here you can access large Lorem Ipsum library at lorem-ipsum.info</p></string> |
</property> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout18</cstring> |
</property> |
<hbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout16</cstring> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel4_2</cstring> |
</property> |
<property name="text"> |
<string>Dictionary:</string> |
</property> |
</widget> |
<spacer> |
<property name="name"> |
<cstring>spacer3</cstring> |
</property> |
<property name="orientation"> |
<enum>Vertical</enum> |
</property> |
<property name="sizeType"> |
<enum>Expanding</enum> |
</property> |
<property name="sizeHint"> |
<size> |
<width>20</width> |
<height>40</height> |
</size> |
</property> |
</spacer> |
</vbox> |
</widget> |
<widget class="QListView"> |
<column> |
<property name="text"> |
<string>Name</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Description</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Url</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<property name="name"> |
<cstring>networkView</cstring> |
</property> |
</widget> |
</hbox> |
</widget> |
</vbox> |
</widget> |
</grid> |
</widget> |
<widget class="QWidget"> |
<property name="name"> |
<cstring>unnamed</cstring> |
<cstring>standardTab</cstring> |
</property> |
<widget class="QLabel"> |
<attribute name="title"> |
<string>Standard</string> |
</attribute> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>textLabel6</cstring> |
<cstring>layout5</cstring> |
</property> |
<property name="text"> |
<string>AVG. Sentences:</string> |
<property name="geometry"> |
<rect> |
<x>10</x> |
<y>10</y> |
<width>250</width> |
<height>114</height> |
</rect> |
</property> |
<vbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel3</cstring> |
</property> |
<property name="text"> |
<string><p>This is wrapper around classical piece of the Lorem Ipsum distributed with Scribus</p></string> |
</property> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout1</cstring> |
</property> |
<hbox> |
<property name="name"> |
<cstring>unnamed</cstring> |
</property> |
<widget class="QLabel"> |
<property name="name"> |
<cstring>textLabel1</cstring> |
</property> |
<property name="text"> |
<string>Paragraphs:</string> |
</property> |
</widget> |
<widget class="QSpinBox"> |
<property name="name"> |
<cstring>standardParaBox</cstring> |
</property> |
<property name="minValue"> |
<number>1</number> |
</property> |
<property name="value"> |
<number>4</number> |
</property> |
</widget> |
</hbox> |
</widget> |
</vbox> |
</widget> |
<widget class="QSpinBox"> |
<property name="name"> |
<cstring>avgSentences</cstring> |
</property> |
<property name="minValue"> |
<number>1</number> |
</property> |
<property name="value"> |
<number>5</number> |
</property> |
</widget> |
</hbox> |
</widget> |
</widget> |
<widget class="QCheckBox"> |
<property name="name"> |
<cstring>shouldStartLorem</cstring> |
</property> |
<property name="text"> |
<string>Should Start with Lorem Ipsum</string> |
</property> |
<property name="checked"> |
<bool>true</bool> |
</property> |
</widget> |
<widget class="QLayoutWidget"> |
<property name="name"> |
<cstring>layout3</cstring> |
/trunk/Subik/scribus-lorem-ipsum/lorem-ipsum/loremipsum.cpp |
---|
44,43 → 44,40 |
// types of the lorems |
LoremDialog *dia = new LoremDialog(ScApp, 0, TRUE, 0); |
LoremConfig *config = new LoremConfig(); |
// setup gui. |
dia->turkeyParagraphs->setValue(config->paragraphs); |
dia->avgSentences->setValue(config->avgSentences); |
dia->shouldStartLorem->setChecked(config->shouldStartWith); |
// setup dicts. |
LoremInfo *info; |
for (info = config->info.first(); info; info = config->info.next()) |
{ |
QListViewItem *listItem = new QListViewItem(dia->dictionaryView, |
info->name, info->type, info->description, info->url); |
dia->dictionaryView->insertItem(listItem); |
QListViewItem *listItem = new QListViewItem(dia->dictionaryView, info->name, info->description, info->url); |
if (info->type == "turkey") |
dia->dictionaryView->insertItem(listItem); |
else |
dia->networkView->insertItem(listItem); |
} |
// start GUI |
// GUI |
if (dia->exec() == QDialog::Accepted) |
{ |
// handling options etc. |
QString loremText = ""; |
if (dia->dictionaryView->currentItem()->text(1) == "turkey") |
if (dia->tabWidget->currentPage() == dia->turkeyTab) |
{ |
LoremTurkey *lorem = new LoremTurkey(dia->dictionaryView->currentItem()->text(3), |
dia->turkeyParagraphs->value(), |
dia->avgSentences->value(), |
dia->shouldStartLorem->isChecked() |
); |
LoremTurkey *lorem = new LoremTurkey(dia->dictionaryView->currentItem()->text(2), |
dia->turkeyParagraphs->value(), |
dia->avgSentences->value(), |
dia->turkeyStartLorem->isChecked() |
); |
loremText = lorem->makeLorem(); |
delete lorem; |
} |
if (dia->dictionaryView->currentItem()->text(1) == "network") |
if (dia->tabWidget->currentPage() == dia->networkTab) |
{ |
LoremNetwork *lorem = new LoremNetwork(dia->dictionaryView->currentItem()->text(3)); |
qDebug(dia->networkView->currentItem()->text(2)); |
LoremNetwork *lorem = new LoremNetwork(dia->networkView->currentItem()->text(2)); |
loremText = lorem->makeLorem(); |
delete lorem; |
} |
if (dia->dictionaryView->currentItem()->text(1) == "static") |
if (dia->tabWidget->currentPage() == dia->standardTab) |
{ |
LoremStandard *lorem = new LoremStandard(dia->dictionaryView->currentItem()->text(3), |
dia->turkeyParagraphs->value()); |
LoremStandard *lorem = new LoremStandard(dia->standardParaBox->value()); |
loremText = lorem->makeLorem(); |
delete lorem; |
} |
112,13 → 109,6 |
item->Ptext.append(hg); |
} // for |
} |
// save prefs from gui |
config->paragraphs = dia->turkeyParagraphs->value(); |
config->avgSentences = dia->avgSentences->value(); |
config->shouldStartWith = dia->shouldStartLorem->isChecked(); |
/* config->prefs->set("paragraphs", dia->turkeyParagraphs->value()); |
config->prefs->set("avgSentences", dia->avgSentences->value()); |
config->prefs->set("shouldStartWith", dia->shouldStartLorem->isChecked());*/ |
//ScApp->FMess->setText(resultComment); |
ScApp->FMess->setText("DONE"); |
delete config; |