forked from qt-creator/qt-creator
Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many cases in our code, these functions are unnecessarily called as instance functions, using the qApp helper. This patch replaces many occurencies of qApp with the according Q*Application classname. Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -142,7 +142,7 @@ QPixmap DetailsWidget::createBackground(const QSize &size, int topHeight, QWidge
|
||||
QRect topRect(0, 0, size.width(), topHeight);
|
||||
QRect fullRect(0, 0, size.width(), size.height());
|
||||
if (HostOsInfo::isMacHost())
|
||||
p.fillRect(fullRect, qApp->palette().window().color());
|
||||
p.fillRect(fullRect, QApplication::palette().window().color());
|
||||
else
|
||||
p.fillRect(fullRect, creatorTheme()->color(Theme::DetailsWidgetBackgroundColor));
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Utils {
|
||||
QAction *execMenuAtWidget(QMenu *menu, QWidget *widget)
|
||||
{
|
||||
QPoint p;
|
||||
QRect screen = qApp->desktop()->availableGeometry(widget);
|
||||
QRect screen = QApplication::desktop()->availableGeometry(widget);
|
||||
QSize sh = menu->sizeHint();
|
||||
QRect rect = widget->rect();
|
||||
if (widget->isRightToLeft()) {
|
||||
|
||||
@@ -83,7 +83,7 @@ qreal StyleHelper::sidebarFontSize()
|
||||
|
||||
QColor StyleHelper::notTooBrightHighlightColor()
|
||||
{
|
||||
QColor highlightColor = qApp->palette().highlight().color();
|
||||
QColor highlightColor = QApplication::palette().highlight().color();
|
||||
if (0.5 * highlightColor.saturationF() + 0.75 - highlightColor.valueF() < 0)
|
||||
highlightColor.setHsvF(highlightColor.hsvHueF(), 0.1 + highlightColor.saturationF() * 2.0, highlightColor.valueF());
|
||||
return highlightColor;
|
||||
@@ -101,7 +101,6 @@ QPalette StyleHelper::sidebarFontPalette(const QPalette &original)
|
||||
|
||||
QColor StyleHelper::panelTextColor(bool lightColored)
|
||||
{
|
||||
//qApp->palette().highlightedText().color();
|
||||
if (!lightColored)
|
||||
return Qt::white;
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QKeyEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
@@ -296,7 +296,7 @@ void ToolTip::placeTip(const QPoint &pos, QWidget *w)
|
||||
bool ToolTip::eventFilter(QObject *o, QEvent *event)
|
||||
{
|
||||
if (m_tip && event->type() == QEvent::ApplicationStateChange
|
||||
&& qApp->applicationState() != Qt::ApplicationActive) {
|
||||
&& QGuiApplication::applicationState() != Qt::ApplicationActive) {
|
||||
hideTipImmediately();
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ bool ToolTip::eventFilter(QObject *o, QEvent *event)
|
||||
}
|
||||
break;
|
||||
case QEvent::Leave:
|
||||
if (o == m_tip && !m_tip->isAncestorOf(qApp->focusWidget()))
|
||||
if (o == m_tip && !m_tip->isAncestorOf(QApplication::focusWidget()))
|
||||
hideTipWithDelay();
|
||||
break;
|
||||
case QEvent::Enter:
|
||||
|
||||
@@ -434,7 +434,7 @@ BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
||||
m_owner(owner)
|
||||
{
|
||||
setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::C_BINEDITOR_MIMETYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ CMakeListsNode::CMakeListsNode(const Utils::FileName &cmakeListPath) :
|
||||
static QIcon folderIcon;
|
||||
if (folderIcon.isNull()) {
|
||||
const QIcon overlayIcon(Constants::FILEOVERLAY_CMAKE);
|
||||
QPixmap dirPixmap = qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(QSize(16, 16));
|
||||
QPixmap dirPixmap = QApplication::style()->standardIcon(QStyle::SP_DirIcon).pixmap(QSize(16, 16));
|
||||
|
||||
folderIcon.addPixmap(Core::FileIconProvider::overlayIcon(dirPixmap, overlayIcon));
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ void SettingsDialog::createGui()
|
||||
m_headerLabel->setFont(headerLabelFont);
|
||||
|
||||
QHBoxLayout *headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
|
||||
headerHLayout->addWidget(m_headerLabel);
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ void ShortcutButton::handleToggleChange(bool toogleState)
|
||||
updateText();
|
||||
m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
|
||||
if (toogleState) {
|
||||
if (qApp->focusWidget())
|
||||
qApp->focusWidget()->clearFocus(); // funny things happen otherwise
|
||||
if (QApplication::focusWidget())
|
||||
QApplication::focusWidget()->clearFocus(); // funny things happen otherwise
|
||||
qApp->installEventFilter(this);
|
||||
} else {
|
||||
qApp->removeEventFilter(this);
|
||||
|
||||
@@ -822,10 +822,10 @@ void EditorManagerPrivate::doEscapeKeyFocusMoveMagic()
|
||||
// otherwise (i.e. mode is edit mode)
|
||||
// hide extra views (find, help, output)
|
||||
|
||||
QWidget *activeWindow = qApp->activeWindow();
|
||||
QWidget *activeWindow = QApplication::activeWindow();
|
||||
if (!activeWindow)
|
||||
return;
|
||||
QWidget *focus = qApp->focusWidget();
|
||||
QWidget *focus = QApplication::focusWidget();
|
||||
EditorView *editorView = currentEditorView();
|
||||
bool editorViewActive = (focus && focus == editorView->focusWidget());
|
||||
bool editorViewVisible = editorView->isVisible();
|
||||
@@ -886,7 +886,7 @@ void EditorManagerPrivate::showPopupOrSelectDocument()
|
||||
if (QApplication::keyboardModifiers() == Qt::NoModifier) {
|
||||
windowPopup()->selectAndHide();
|
||||
} else {
|
||||
QWidget *activeWindow = qApp->activeWindow();
|
||||
QWidget *activeWindow = QApplication::activeWindow();
|
||||
// decide where to show the popup
|
||||
// if the active window has editors, we want that editor area as a reference
|
||||
// TODO: this does not work correctly with multiple editor areas in the same window
|
||||
@@ -1388,7 +1388,7 @@ bool EditorManagerPrivate::closeEditors(const QList<IEditor*> &editors, CloseFla
|
||||
|
||||
removeEditor(editor, flag != CloseFlag::Suspend);
|
||||
if (EditorView *view = viewForEditor(editor)) {
|
||||
if (qApp->focusWidget() && qApp->focusWidget() == editor->widget()->focusWidget())
|
||||
if (QApplication::focusWidget() && QApplication::focusWidget() == editor->widget()->focusWidget())
|
||||
focusView = view;
|
||||
if (editor == view->currentEditor())
|
||||
closedViews += view;
|
||||
@@ -1930,7 +1930,7 @@ void EditorManagerPrivate::handleDocumentStateChange()
|
||||
|
||||
void EditorManagerPrivate::editorAreaDestroyed(QObject *area)
|
||||
{
|
||||
QWidget *activeWin = qApp->activeWindow();
|
||||
QWidget *activeWin = QApplication::activeWindow();
|
||||
EditorArea *newActiveArea = 0;
|
||||
for (int i = 0; i < d->m_editorAreas.size(); ++i) {
|
||||
EditorArea *r = d->m_editorAreas.at(i);
|
||||
|
||||
@@ -68,7 +68,7 @@ class FileIconProviderImplementation : public QFileIconProvider
|
||||
{
|
||||
public:
|
||||
FileIconProviderImplementation()
|
||||
: m_unknownFileIcon(qApp->style()->standardIcon(QStyle::SP_FileIcon))
|
||||
: m_unknownFileIcon(QApplication::style()->standardIcon(QStyle::SP_FileIcon))
|
||||
{}
|
||||
|
||||
QIcon icon(const QFileInfo &info) const override;
|
||||
@@ -184,7 +184,7 @@ QPixmap overlayIcon(const QPixmap &baseIcon, const QIcon &overlayIcon)
|
||||
*/
|
||||
QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlay, const QSize &size)
|
||||
{
|
||||
return overlayIcon(qApp->style()->standardIcon(baseIcon).pixmap(size), overlay);
|
||||
return overlayIcon(QApplication::style()->standardIcon(baseIcon).pixmap(size), overlay);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -742,7 +742,7 @@ FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
|
||||
|
||||
bool FindToolBar::toolBarHasFocus() const
|
||||
{
|
||||
return qApp->focusWidget() == focusWidget();
|
||||
return QApplication::focusWidget() == focusWidget();
|
||||
}
|
||||
|
||||
bool FindToolBar::canShowAllControls(bool replaceIsVisible) const
|
||||
|
||||
@@ -916,7 +916,7 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
|
||||
return;
|
||||
|
||||
QList<IContext *> newContext;
|
||||
if (QWidget *p = qApp->focusWidget()) {
|
||||
if (QWidget *p = QApplication::focusWidget()) {
|
||||
IContext *context = nullptr;
|
||||
while (p) {
|
||||
context = m_contextWidgets.value(p);
|
||||
@@ -927,7 +927,7 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
|
||||
}
|
||||
|
||||
// ignore toplevels that define no context, like popups without parent
|
||||
if (!newContext.isEmpty() || qApp->focusWidget() == focusWidget())
|
||||
if (!newContext.isEmpty() || QApplication::focusWidget() == focusWidget())
|
||||
updateContextObject(newContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ VariableChooserPrivate::VariableChooserPrivate(VariableChooser *parent)
|
||||
this, &VariableChooserPrivate::handleItemActivated);
|
||||
connect(qobject_cast<QApplication *>(qApp), &QApplication::focusChanged,
|
||||
this, &VariableChooserPrivate::updateCurrentEditor);
|
||||
updateCurrentEditor(0, qApp->focusWidget());
|
||||
updateCurrentEditor(0, QApplication::focusWidget());
|
||||
}
|
||||
|
||||
void VariableGroupItem::populateGroup(MacroExpander *expander)
|
||||
|
||||
@@ -241,7 +241,7 @@ void CodepasterPlugin::post(PasteSources pasteSources)
|
||||
textFromCurrentEditor(&data, &mimeType);
|
||||
if (data.isEmpty() && (pasteSources & PasteClipboard)) {
|
||||
QString subType = QStringLiteral("plain");
|
||||
data = qApp->clipboard()->text(subType, QClipboard::Clipboard);
|
||||
data = QGuiApplication::clipboard()->text(subType, QClipboard::Clipboard);
|
||||
}
|
||||
post(data, mimeType);
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ public:
|
||||
? file.open(stdin, QIODevice::ReadOnly) : file.open(QIODevice::ReadOnly);
|
||||
if (!success) {
|
||||
std::cerr << "Error: Failed to open file to paste from." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
const QString content = QString::fromLocal8Bit(file.readAll());
|
||||
if (content.isEmpty()) {
|
||||
std::cerr << "Empty input, aborting." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
connect(m_protocol.data(), &Protocol::pasteDone, this, &PasteReceiver::handlePasteDone);
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
void handlePasteDone(const QString &link)
|
||||
{
|
||||
std::cout << qPrintable(link) << std::endl;
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
const QString m_filePath;
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
CppEditorFactory()
|
||||
{
|
||||
setId(Constants::CPPEDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::CPPEDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::CPPEDITOR_DISPLAY_NAME));
|
||||
addMimeType(CppTools::Constants::C_SOURCE_MIMETYPE);
|
||||
addMimeType(CppTools::Constants::C_HEADER_MIMETYPE);
|
||||
addMimeType(CppTools::Constants::CPP_SOURCE_MIMETYPE);
|
||||
|
||||
@@ -1269,7 +1269,7 @@ static QString variableToolTip(const QString &name, const QString &type, quint64
|
||||
|
||||
void WatchModel::grabWidget()
|
||||
{
|
||||
qApp->setOverrideCursor(Qt::CrossCursor);
|
||||
QGuiApplication::setOverrideCursor(Qt::CrossCursor);
|
||||
m_grabWidgetTimerId = startTimer(30);
|
||||
ICore::mainWindow()->grabMouse();
|
||||
}
|
||||
@@ -1302,7 +1302,7 @@ void WatchModel::timerEvent(QTimerEvent *event)
|
||||
void WatchModel::ungrabWidget()
|
||||
{
|
||||
ICore::mainWindow()->releaseMouse();
|
||||
qApp->restoreOverrideCursor();
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
killTimer(m_grabWidgetTimerId);
|
||||
m_grabWidgetTimerId = -1;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Internal {
|
||||
FormEditorFactory::FormEditorFactory()
|
||||
{
|
||||
setId(K_DESIGNER_XML_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("Designer", C_DESIGNER_XML_DISPLAY_NAME));
|
||||
addMimeType(FORM_MIMETYPE);
|
||||
|
||||
FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_UI, "ui");
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QLibraryInfo>
|
||||
@@ -108,7 +108,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString &trFile = QLatin1String("designer_") + locale;
|
||||
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
|
||||
qApp->installTranslator(qtr);
|
||||
QCoreApplication::installTranslator(qtr);
|
||||
}
|
||||
error->clear();
|
||||
return true;
|
||||
|
||||
@@ -38,7 +38,7 @@ DiffEditorFactory::DiffEditorFactory(QObject *parent)
|
||||
: IEditorFactory(parent)
|
||||
{
|
||||
setId(Constants::DIFF_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("DiffEditorFactory", Constants::DIFF_EDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("DiffEditorFactory", Constants::DIFF_EDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::DIFF_EDITOR_MIMETYPE);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ GenericProjectWizard::GenericProjectWizard()
|
||||
QPixmap icon(22, 22);
|
||||
icon.fill(Qt::transparent);
|
||||
QPainter p(&icon);
|
||||
p.drawPixmap(3, 3, 16, 16, qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
|
||||
p.drawPixmap(3, 3, 16, 16, QApplication::style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
|
||||
setIcon(icon);
|
||||
}
|
||||
setDisplayName(tr("Import Existing Project"));
|
||||
|
||||
@@ -312,7 +312,7 @@ AssistInterface *GlslEditorWidget::createAssistInterface(
|
||||
GlslEditorFactory::GlslEditorFactory()
|
||||
{
|
||||
setId(Constants::C_GLSLEDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_GLSLEDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_GLSLEDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::GLSL_MIMETYPE);
|
||||
addMimeType(Constants::GLSL_MIMETYPE_VERT);
|
||||
addMimeType(Constants::GLSL_MIMETYPE_FRAG);
|
||||
|
||||
@@ -136,9 +136,9 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
const QString &trFile = QLatin1String("assistant_") + locale;
|
||||
const QString &helpTrFile = QLatin1String("qt_help_") + locale;
|
||||
if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
|
||||
qApp->installTranslator(qtr);
|
||||
QCoreApplication::installTranslator(qtr);
|
||||
if (qhelptr->load(helpTrFile, qtTrPath) || qhelptr->load(helpTrFile, creatorTrPath))
|
||||
qApp->installTranslator(qhelptr);
|
||||
QCoreApplication::installTranslator(qhelptr);
|
||||
}
|
||||
|
||||
m_helpManager = new LocalHelpManager(this);
|
||||
@@ -448,9 +448,9 @@ void HelpPlugin::modeChanged(Core::Id mode, Core::Id old)
|
||||
{
|
||||
Q_UNUSED(old)
|
||||
if (mode == m_mode->id()) {
|
||||
qApp->setOverrideCursor(Qt::WaitCursor);
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
doSetupIfNeeded();
|
||||
qApp->restoreOverrideCursor();
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QUrl>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@@ -156,12 +156,12 @@ void HelpViewer::home()
|
||||
|
||||
void HelpViewer::slotLoadStarted()
|
||||
{
|
||||
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
}
|
||||
|
||||
void HelpViewer::slotLoadFinished()
|
||||
{
|
||||
qApp->restoreOverrideCursor();
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
emit sourceChanged(source());
|
||||
emit loadFinished();
|
||||
}
|
||||
|
||||
@@ -184,13 +184,13 @@ void SearchWidget::search() const
|
||||
|
||||
void SearchWidget::searchingStarted()
|
||||
{
|
||||
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
}
|
||||
|
||||
void SearchWidget::searchingFinished(int hits)
|
||||
{
|
||||
Q_UNUSED(hits)
|
||||
qApp->restoreOverrideCursor();
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void SearchWidget::indexingStarted()
|
||||
|
||||
@@ -40,7 +40,7 @@ ImageViewerFactory::ImageViewerFactory(QObject *parent) :
|
||||
Core::IEditorFactory(parent)
|
||||
{
|
||||
setId(Constants::IMAGEVIEWER_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME));
|
||||
|
||||
const QList<QByteArray> supportedMimeTypes = QImageReader::supportedMimeTypes();
|
||||
foreach (const QByteArray &format, supportedMimeTypes)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "actionhandler.h"
|
||||
#include "modeleditor.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace ModelEditor {
|
||||
namespace Internal {
|
||||
@@ -46,7 +46,7 @@ ModelEditorFactory::ModelEditorFactory(UiController *uiController, QObject *pare
|
||||
d(new ModelEditorFactoryPrivate())
|
||||
{
|
||||
setId(Constants::MODEL_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::MODEL_EDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::MODEL_EDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::MIME_TYPE_MODEL);
|
||||
d->uiController = uiController;
|
||||
d->actionHandler = new ActionHandler(Core::Context(Constants::MODEL_EDITOR_ID), this);
|
||||
|
||||
@@ -631,9 +631,9 @@ IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const
|
||||
|
||||
void PerforcePlugin::printPendingChanges()
|
||||
{
|
||||
qApp->setOverrideCursor(Qt::WaitCursor);
|
||||
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
PendingChangesDialog dia(pendingChangesData(), ICore::mainWindow());
|
||||
qApp->restoreOverrideCursor();
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
if (dia.exec() == QDialog::Accepted) {
|
||||
const int i = dia.changeNumber();
|
||||
QStringList args(QLatin1String("submit"));
|
||||
|
||||
@@ -165,7 +165,7 @@ GDB 32bit | Api | Api | N/A | Win32
|
||||
+ Utils::winErrorMessage(GetLastError()));
|
||||
break;
|
||||
}
|
||||
bool creatorIs64Bit = Utils::is64BitWindowsBinary(qApp->applicationFilePath());
|
||||
bool creatorIs64Bit = Utils::is64BitWindowsBinary(QCoreApplication::applicationFilePath());
|
||||
if (!is64BitSystem
|
||||
|| si == NoSpecialInterrupt
|
||||
|| (si == Win64Interrupt && creatorIs64Bit)
|
||||
|
||||
@@ -369,7 +369,7 @@ QWidget *SpacerField::createWidget(const QString &displayName, JsonFieldPage *pa
|
||||
{
|
||||
Q_UNUSED(displayName);
|
||||
Q_UNUSED(page);
|
||||
int size = qApp->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing) * m_factor;
|
||||
int size = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing) * m_factor;
|
||||
|
||||
auto w = new QWidget();
|
||||
w->setMinimumSize(size, size);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
#include <windows.h>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QTime>
|
||||
|
||||
/*!
|
||||
@@ -64,7 +64,7 @@ WinDebugInterface::WinDebugInterface(QObject *parent) :
|
||||
QThread(parent)
|
||||
{
|
||||
m_instance = this;
|
||||
m_creatorPid = qApp->applicationPid();
|
||||
m_creatorPid = QCoreApplication::applicationPid();
|
||||
setObjectName(QLatin1String("WinDebugInterfaceThread"));
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ static TextDocument *createProFileDocument()
|
||||
ProFileEditorFactory::ProFileEditorFactory()
|
||||
{
|
||||
setId(Constants::PROFILE_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::PROFILE_EDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::PROFILE_EDITOR_DISPLAY_NAME));
|
||||
addMimeType(Constants::PROFILE_MIMETYPE);
|
||||
addMimeType(Constants::PROINCLUDEFILE_MIMETYPE);
|
||||
addMimeType(Constants::PROFEATUREFILE_MIMETYPE);
|
||||
|
||||
@@ -105,7 +105,7 @@ QmakeStaticData::QmakeStaticData()
|
||||
// Overlay the SP_DirIcon with the custom icons
|
||||
const QSize desiredSize = QSize(16, 16);
|
||||
|
||||
const QPixmap dirPixmap = qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(desiredSize);
|
||||
const QPixmap dirPixmap = QApplication::style()->standardIcon(QStyle::SP_DirIcon).pixmap(desiredSize);
|
||||
for (unsigned i = 0 ; i < count; ++i) {
|
||||
const QIcon overlayIcon(QLatin1String(fileTypeDataStorage[i].icon));
|
||||
QIcon folderIcon;
|
||||
|
||||
@@ -135,7 +135,7 @@ SimpleProjectWizard::SimpleProjectWizard()
|
||||
QPixmap icon(22, 22);
|
||||
icon.fill(Qt::transparent);
|
||||
QPainter p(&icon);
|
||||
p.drawPixmap(3, 3, 16, 16, qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
|
||||
p.drawPixmap(3, 3, 16, 16, QApplication::style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
|
||||
setIcon(icon);
|
||||
}
|
||||
setDisplayName(tr("Import as qmake Project (Limited Functionality)"));
|
||||
|
||||
@@ -1030,7 +1030,7 @@ bool QmlJSEditor::isDesignModePreferred() const
|
||||
QmlJSEditorFactory::QmlJSEditorFactory()
|
||||
{
|
||||
setId(Constants::C_QMLJSEDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME));
|
||||
|
||||
addMimeType(QmlJSTools::Constants::QML_MIMETYPE);
|
||||
addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE);
|
||||
|
||||
@@ -124,11 +124,11 @@ void FlameGraphViewTest::testContextMenu()
|
||||
int menuClicks = 0;
|
||||
|
||||
connect(&timer, &QTimer::timeout, this, [&]() {
|
||||
auto activePopup = qApp->activePopupWidget();
|
||||
auto activePopup = QApplication::activePopupWidget();
|
||||
if (!activePopup || !activePopup->windowHandle()->isExposed()) {
|
||||
QContextMenuEvent *event = new QContextMenuEvent(QContextMenuEvent::Mouse,
|
||||
QPoint(250, 250));
|
||||
qApp->postEvent(&view, event);
|
||||
QCoreApplication::postEvent(&view, event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void LocalQmlProfilerRunnerTest::testRunner1()
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
|
||||
|
||||
configuration.socket = connection.analyzerSocket = LocalQmlProfilerRunner::findFreeSocket();
|
||||
configuration.debuggee.executable = qApp->applicationFilePath();
|
||||
configuration.debuggee.executable = QCoreApplication::applicationFilePath();
|
||||
|
||||
// comma is used to specify a test function. In this case, an invalid one.
|
||||
configuration.debuggee.commandLineArguments = QString("-test QmlProfiler,");
|
||||
|
||||
@@ -45,7 +45,7 @@ ResourceEditorFactory::ResourceEditorFactory(ResourceEditorPlugin *plugin) :
|
||||
{
|
||||
setId(RESOURCEEDITOR_ID);
|
||||
setMimeTypes(QStringList(QLatin1String(C_RESOURCE_MIMETYPE)));
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME));
|
||||
|
||||
Core::FileIconProvider::registerIconOverlayForSuffix(
|
||||
ProjectExplorer::Constants::FILEOVERLAY_QRC, "qrc");
|
||||
|
||||
@@ -621,7 +621,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
|
||||
|
||||
if (ke->text().length() == 1
|
||||
&& d->m_completionListView->currentIndex().isValid()
|
||||
&& qApp->focusWidget() == o) {
|
||||
&& QApplication::focusWidget() == o) {
|
||||
const QChar &typedChar = ke->text().at(0);
|
||||
AssistProposalItemInterface *item =
|
||||
d->m_model->proposalItem(d->m_completionListView->currentIndex().row());
|
||||
|
||||
@@ -58,7 +58,7 @@ PlainTextEditorFactory::PlainTextEditorFactory()
|
||||
QTC_CHECK(!m_instance);
|
||||
m_instance = this;
|
||||
setId(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID);
|
||||
setDisplayName(qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
|
||||
setDisplayName(QCoreApplication::translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME));
|
||||
addMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
||||
addMimeType(QLatin1String("text/css")); // for some reason freedesktop thinks css is text/x-csrc
|
||||
addHoverHandler(new BaseHoverHandler);
|
||||
|
||||
@@ -3488,7 +3488,7 @@ void TextEditorWidgetPrivate::disableBlockSelection(BlockSelectionUpdateKind kin
|
||||
void TextEditorWidgetPrivate::resetCursorFlashTimer()
|
||||
{
|
||||
m_cursorVisible = true;
|
||||
const int flashTime = qApp->cursorFlashTime();
|
||||
const int flashTime = QApplication::cursorFlashTime();
|
||||
if (flashTime > 0) {
|
||||
m_cursorFlashTimer.stop();
|
||||
m_cursorFlashTimer.start(flashTime / 2, q);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
#include <QtTest/QtTest>
|
||||
@@ -493,7 +493,7 @@ void Internal::TextEditorPlugin::testBlockSelectionCopy()
|
||||
editorWidget->update();
|
||||
editorWidget->copy();
|
||||
|
||||
QCOMPARE(qApp->clipboard()->text(), copiedText);
|
||||
QCOMPARE(QGuiApplication::clipboard()->text(), copiedText);
|
||||
}
|
||||
Core::EditorManager::closeDocument(editor->document(), false);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void CompilerOutputProcessor::start()
|
||||
this, &CompilerOutputProcessor::handleTask);
|
||||
while (!m_source.atEnd())
|
||||
parser.stdError(QString::fromLocal8Bit(m_source.readLine().trimmed()));
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void CompilerOutputProcessor::handleTask(const ProjectExplorer::Task &task)
|
||||
|
||||
@@ -378,7 +378,7 @@ static QString example()
|
||||
#else
|
||||
QString::fromLatin1("$ echo \"int foo() {}\" | ./%1 && xdg-open %2.ast.png")
|
||||
#endif
|
||||
.arg(QFileInfo(qApp->arguments().at(0)).fileName(), QLatin1String(PATH_STDIN_FILE));
|
||||
.arg(QFileInfo(QCoreApplication::arguments().at(0)).fileName(), QLatin1String(PATH_STDIN_FILE));
|
||||
}
|
||||
|
||||
static QString parseModeToString(Document::ParseMode parseMode)
|
||||
@@ -474,7 +474,7 @@ static Document::Ptr parse(const QString &fileName, const QByteArray &source,
|
||||
|
||||
static void printUsage()
|
||||
{
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(qApp->arguments().at(0)).fileName())
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(QCoreApplication::arguments().at(0)).fileName())
|
||||
<< " [-v] [-p ast] <file1> <file2> ...\n\n";
|
||||
|
||||
std::cout
|
||||
|
||||
@@ -54,7 +54,7 @@ using namespace CPlusPlus;
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(qApp->arguments().at(0)).fileName())
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(QCoreApplication::arguments().at(0)).fileName())
|
||||
<< " [-v] <file1> <file2> ...\n\n"
|
||||
<< "Run the parser with the given files.\n";
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ protected:
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(qApp->arguments().at(0)).fileName())
|
||||
std::cout << "Usage: " << qPrintable(QFileInfo(QCoreApplication::arguments().at(0)).fileName())
|
||||
<< " [-v] [path to AST.h]\n\n"
|
||||
<< "Print a visitor class based on AST.h to stdout.\n\n";
|
||||
const QString defaulPath = QFileInfo(QLatin1String(PATH_AST_H)).canonicalFilePath();
|
||||
|
||||
@@ -1692,7 +1692,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
const QByteArray executable = QFileInfo(qApp->arguments().first()).fileName().toLatin1();
|
||||
const QByteArray executable = QFileInfo(QCoreApplication::arguments().first()).fileName().toLatin1();
|
||||
std::cout << "Usage: " << executable.constData() << "\n"
|
||||
<< " " << executable.constData() << " <frontend-dir> <dumpers-file>"
|
||||
<< "\n\n"
|
||||
|
||||
@@ -177,5 +177,5 @@ void CrashHandlerDialog::close()
|
||||
{
|
||||
if (m_ui->restartAppCheckBox->isEnabled() && m_ui->restartAppCheckBox->isChecked())
|
||||
m_crashHandler->restartApplication();
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ CrashHandlerSetup::CrashHandlerSetup(const QString &appName,
|
||||
disableRestartOptionC = "--disable-restart";
|
||||
|
||||
const QString execDirPath = executableDirPath.isEmpty()
|
||||
? qApp->applicationDirPath()
|
||||
? QCoreApplication::applicationDirPath()
|
||||
: executableDirPath;
|
||||
const QString crashHandlerPath = execDirPath + QLatin1String("/qtcreator_crash_handler");
|
||||
crashHandlerPathC = qstrdup(qPrintable(crashHandlerPath));
|
||||
|
||||
@@ -69,7 +69,7 @@ const QString tabular(const Operation *o)
|
||||
void printHelp(const QList<Operation *> &operations)
|
||||
{
|
||||
std::cout << "Qt Creator SDK setup tool." << std::endl;
|
||||
std::cout << " Usage: " << qPrintable(qApp->arguments().at(0))
|
||||
std::cout << " Usage: " << qPrintable(QCoreApplication::arguments().at(0))
|
||||
<< " <ARGS> <OPERATION> <OPERATION_ARGS>" << std::endl << std::endl;
|
||||
std::cout << "ARGS:" << std::endl;
|
||||
std::cout << " --help|-h Print this help text" << std::endl;
|
||||
|
||||
@@ -131,7 +131,7 @@ void tst_TimelineZoomControl::window()
|
||||
verifyWindow(zoomControl);
|
||||
zoomControl.setRange(102005, 102010); // make sure it doesn't overrun trace start
|
||||
} else if (zoomControl.windowStart() == zoomControl.traceStart()) {
|
||||
qApp->exit();
|
||||
QCoreApplication::exit();
|
||||
} else {
|
||||
QVERIFY(zoomControl.rangeStart() - zoomControl.windowStart() ==
|
||||
zoomControl.windowEnd() - zoomControl.rangeEnd());
|
||||
@@ -146,7 +146,7 @@ void tst_TimelineZoomControl::window()
|
||||
verifyWindow(zoomControl);
|
||||
});
|
||||
|
||||
qApp->exec();
|
||||
QGuiApplication::exec();
|
||||
|
||||
disconnect(connection);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler)
|
||||
connect(m_handler->flatView(), SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(showViewContextMenu(QPoint)));
|
||||
|
||||
resize(qMin(qApp->desktop()->width(), 1024), 600);
|
||||
resize(qMin(QApplication::desktop()->width(), 1024), 600);
|
||||
}
|
||||
|
||||
ModelTestWidget::~ModelTestWidget()
|
||||
|
||||
@@ -114,27 +114,27 @@ private:
|
||||
void handleConnected()
|
||||
{
|
||||
qDebug("Error: Received unexpected connected() signal.");
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void handleDisconnected()
|
||||
{
|
||||
qDebug("Error: Received unexpected disconnected() signal.");
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void handleDataAvailable(const QString &msg)
|
||||
{
|
||||
qDebug("Error: Received unexpected dataAvailable() signal. "
|
||||
"Message was: '%s'.", qPrintable(msg));
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void handleError(QSsh::SshError error)
|
||||
{
|
||||
if (m_testSet.isEmpty()) {
|
||||
qDebug("Error: Received error %d, but no test was running.", error);
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
const TestItem testItem = m_testSet.takeFirst();
|
||||
@@ -142,13 +142,13 @@ private:
|
||||
qDebug("Received error %d, as expected.", error);
|
||||
if (m_testSet.isEmpty()) {
|
||||
qDebug("All tests finished successfully.");
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
} else {
|
||||
runNextTest();
|
||||
}
|
||||
} else {
|
||||
qDebug("Received unexpected error %d.", error);
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ private:
|
||||
{
|
||||
if (m_testSet.isEmpty()) {
|
||||
qDebug("Error: timeout, but no test was running.");
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
const TestItem testItem = m_testSet.takeFirst();
|
||||
qDebug("Error: The following test timed out: %s", testItem.description);
|
||||
|
||||
@@ -79,14 +79,14 @@ void RemoteProcessTest::handleConnectionError()
|
||||
? m_sshConnection->errorString() : m_remoteRunner->lastConnectionErrorString();
|
||||
|
||||
std::cerr << "Error: Connection failure (" << qPrintable(error) << ")." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void RemoteProcessTest::handleProcessStarted()
|
||||
{
|
||||
if (m_started) {
|
||||
std::cerr << "Error: Received started() signal again." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
m_started = true;
|
||||
if (m_state == TestingCrash) {
|
||||
@@ -107,11 +107,11 @@ void RemoteProcessTest::handleProcessStdout()
|
||||
if (!m_started) {
|
||||
std::cerr << "Error: Remote output from non-started process."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else if (m_state != TestingSuccess && m_state != TestingTerminal) {
|
||||
std::cerr << "Error: Got remote standard output in state " << m_state
|
||||
<< "." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
m_remoteStdout += m_remoteRunner->readAllStandardOutput();
|
||||
}
|
||||
@@ -122,11 +122,11 @@ void RemoteProcessTest::handleProcessStderr()
|
||||
if (!m_started) {
|
||||
std::cerr << "Error: Remote error output from non-started process."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else if (m_state == TestingSuccess) {
|
||||
std::cerr << "Error: Unexpected remote standard error output."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
m_remoteStderr += m_remoteRunner->readAllStandardError();
|
||||
}
|
||||
@@ -138,7 +138,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
case SshRemoteProcess::NormalExit:
|
||||
if (!m_started) {
|
||||
std::cerr << "Error: Process exited without starting." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
switch (m_state) {
|
||||
@@ -147,13 +147,13 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
if (exitCode != 0) {
|
||||
std::cerr << "Error: exit code is " << exitCode
|
||||
<< ", expected zero." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
if (m_remoteStdout.isEmpty()) {
|
||||
std::cerr << "Error: Command did not produce output."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,12 +169,12 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
if (exitCode == 0) {
|
||||
std::cerr << "Error: exit code is zero, expected non-zero."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
if (m_remoteStderr.isEmpty()) {
|
||||
std::cerr << "Error: Command did not produce error output." << std::flush;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
if (m_remoteRunner->processExitCode() == 0) {
|
||||
std::cerr << "Error: Successful exit from process that was "
|
||||
"supposed to crash." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
// Some shells (e.g. mksh) don't report "killed", but just a non-zero exit code.
|
||||
handleSuccessfulCrashTest();
|
||||
@@ -200,13 +200,13 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
if (exitCode != 0) {
|
||||
std::cerr << "Error: exit code is " << exitCode
|
||||
<< ", expected zero." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
if (m_remoteStdout.isEmpty()) {
|
||||
std::cerr << "Error: Command did not produce output."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
std::cout << "Ok.\nTesting I/O device functionality... " << std::flush;
|
||||
@@ -224,7 +224,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
if (m_catProcess->exitCode() == 0) {
|
||||
std::cerr << "Error: Successful exit from process that was supposed to crash."
|
||||
<< std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
handleSuccessfulIoTest();
|
||||
}
|
||||
@@ -232,17 +232,17 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
case TestingProcessChannels:
|
||||
if (m_remoteStderr.isEmpty()) {
|
||||
std::cerr << "Error: Did not receive readyReadStderr()." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
if (m_remoteData != StderrOutput) {
|
||||
std::cerr << "Error: Expected output '" << StderrOutput.data() << "', received '"
|
||||
<< m_remoteData.data() << "'." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
std::cout << "Ok.\nAll tests succeeded." << std::endl;
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
break;
|
||||
case Inactive:
|
||||
Q_ASSERT(false);
|
||||
@@ -255,7 +255,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
} else {
|
||||
std::cerr << "Error: Process failed to start." << std::endl;
|
||||
}
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
break;
|
||||
case SshRemoteProcess::CrashExit:
|
||||
switch (m_state) {
|
||||
@@ -267,7 +267,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Error: Unexpected crash." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
||||
void RemoteProcessTest::handleTimeout()
|
||||
{
|
||||
std::cerr << "Error: Timeout waiting for progress." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void RemoteProcessTest::handleConnected()
|
||||
@@ -306,7 +306,7 @@ void RemoteProcessTest::handleReadyRead()
|
||||
if (data != testString()) {
|
||||
std::cerr << "Testing of QIODevice functionality failed: Expected '"
|
||||
<< qPrintable(testString()) << "', got '" << qPrintable(data) << "'." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
SshRemoteProcessRunner * const killer = new SshRemoteProcessRunner(this);
|
||||
killer->run("pkill -9 cat", m_sshParams);
|
||||
@@ -326,7 +326,7 @@ void RemoteProcessTest::handleReadyReadStdout()
|
||||
Q_ASSERT(m_state == TestingProcessChannels);
|
||||
|
||||
std::cerr << "Error: Received unexpected stdout data." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void RemoteProcessTest::handleReadyReadStderr()
|
||||
|
||||
@@ -105,7 +105,7 @@ void SftpTest::handleDisconnected()
|
||||
else
|
||||
std::cout << "No errors encountered.";
|
||||
std::cout << std::endl;
|
||||
qApp->exit(m_error ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
QCoreApplication::exit(m_error ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void SftpTest::handleError()
|
||||
@@ -114,7 +114,7 @@ void SftpTest::handleError()
|
||||
<< qPrintable(m_connection->errorString()) << "." << std::endl;
|
||||
m_error = true;
|
||||
m_state = Disconnecting;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void SftpTest::handleChannelInitialized()
|
||||
|
||||
@@ -114,5 +114,5 @@ void SftpFsWindow::handleConnectionError(const QString &errorMessage)
|
||||
{
|
||||
QMessageBox::warning(this, tr("Connection Error"),
|
||||
tr("Fatal SSH error: %1").arg(errorMessage));
|
||||
qApp->quit();
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void Shell::run()
|
||||
{
|
||||
if (!m_stdin->open(stdin, QIODevice::ReadOnly | QIODevice::Unbuffered)) {
|
||||
std::cerr << "Error: Cannot read from standard input." << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void Shell::run()
|
||||
void Shell::handleConnectionError()
|
||||
{
|
||||
std::cerr << "SSH connection error: " << qPrintable(m_connection->errorString()) << std::endl;
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void Shell::handleShellMessage(const QString &message)
|
||||
@@ -106,7 +106,7 @@ void Shell::handleChannelClosed(int exitStatus)
|
||||
{
|
||||
std::cerr << "Shell closed. Exit status was " << exitStatus << ", exit code was "
|
||||
<< m_shell->exitCode() << "." << std::endl;
|
||||
qApp->exit(exitStatus == SshRemoteProcess::NormalExit && m_shell->exitCode() == 0
|
||||
QCoreApplication::exit(exitStatus == SshRemoteProcess::NormalExit && m_shell->exitCode() == 0
|
||||
? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user