Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes
ScripterPrefsGui Class Reference

Subclass of PrefsPanel that's supplied to the prefs dialog for use when showing plugin preferences. More...

#include <scripterprefsgui.h>

List of all members.

Public Slots

void apply ()

Public Member Functions

 ScripterPrefsGui (QWidget *parent)
 ~ScripterPrefsGui ()

Protected Slots

virtual void languageChange ()
virtual void setColor ()
 All requests for color change are handled here.
virtual void changeStartupScript ()

Protected Member Functions

void setupSyntaxColors ()

Protected Attributes

QTabWidget * tabWidget
QWidget * startupTab
QWidget * consoleTab
QCheckBox * extensionScriptsChk
QLabel * startupScriptEditLabel
QLineEdit * startupScriptEdit
QGridLayout * ScripterPrefsGuiBaseLayout
QVBoxLayout * extLayout
QSpacerItem * extScriptSpacer
QHBoxLayout * startupScriptLayout
QLabel * errorLabel
QLabel * commentLabel
QLabel * keywordLabel
QLabel * signLabel
QLabel * numberLabel
QLabel * stringLabel
QLabel * textLabel
QPushButton * errorButton
QPushButton * commentButton
QPushButton * keywordButton
QPushButton * signButton
QPushButton * numberButton
QPushButton * stringButton
QPushButton * textButton
QToolButton * startupScriptChangeButton
QGridLayout * colorLayout

Detailed Description

Subclass of PrefsPanel that's supplied to the prefs dialog for use when showing plugin preferences.

Definition at line 30 of file scripterprefsgui.h.

Constructor & Destructor Documentation

ScripterPrefsGui::ScripterPrefsGui ( QWidget *  parent)

