void ScriptConsole::createDialogContent() { ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); highlighter = new StelScriptSyntaxHighlighter(ui->scriptEdit->document()); ui->includeEdit->setText(StelFileMgr::getInstallationDir() + "/scripts"); ui->quickrunCombo->addItem(q_("quickrun...")); ui->quickrunCombo->addItem(q_("selected text")); ui->quickrunCombo->addItem(q_("clear text")); ui->quickrunCombo->addItem(q_("clear images")); ui->quickrunCombo->addItem(q_("natural")); ui->quickrunCombo->addItem(q_("starchart")); connect(ui->scriptEdit, SIGNAL(cursorPositionChanged()), this, SLOT(rowColumnChanged())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadScript())); connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveScript())); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearButtonPressed())); connect(ui->preprocessSSCButton, SIGNAL(clicked()), this, SLOT(preprocessScript())); connect(ui->runButton, SIGNAL(clicked()), this, SLOT(runScript())); connect(ui->stopButton, SIGNAL(clicked()), &StelApp::getInstance().getScriptMgr(), SLOT(stopScript())); connect(ui->includeBrowseButton, SIGNAL(clicked()), this, SLOT(includeBrowse())); connect(ui->quickrunCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(quickRun(int))); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptRunning()), this, SLOT(scriptStarted())); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptStopped()), this, SLOT(scriptEnded())); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptDebug(const QString&)), this, SLOT(appendLogLine(const QString&))); connect(&StelApp::getInstance().getScriptMgr(), SIGNAL(scriptOutput(const QString&)), this, SLOT(appendOutputLine(const QString&))); ui->tabs->setCurrentIndex(0); ui->scriptEdit->setFocus(); }
QSearchLineEdit::QSearchLineEdit(QWidget* parent, const QString &clearIconFileName, const QString &optionsIconFileName, const QString &cancelIconFileName) : QLineEdit(parent) { maybeFound = true; cancelPointer = 0; cancelButtonIcon = cancelIconFileName; searchStarted = false; sPbar = 0; stopButton = 0; QSize msz = minimumSizeHint(); QPixmap optionsPixmap(optionsIconFileName.isEmpty() ? ":/images/search.png" : optionsIconFileName); optionsPixmap = optionsPixmap.scaledToHeight(fontMetrics().height() , Qt::SmoothTransformation); optionButton = new QToolButton(this); optionButton->setIcon(QIcon(optionsPixmap)); optionButton->setIconSize(optionsPixmap.size()); optionButton->setCursor(Qt::ArrowCursor); optionButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); clearButton = new QToolButton(this); QString defaultClearIcon = ":/images/clear-left.png"; if (layoutDirection() == Qt::RightToLeft) { defaultClearIcon = ":/images/clear-right.png"; } QPixmap clearPixmap(clearIconFileName.isEmpty() ? defaultClearIcon : clearIconFileName); clearPixmap = clearPixmap.scaledToHeight(fontMetrics().height() /*msz.height()*/, Qt::SmoothTransformation); clearButton->setIcon(QIcon(clearPixmap)); clearButton->setIconSize(clearPixmap.size()); clearButton->setCursor(Qt::ArrowCursor); clearButton->hide(); connect(clearButton, SIGNAL(clicked()), this, SIGNAL(clearButtonPressed())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(clearButton, SIGNAL(clicked()), this, SLOT(resetNotFound())); connect(this, SIGNAL(textChanged(QString)), this, SLOT(updateCloseButton(QString))); setMinimumSize(qMax(msz.width(), optionButton->sizeHint().width() + clearButton->sizeHint().width()), qMax(qMax(msz.height(), optionButton->sizeHint().height()), clearButton->sizeHint().height())); setStyleSheet(QString("QLineEdit { padding-left: %1px; padding-right: %2px; } ").arg(clearButton->sizeHint().width()).arg(optionButton->sizeHint().width())); clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); }