Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tabexternaltoolswidget.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 /***************************************************************************
00008 *   Copyright (C) 2005 by Craig Bradney                                   *
00009 *   cbradney@zip.com.au                                                   *
00010 *                                                                         *
00011 *   This program is free software; you can redistribute it and/or modify  *
00012 *   it under the terms of the GNU General Public License as published by  *
00013 *   the Free Software Foundation; either version 2 of the License, or     *
00014 *   (at your option) any later version.                                   *
00015 *                                                                         *
00016 *   This program is distributed in the hope that it will be useful,       *
00017 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019 *   GNU General Public License for more details.                          *
00020 *                                                                         *
00021 *   You should have received a copy of the GNU General Public License     *
00022 *   along with this program; if not, write to the                         *
00023 *   Free Software Foundation, Inc.,                                       *
00024 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025 ***************************************************************************/
00026 
00027 #include "tabexternaltoolswidget.h"
00028 #include "tabexternaltoolswidget.moc"
00029 #include "gsutil.h"
00030 #include "scpaths.h"
00031 
00032 TabExternalToolsWidget::TabExternalToolsWidget(struct ApplicationPrefs *prefsData, QWidget* parent, const char*name)
00033 : TabExternalToolsWidgetBase(parent, name)
00034 {
00035        // switched off as it's called in main prefs classes - PV
00036        //restoreDefaults(prefsData);
00037        
00038        connect(psToolChangeButton, SIGNAL(clicked()), this, SLOT(changePostScriptTool()));
00039        connect(imageToolChangeButton, SIGNAL(clicked()), this, SLOT(changeImageTool()));
00040        connect(extBrowserToolChangeButton, SIGNAL(clicked()), this, SLOT(changeExtBrowserTool()));
00041        connect(rescanButton, SIGNAL(clicked()), this, SLOT(rescanForTools()));
00042 }
00043 
00044 TabExternalToolsWidget::~TabExternalToolsWidget()
00045 {
00046 }
00047 
00048 const QString TabExternalToolsWidget::newPSTool() const 
00049 { 
00050        return ScPaths::separatorsToSlashes(psToolLineEdit->text()); 
00051 }
00052 
00053 const QString TabExternalToolsWidget::newImageTool() const 
00054 { 
00055        return ScPaths::separatorsToSlashes(imageToolLineEdit->text());
00056 }
00057 
00058 const QString TabExternalToolsWidget::newExtBrowserTool() const 
00059 { 
00060        return ScPaths::separatorsToSlashes(extBrowserToolLineEdit->text()); 
00061 }
00062 
00063 void TabExternalToolsWidget::restoreDefaults(struct ApplicationPrefs *prefsData)
00064 {
00065        psToolLineEdit->setText(QDir::convertSeparators(prefsData->gs_exe));
00066        psAntialiasTextCheckBox->setChecked(prefsData->gs_AntiAliasText);
00067        psAntialiasGraphicsCheckBox->setChecked(prefsData->gs_AntiAliasGraphics);
00068        psResolutionSpinBox->setValue(prefsData->gs_Resolution);
00069        imageToolLineEdit->setText(QDir::convertSeparators(prefsData->imageEditorExecutable));
00070        extBrowserToolLineEdit->setText(QDir::convertSeparators(prefsData->extBrowserExecutable));
00071 }
00072 
00073 void TabExternalToolsWidget::changePostScriptTool()
00074 {
00075        QFileInfo fi(psToolLineEdit->text());
00076        QString s = QFileDialog::getOpenFileName(fi.dirPath(), QString::null, this, "changeGhostscript", tr("Locate Ghostscript"));
00077        if (!s.isEmpty())
00078               psToolLineEdit->setText( QDir::convertSeparators(s) );
00079 }
00080 
00081 void TabExternalToolsWidget::changeImageTool()
00082 {
00083        QFileInfo fi(imageToolLineEdit->text());
00084        QString s = QFileDialog::getOpenFileName(fi.dirPath(), QString::null, this, "changeImageEditor", tr("Locate your image editor"));
00085        if (!s.isEmpty())
00086               imageToolLineEdit->setText( QDir::convertSeparators(s) );
00087 }
00088 
00089 void TabExternalToolsWidget::changeExtBrowserTool()
00090 {
00091        QFileInfo fi(extBrowserToolLineEdit->text());
00092        QString s = QFileDialog::getOpenFileName(fi.dirPath(), QString::null, this, "changeextBrowser", tr("Locate your web browser"));
00093        if (!s.isEmpty())
00094               extBrowserToolLineEdit->setText( QDir::convertSeparators(s) );
00095 }
00096 
00097 void TabExternalToolsWidget::rescanForTools()
00098 {
00099        QFileInfo fi(psToolLineEdit->text());
00100        if (!fi.exists())
00101        {
00102               QString gsDef = getGSDefaultExeName();
00103               psToolLineEdit->setText( QDir::convertSeparators(gsDef) );
00104        }
00105        QFileInfo fi2(imageToolLineEdit->text());
00106        if (!fi2.exists())
00107               imageToolLineEdit->setText("gimp");
00108 }