Back to index

scribus-ng  1.3.4.dfsg+svn20071115
hysettings.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "hysettings.h"
00008 #include "hysettings.moc"
00009 #include "sccombobox.h"
00010 #include "scribusdoc.h"
00011 
00012 HySettings::HySettings( QWidget* parent, QMap<QString,QString>* langs ) : QWidget( parent, "Settings" )
00013 {
00014        langsMap = *langs;
00015 
00016        layout3 = new QGridLayout( this, 1, 1, 0, 5, "Layout3");
00017        layout3->setAlignment( Qt::AlignTop );
00018        verbose = new QCheckBox( tr("&Hyphenation Suggestions"), this, "Verbose");
00019        layout3->addMultiCellWidget(verbose, 0, 0, 0, 1);
00020        
00021        input = new QCheckBox( tr("Hyphenate Text Automatically &During Typing"), this, "inp");
00022        layout3->addMultiCellWidget(input, 1, 1, 0, 1);
00023        
00024               // languages
00025 //     langMgr.init();
00026 //     QStringList languageList;
00027 //     langMgr.fillInstalledStringList(&languageList, true);
00028 //     languageList.sort();
00029 //     guiLangCombo->insertStringList( languageList );
00030        
00031        language = new ScComboBox( false, this, "Language" );
00032        QMap<QString,QString>::Iterator it;
00033        QStringList lada;
00034        for (it = langs->begin(); it != langs->end(); ++it)
00035               lada.append(it.data());
00036        lada.sort();
00037        language->insertStringList(lada);
00038        text1 = new QLabel( language, tr( "&Language:" ), this, "Text1" );
00039        layout3->addWidget( text1, 2, 0 );
00040        layout3->addWidget( language, 2, 1, Qt::AlignLeft );
00041        
00042        wordLen = new QSpinBox( this, "WordLen" );
00043        wordLen->setMinValue( 3 );
00044        text2 = new QLabel( wordLen, tr( "&Smallest Word:" ), this, "Text2" );
00045        layout3->addWidget( text2, 3, 0 );
00046        layout3->addWidget( wordLen, 3, 1, Qt::AlignLeft );
00047        
00048        maxCount = new QSpinBox( this, "MaxCount" );
00049        maxCount->setMinValue( 0 );
00050        text3 = new QLabel(maxCount, tr("Consecutive Hyphenations &Allowed:"), this, "Text3");
00051        layout3->addWidget( text3, 4, 0 );
00052        layout3->addWidget( maxCount, 4, 1, Qt::AlignLeft);
00053        
00054        QToolTip::add( verbose, tr( "A dialog box showing all possible hyphens for each word will show up when you use the Extras, Hyphenate Text option." ) );
00055        QToolTip::add( input, tr("Enables automatic hyphenation of your text while typing."));
00056        QToolTip::add( wordLen, tr( "Length of the smallest word to be hyphenated." ) );
00057        QToolTip::add( maxCount, tr( "Maximum number of Hyphenations following each other.\nA value of 0 means unlimited hyphenations." ) );
00058 }
00059 
00060 void HySettings::restoreDefaults(struct ApplicationPrefs *prefsData)
00061 {
00062        verbose->setChecked(!prefsData->Automatic);
00063        input->setChecked(prefsData->AutoCheck);
00064        language->setCurrentText(langsMap[prefsData->Language]);
00065        wordLen->setValue(prefsData->MinWordLen);
00066        maxCount->setValue(prefsData->HyCount);
00067        
00068 }
00069 
00070 void HySettings::restoreDefaults(ScribusDoc *prefsData)
00071 {
00072        verbose->setChecked(!prefsData->Automatic);
00073        input->setChecked(prefsData->AutoCheck);
00074        language->setCurrentText(langsMap[prefsData->Language]);
00075        wordLen->setValue(prefsData->MinWordLen);
00076        maxCount->setValue(prefsData->HyCount);
00077 }