Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tabgeneral.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 <qcombobox.h>
00008 #include <qstringlist.h>
00009 #include <qpushbutton.h>
00010 #include <qgroupbox.h>
00011 #include <qcheckbox.h>
00012 #include <qspinbox.h>
00013 #include <qlineedit.h>
00014 #include <qstylefactory.h>
00015 #include <qtooltip.h>
00016 #include <qfiledialog.h>
00017 
00018 #include "tabgeneral.h"
00019 #include "tabgeneral.moc"
00020 
00021 #include "prefsmanager.h"
00022 #include "scribusapp.h"
00023 #include "scribuscore.h"
00024 
00025 extern ScribusQApp* ScQApp;
00026 
00027 
00028 TabGeneral::TabGeneral(QWidget* parent, const char* name)
00029        : TabGeneralBase(parent, name, 0)
00030 {
00031        // languages
00032        langMgr.init();
00033        QStringList languageList;
00034        langMgr.fillInstalledStringList(&languageList, true);
00035        languageList.sort();
00036        guiLangCombo->insertStringList( languageList );
00037 
00038        // qt styles
00039        QStringList STtest;
00040        STtest = QStyleFactory::keys();
00041        for (uint stt = 0; stt < STtest.count(); ++stt)
00042               GUICombo->insertItem(STtest[stt]);
00043        //GUICombo->setEditable(false);
00044 
00045        if (ScCore->primaryMainWindow()->HaveDoc)
00046        {
00047               ProPfad->setEnabled(false);
00048               FileC2->setEnabled(false);
00049        }
00050 
00051        QWidget::setTabOrder( GFsize, GTFsize );
00052        QWidget::setTabOrder( GTFsize, wheelJumpSpin );
00053        QWidget::setTabOrder( wheelJumpSpin, recentDocs );
00054        QWidget::setTabOrder( recentDocs, Docs );
00055        QWidget::setTabOrder( Docs, FileC );
00056        QWidget::setTabOrder( FileC, ProPfad );
00057        QWidget::setTabOrder( ProPfad, FileC2  );
00058        QWidget::setTabOrder( FileC2, ScriptPfad );
00059        QWidget::setTabOrder( ScriptPfad, FileC3 );
00060        QWidget::setTabOrder( FileC3, DocumentTemplateDir );
00061        QWidget::setTabOrder( DocumentTemplateDir, FileC4 );
00062 
00063        QToolTip::add(guiLangCombo, "<qt>" + tr( "Select your default language for Scribus to run with. Leave this blank to choose based on environment variables. You can still override this by passing a command line option when starting Scribus" )+"</qt>");
00064        QToolTip::add(recentDocs, "<qt>" + tr("Number of recently edited documents to show in the File menu") + "</qt>" );
00065        QToolTip::add( wheelJumpSpin, "<qt>" + tr( "Number of lines Scribus will scroll for each move of the mouse wheel" ) + "</qt>");
00066        QToolTip::add( GUICombo, "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>" );
00067        QToolTip::add( GFsize, "<qt>" + tr( "Default font size for the menus and windows" ) + "</qt>" );
00068        QToolTip::add( GTFsize, "<qt>" + tr("Default font size for the tool windows") + "</qt>" );
00069        QToolTip::add( Docs, "<qt>" + tr( "Default documents directory" ) + "</qt>" );
00070        QToolTip::add( ProPfad, "<qt>" + tr( "Default ICC profiles directory. This cannot be changed with a document open. By default, Scribus will look in the System Directories under Mac OSX and Windows. On Linux and Unix, Scribus will search $home/.color/icc,/usr/share/color/icc and /usr/local/share/color/icc " ) + "</qt>" );
00071        QToolTip::add( ScriptPfad, "<qt>" + tr( "Default Scripter scripts directory" ) + "</qt>" );
00072        QToolTip::add( DocumentTemplateDir, "<qt>"+ tr("Additional directory for document templates")+"</qt>" );
00073 
00074        connect(guiLangCombo, SIGNAL(activated(const QString &)), this, SLOT(setSelectedGUILang(const QString &)));
00075        connect(FileC, SIGNAL(clicked()), this, SLOT(changeDocs()));
00076        connect(FileC2, SIGNAL(clicked()), this, SLOT(changeProfs()));
00077        connect(FileC3, SIGNAL(clicked()), this, SLOT(changeScripts()));
00078        connect(FileC4, SIGNAL(clicked()), this, SLOT(changeDocumentTemplates()));
00079 }
00080 
00081 void TabGeneral::restoreDefaults(struct ApplicationPrefs *prefsData)
00082 {
00083        selectedGUILang = prefsData->guiLanguage;
00084        guiLangCombo->setCurrentText(langMgr.getLangFromAbbrev(selectedGUILang));
00085        GUICombo->setCurrentText(prefsData->GUI);
00086        GFsize->setValue( prefsData->AppFontSize );
00087        GTFsize->setValue( prefsData->PaletteFontSize); // temp solution
00088        wheelJumpSpin->setValue( prefsData->Wheelval );
00089        spinTimeout->setValue(prefsData->moveTimeout);
00090        recentDocs->setValue( prefsData->RecentDCount );
00091        Docs->setText(QDir::convertSeparators(prefsData->DocDir));
00092        ProPfad->setText(QDir::convertSeparators(prefsData->ProfileDir));
00093        ScriptPfad->setText(QDir::convertSeparators(prefsData->ScriptDir));
00094        DocumentTemplateDir->setText(QDir::convertSeparators(prefsData->documentTemplatesDir));
00095        startUpDialog->setChecked(prefsData->showStartupDialog);
00096        showSplashCheckBox->setChecked( !ScQApp->neverSplashExists() );
00097 }
00098 
00099 void TabGeneral::setSelectedGUILang( const QString &newLang )
00100 {
00101        selectedGUILang = langMgr.getAbbrevFromLang(newLang);
00102 }
00103 
00104 void TabGeneral::changeDocs()
00105 {
00106        QString s = QFileDialog::getExistingDirectory(Docs->text(), this, "d", tr("Choose a Directory"), true);
00107        if (!s.isEmpty())
00108               Docs->setText( QDir::convertSeparators(s) );
00109 }
00110 
00111 void TabGeneral::changeProfs()
00112 {
00113        QString s = QFileDialog::getExistingDirectory(ProPfad->text(), this, "d", tr("Choose a Directory"), true);
00114        if (!s.isEmpty())
00115               ProPfad->setText( QDir::convertSeparators(s) );
00116 }
00117 
00118 void TabGeneral::changeScripts()
00119 {
00120        QString s = QFileDialog::getExistingDirectory(ScriptPfad->text(), this, "d", tr("Choose a Directory"), true);
00121        if (!s.isEmpty())
00122               ScriptPfad->setText( QDir::convertSeparators(s) );
00123 }
00124 
00125 void TabGeneral::changeDocumentTemplates()
00126 {
00127        QString s = QFileDialog::getExistingDirectory(DocumentTemplateDir->text(), this, "d", tr("Choose a Directory"), true);
00128        if (!s.isEmpty())
00129               DocumentTemplateDir->setText( QDir::convertSeparators(s) );
00130 }