Definition at line 26 of file scripterprefsgui.cpp.

       : PrefsPanel(parent, "ScripterPrefsGui")
       ScripterPrefsGuiBaseLayout = new QGridLayout(this, 1, 1, 10, 5, "ScripterPrefsGuiBaseLayout");

       tabWidget = new QTabWidget(this, "tabWidget");
       //tabWidget->setGeometry(QRect(70, 50, 380, 230));

       startupTab = new QWidget(tabWidget, "startupTab");
       tabWidget->insertTab(startupTab, tr("Extensions"));
       consoleTab = new QWidget(tabWidget, "consoleTab");
       tabWidget->insertTab(consoleTab, tr("Console"));

       extLayout = new QVBoxLayout(startupTab, 10, 5, "extLayout");
       extensionScriptsChk = new QCheckBox(startupTab, "extensionScriptsChk");

       startupScriptLayout = new QHBoxLayout(0, 10, 5, "startupScriptLayout");

       startupScriptEditLabel = new QLabel(startupTab, "startupScriptEditLabel");
       startupScriptEdit = new QLineEdit(startupTab, "startupScriptEdit");
       startupScriptChangeButton = new QToolButton( startupTab, "startupScriptChangeButton" );
       startupScriptChangeButton->setMinimumSize( QSize( 88, 24 ) );
       startupScriptChangeButton->setText( tr( "Change..." ) );
       extScriptSpacer = new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);

       // colors
       colorLayout = new QGridLayout(consoleTab, 1, 1, 10, 5);

       errorLabel = new QLabel(consoleTab);
       commentLabel = new QLabel(consoleTab);
       keywordLabel = new QLabel(consoleTab);
       signLabel = new QLabel(consoleTab);
       numberLabel = new QLabel(consoleTab);
       stringLabel = new QLabel(consoleTab);
       textLabel = new QLabel(consoleTab);
       errorButton = new QPushButton(consoleTab);
       commentButton = new QPushButton(consoleTab);
       keywordButton = new QPushButton(consoleTab);
       signButton = new QPushButton(consoleTab);
       numberButton = new QPushButton(consoleTab);
       stringButton = new QPushButton(consoleTab);
       textButton = new QPushButton(consoleTab);

       colorLayout->addWidget(textLabel, 0, 0);
       colorLayout->addWidget(textButton, 0, 1);
       colorLayout->addWidget(commentLabel, 1, 0);
       colorLayout->addWidget(commentButton, 1, 1);
       colorLayout->addWidget(keywordLabel, 2, 0);
       colorLayout->addWidget(keywordButton, 2, 1);
       colorLayout->addWidget(signLabel, 3, 0);
       colorLayout->addWidget(signButton, 3, 1);
       colorLayout->addWidget(errorLabel, 4, 0);
       colorLayout->addWidget(errorButton, 4, 1);
       colorLayout->addWidget(stringLabel, 5, 0);
       colorLayout->addWidget(stringButton, 5, 1);
       colorLayout->addWidget(numberLabel, 6, 0);
       colorLayout->addWidget(numberButton, 6, 1);

       ScripterPrefsGuiBaseLayout->addWidget(tabWidget, 0, 0);

       // Set the state of the ext script enable checkbox
       // The startup script box should be disabled  if ext scripts are off
       connect(extensionScriptsChk, SIGNAL(toggled(bool)),
                     startupScriptEdit, SLOT(setEnabled(bool)));

       // signals and slots connections
       connect(extensionScriptsChk, SIGNAL(toggled(bool)), startupScriptEdit, SLOT(setEnabled(bool)));
       // colors
       connect(textButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(commentButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(keywordButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(errorButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(signButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(stringButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(numberButton, SIGNAL(clicked()), this, SLOT(setColor()));
       connect(startupScriptChangeButton, SIGNAL(clicked()), this, SLOT(changeStartupScript()));

Here is the call graph for this function:

Definition at line 121 of file scripterprefsgui.cpp.

       // no need to delete child widgets, Qt does it all for us

Member Function Documentation

void ScripterPrefsGui::apply ( ) [slot]

Definition at line 145 of file scripterprefsgui.cpp.

       // colors
       SyntaxColors *syntax = new SyntaxColors();
       syntax->textColor = textButton->paletteBackgroundColor();
       syntax->commentColor = commentButton->paletteBackgroundColor();
       syntax->keywordColor = keywordButton->paletteBackgroundColor();
       syntax->errorColor = errorButton->paletteBackgroundColor();
       syntax->signColor = signButton->paletteBackgroundColor();
       syntax->stringColor = stringButton->paletteBackgroundColor();
       syntax->numberColor = numberButton->paletteBackgroundColor();

Here is the call graph for this function:

void ScripterPrefsGui::changeStartupScript ( ) [protected, virtual, slot]

Definition at line 182 of file scripterprefsgui.cpp.

       QString currentScript=startupScriptEdit->text();
       QFileInfo fi(startupScriptEdit->text());
       if (!fi.exists())
              currentScript = QDir::homeDirPath();

       QString s = QFileDialog::getOpenFileName(currentScript, "Python Scripts (*.py *.PY)", this, "d", tr("Locate Startup Script"));
       if (!s.isEmpty())

Here is the call graph for this function:

Here is the caller graph for this function:

void ScripterPrefsGui::languageChange ( ) [protected, virtual, slot]

Definition at line 130 of file scripterprefsgui.cpp.

       setCaption( tr("Scripter Preferences"));
       extensionScriptsChk->setText( tr("Enable Extension Scripts"));
       startupScriptEditLabel->setText( tr("Startup Script:"));
       errorLabel->setText( tr("Errors:", "syntax highlighting"));
       commentLabel->setText( tr("Comments:", "syntax highlighting"));
       keywordLabel->setText( tr("Keywords:", "syntax highlighting"));
       signLabel->setText( tr("Signs:", "syntax highlighting"));
       numberLabel->setText( tr("Numbers:", "syntax highlighting"));
       stringLabel->setText( tr("Strings:", "syntax highlighting"));
       textLabel->setText( tr("Base Texts:", "syntax highlighting"));

Here is the call graph for this function:

Here is the caller graph for this function:

void ScripterPrefsGui::setColor ( ) [protected, virtual, slot]

All requests for color change are handled here.

Petr Vanek
I'm trying to handle multiple signals via single slot here. sender() Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise the return value is undefined. This function will return something apparently correct in other cases as well. However, its value may change during any function call, depending on what signal-slot connections are activated during that call. In Qt 3.0 the value will change more often than in 2.x. This function violates the object-oriented principle of modularity. However, getting access to the sender might be useful when many signals are connected to a single slot. The sender is undefined if the slot is called as a normal C++ function.

Definition at line 161 of file scripterprefsgui.cpp.

       QPushButton* button = (QPushButton*)sender();
       QColor color = QColorDialog::getColor(button->paletteBackgroundColor(), this, tr("Select Color"));
       if (color.isValid())

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 169 of file scripterprefsgui.cpp.

       SyntaxColors *syntax = new SyntaxColors();

Here is the caller graph for this function:

Member Data Documentation

QGridLayout* ScripterPrefsGui::colorLayout [protected]

Definition at line 70 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::commentButton [protected]

Definition at line 63 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::commentLabel [protected]

Definition at line 56 of file scripterprefsgui.h.

QWidget* ScripterPrefsGui::consoleTab [protected]

Definition at line 44 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::errorButton [protected]

Definition at line 62 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::errorLabel [protected]

Definition at line 55 of file scripterprefsgui.h.

QCheckBox* ScripterPrefsGui::extensionScriptsChk [protected]

Definition at line 45 of file scripterprefsgui.h.

QVBoxLayout* ScripterPrefsGui::extLayout [protected]

Definition at line 50 of file scripterprefsgui.h.

QSpacerItem* ScripterPrefsGui::extScriptSpacer [protected]

Definition at line 51 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::keywordButton [protected]

Definition at line 64 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::keywordLabel [protected]

Definition at line 57 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::numberButton [protected]

Definition at line 66 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::numberLabel [protected]

Definition at line 59 of file scripterprefsgui.h.

Definition at line 49 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::signButton [protected]

Definition at line 65 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::signLabel [protected]

Definition at line 58 of file scripterprefsgui.h.

Definition at line 69 of file scripterprefsgui.h.

QLineEdit* ScripterPrefsGui::startupScriptEdit [protected]

Definition at line 47 of file scripterprefsgui.h.

Definition at line 46 of file scripterprefsgui.h.

QHBoxLayout* ScripterPrefsGui::startupScriptLayout [protected]

Definition at line 52 of file scripterprefsgui.h.

QWidget* ScripterPrefsGui::startupTab [protected]

Definition at line 43 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::stringButton [protected]

Definition at line 67 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::stringLabel [protected]

Definition at line 60 of file scripterprefsgui.h.

QTabWidget* ScripterPrefsGui::tabWidget [protected]

Definition at line 42 of file scripterprefsgui.h.

QPushButton* ScripterPrefsGui::textButton [protected]

Definition at line 68 of file scripterprefsgui.h.

QLabel* ScripterPrefsGui::textLabel [protected]

Definition at line 61 of file scripterprefsgui.h.

The documentation for this class was generated from the following files: