diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-06-01 15:52:21 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-01 16:06:58 +0200 |
commit | 48fca54118b65d6399ece5f258426144bdc2b03b (patch) | |
tree | ef6ea77e48e8fd24c75a8b4905c383ff027cbb8d /src/scripttools | |
parent | 0a4e802f182e6e4b3c54cafa141c8d07ec7621f6 (diff) | |
download | qtscript-48fca54118b65d6399ece5f258426144bdc2b03b.tar.gz |
Fix scripttools compilation when some features are disabled
Task-number: QTBUG-20378
Change-Id: Ia1dc574824cb1d58c237d60675d1b8a5f8f44c43
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/scripttools')
-rw-r--r-- | src/scripttools/debugging/qscriptdebugger.cpp | 24 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp | 2 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptedit.cpp | 10 | ||||
-rw-r--r-- | src/scripttools/debugging/qscriptenginedebugger.cpp | 8 |
4 files changed, 44 insertions, 0 deletions
diff --git a/src/scripttools/debugging/qscriptdebugger.cpp b/src/scripttools/debugging/qscriptdebugger.cpp index 89e8da0..760bbc1 100644 --- a/src/scripttools/debugging/qscriptdebugger.cpp +++ b/src/scripttools/debugging/qscriptdebugger.cpp @@ -881,6 +881,7 @@ void QScriptDebuggerPrivate::_q_goToLine() QScriptDebuggerCodeViewInterface *view = codeWidget->currentView(); if (!view) return; +#ifndef QT_NO_INPUTDIALOG bool ok = false; int lineNumber = QInputDialog::getInt(0, QScriptDebugger::tr("Go to Line"), QScriptDebugger::tr("Line:"), @@ -888,6 +889,7 @@ void QScriptDebuggerPrivate::_q_goToLine() 1, INT_MAX, 1, &ok); if (ok) view->gotoLine(lineNumber); +#endif } class QScriptDebuggerShowLineJob : public QScriptDebuggerCommandSchedulerJob @@ -1676,7 +1678,9 @@ QAction *QScriptDebugger::interruptAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->interruptAction = new QAction(interruptIcon, QScriptDebugger::tr("Interrupt"), parent); d->interruptAction->setEnabled(!d->interactive); +#ifndef QT_NO_SHORTCUT d->interruptAction->setShortcut(QScriptDebugger::tr("Shift+F5")); +#endif QObject::connect(d->interruptAction, SIGNAL(triggered()), that, SLOT(_q_interrupt())); } @@ -1693,7 +1697,9 @@ QAction *QScriptDebugger::continueAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->continueAction = new QAction(continueIcon, QScriptDebugger::tr("Continue"), parent); d->continueAction->setEnabled(d->interactive); +#ifndef QT_NO_SHORTCUT d->continueAction->setShortcut(QScriptDebugger::tr("F5")); +#endif QObject::connect(d->continueAction, SIGNAL(triggered()), that, SLOT(_q_continue())); } @@ -1710,7 +1716,9 @@ QAction *QScriptDebugger::stepIntoAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->stepIntoAction = new QAction(stepIntoIcon, QScriptDebugger::tr("Step Into"), parent); d->stepIntoAction->setEnabled(d->interactive); +#ifndef QT_NO_SHORTCUT d->stepIntoAction->setShortcut(QScriptDebugger::tr("F11")); +#endif QObject::connect(d->stepIntoAction, SIGNAL(triggered()), that, SLOT(_q_stepInto())); } @@ -1727,7 +1735,9 @@ QAction *QScriptDebugger::stepOverAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->stepOverAction = new QAction(stepOverIcon, QScriptDebugger::tr("Step Over"), parent); d->stepOverAction->setEnabled(d->interactive); +#ifndef QT_NO_SHORTCUT d->stepOverAction->setShortcut(QScriptDebugger::tr("F10")); +#endif QObject::connect(d->stepOverAction, SIGNAL(triggered()), that, SLOT(_q_stepOver())); } @@ -1744,7 +1754,9 @@ QAction *QScriptDebugger::stepOutAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->stepOutAction = new QAction(stepOutIcon, QScriptDebugger::tr("Step Out"), parent); d->stepOutAction->setEnabled(d->interactive); +#ifndef QT_NO_SHORTCUT d->stepOutAction->setShortcut(QScriptDebugger::tr("Shift+F11")); +#endif QObject::connect(d->stepOutAction, SIGNAL(triggered()), that, SLOT(_q_stepOut())); } @@ -1761,7 +1773,9 @@ QAction *QScriptDebugger::runToCursorAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->runToCursorAction = new QAction(runToCursorIcon, QScriptDebugger::tr("Run to Cursor"), parent); d->runToCursorAction->setEnabled(d->interactive); +#ifndef QT_NO_SHORTCUT d->runToCursorAction->setShortcut(QScriptDebugger::tr("Ctrl+F10")); +#endif QObject::connect(d->runToCursorAction, SIGNAL(triggered()), that, SLOT(_q_runToCursor())); } @@ -1793,7 +1807,9 @@ QAction *QScriptDebugger::toggleBreakpointAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->toggleBreakpointAction = new QAction(toggleBreakpointIcon, QScriptDebugger::tr("Toggle Breakpoint"), parent); +#ifndef QT_NO_SHORTCUT d->toggleBreakpointAction->setShortcut(QScriptDebugger::tr("F9")); +#endif d->toggleBreakpointAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0)); QObject::connect(d->toggleBreakpointAction, SIGNAL(triggered()), that, SLOT(_q_toggleBreakpoint())); @@ -1848,7 +1864,9 @@ QAction *QScriptDebugger::findInScriptAction(QObject *parent) const findInScriptIcon.addPixmap(d->pixmap(QString::fromLatin1("find.png")), QIcon::Normal); QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->findInScriptAction = new QAction(findInScriptIcon, QScriptDebugger::tr("&Find in Script..."), parent); +#ifndef QT_NO_SHORTCUT d->findInScriptAction->setShortcut(QScriptDebugger::tr("Ctrl+F")); +#endif d->findInScriptAction->setEnabled( (d->codeFinderWidget != 0) && (d->codeWidget != 0) @@ -1867,7 +1885,9 @@ QAction *QScriptDebugger::findNextInScriptAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->findNextInScriptAction = new QAction(findNextInScriptIcon, QScriptDebugger::tr("Find &Next"), parent); d->findNextInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty()); +#ifndef QT_NO_SHORTCUT d->findNextInScriptAction->setShortcut(QScriptDebugger::tr("F3")); +#endif QObject::connect(d->findNextInScriptAction, SIGNAL(triggered()), that, SLOT(_q_findNextInScript())); } @@ -1882,7 +1902,9 @@ QAction *QScriptDebugger::findPreviousInScriptAction(QObject *parent) const QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->findPreviousInScriptAction = new QAction(findPreviousInScriptIcon, QScriptDebugger::tr("Find &Previous"), parent); d->findPreviousInScriptAction->setEnabled(d->codeFinderWidget && !d->codeFinderWidget->text().isEmpty()); +#ifndef QT_NO_SHORTCUT d->findPreviousInScriptAction->setShortcut(QScriptDebugger::tr("Shift+F3")); +#endif QObject::connect(d->findPreviousInScriptAction, SIGNAL(triggered()), that, SLOT(_q_findPreviousInScript())); } @@ -1896,7 +1918,9 @@ QAction *QScriptDebugger::goToLineAction(QObject *parent) const QIcon goToLineIcon; QScriptDebugger *that = const_cast<QScriptDebugger*>(this); that->d_func()->goToLineAction = new QAction(goToLineIcon, QScriptDebugger::tr("Go to Line"), parent); +#ifndef QT_NO_SHORTCUT d->goToLineAction->setShortcut(QScriptDebugger::tr("Ctrl+G")); +#endif d->goToLineAction->setEnabled((d->codeWidget != 0) && (d->codeWidget->currentView() != 0)); QObject::connect(d->goToLineAction, SIGNAL(triggered()), that, SLOT(_q_goToLine())); diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp index 56fac47..3af0f1f 100644 --- a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp +++ b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp @@ -156,6 +156,7 @@ void QScriptDebuggerLocalsWidgetPrivate::_q_onCompletionTaskFinished() QObject::connect(completer, SIGNAL(activated(QString)), q, SLOT(_q_insertCompletion(QString))); } +#ifndef QT_NO_STRINGLISTMODEL QStringListModel *model = qobject_cast<QStringListModel*>(completer->model()); if (!model) { model = new QStringListModel(q); @@ -165,6 +166,7 @@ void QScriptDebuggerLocalsWidgetPrivate::_q_onCompletionTaskFinished() for (int i = 0; i < task->resultCount(); ++i) strings.append(task->resultAt(i)); model->setStringList(strings); +#endif QString prefix = completingEditor->text().mid(task->position(), task->length()); completer->setCompletionPrefix(prefix); completingEditor->setCompleter(completer); diff --git a/src/scripttools/debugging/qscriptedit.cpp b/src/scripttools/debugging/qscriptedit.cpp index 0406b34..5a70ce2 100644 --- a/src/scripttools/debugging/qscriptedit.cpp +++ b/src/scripttools/debugging/qscriptedit.cpp @@ -173,12 +173,16 @@ int QScriptEdit::currentLineNumber() const void QScriptEdit::gotoLine(int lineNumber) { +#ifndef QT_NO_SYNTAXHIGHLIGHTER int blockNumber = lineNumber - m_baseLineNumber; const QTextBlock &block = document()->findBlockByNumber(blockNumber); if (block.isValid()) { setTextCursor(QTextCursor(block)); centerCursor(); } +#else + Q_UNUSED(lineNumber); +#endif } void QScriptEdit::setBreakpoint(int lineNumber) @@ -259,8 +263,10 @@ void QScriptEdit::updateExtraSelections() lineColor = QColor(Qt::green).lighter(160); selection.format.setBackground(lineColor); selection.format.setProperty(QTextFormat::FullWidthSelection, true); +#ifndef QT_NO_SYNTAXHIGHLIGHTER int blockNumber = m_executionLineNumber - m_baseLineNumber; selection.cursor = QTextCursor(document()->findBlockByNumber(blockNumber)); +#endif selection.cursor.clearSelection(); extraSelections.append(selection); } @@ -318,6 +324,7 @@ void QScriptEdit::extraAreaPaintEvent(QPaintEvent *e) painter.drawLine(rect.x(), rect.top(), rect.x(), rect.bottom()); painter.setRenderHint(QPainter::Antialiasing); +#ifndef QT_NO_SYNTAXHIGHLIGHTER QTextBlock block = firstVisibleBlock(); int blockNumber = block.blockNumber(); qreal top = blockBoundingGeometry(block).translated(contentOffset()).top(); @@ -366,12 +373,15 @@ void QScriptEdit::extraAreaPaintEvent(QPaintEvent *e) bottom = top + blockBoundingRect(block).height(); ++blockNumber; } +#endif } void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e) { QTextCursor cursor = cursorForPosition(QPoint(0, e->pos().y())); +#ifndef QT_NO_SYNTAXHIGHLIGHTER cursor.setPosition(cursor.block().position()); +#endif QFontMetrics fm(font()); int markWidth = fm.lineSpacing(); diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp index 37944c1..3a1333b 100644 --- a/src/scripttools/debugging/qscriptenginedebugger.cpp +++ b/src/scripttools/debugging/qscriptenginedebugger.cpp @@ -518,6 +518,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const QScriptEngineDebugger *that = const_cast<QScriptEngineDebugger*>(this); QMainWindow *win = new QMainWindow(); +#ifndef QT_NO_DOCKWIDGET QDockWidget *scriptsDock = new QDockWidget(win); scriptsDock->setObjectName(QLatin1String("qtscriptdebugger_scriptsDockWidget")); scriptsDock->setWindowTitle(tr("Loaded Scripts")); @@ -562,8 +563,11 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const win->tabifyDockWidget(errorLogDock, debugOutputDock); win->tabifyDockWidget(debugOutputDock, consoleDock); +#endif +#ifndef QT_NO_TOOLBAR win->addToolBar(Qt::TopToolBarArea, that->createStandardToolBar()); +#endif #ifndef QT_NO_MENUBAR win->menuBar()->addMenu(that->createStandardMenu(win)); @@ -575,6 +579,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const editMenu->addSeparator(); editMenu->addAction(action(GoToLineAction)); +#ifndef QT_NO_DOCKWIDGET QMenu *viewMenu = win->menuBar()->addMenu(tr("View")); viewMenu->addAction(scriptsDock->toggleViewAction()); viewMenu->addAction(breakpointsDock->toggleViewAction()); @@ -584,6 +589,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const viewMenu->addAction(debugOutputDock->toggleViewAction()); viewMenu->addAction(errorLogDock->toggleViewAction()); #endif +#endif QWidget *central = new QWidget(); QVBoxLayout *vbox = new QVBoxLayout(central); @@ -594,7 +600,9 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const win->setCentralWidget(central); win->setWindowTitle(tr("Qt Script Debugger")); +#ifndef QT_NO_TOOLBAR win->setUnifiedTitleAndToolBarOnMac(true); +#endif QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); QVariant geometry = settings.value(QLatin1String("Qt/scripttools/debugging/mainWindowGeometry")); |