From dc77029cde55782f3048fe568ed2e7aead1a26f5 Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Fri, 10 Jul 2020 20:56:30 -0500 Subject: [PATCH] Fixed most depratated warnings. --- external/Qt-Color-Widgets/src/color_wheel.cpp | 2 +- external/singleapplication/singleapplication.cpp | 3 ++- src/config/configwindow.cpp | 2 +- src/config/filenameeditor.cpp | 2 +- src/core/controller.cpp | 1 + src/tools/launcher/applauncherwidget.cpp | 4 +++- src/tools/launcher/terminallauncher.cpp | 2 +- src/tools/pin/pinwidget.cpp | 2 +- src/tools/text/textconfig.cpp | 2 +- src/widgets/capture/buttonhandler.cpp | 2 +- src/widgets/capture/capturewidget.cpp | 4 ++-- src/widgets/capture/colorpicker.cpp | 4 ++-- src/widgets/panel/sidepanelwidget.cpp | 2 +- src/widgets/panel/utilitypanel.cpp | 2 +- 14 files changed, 19 insertions(+), 15 deletions(-) diff --git a/external/Qt-Color-Widgets/src/color_wheel.cpp b/external/Qt-Color-Widgets/src/color_wheel.cpp index 21a490aa..6219a64f 100644 --- a/external/Qt-Color-Widgets/src/color_wheel.cpp +++ b/external/Qt-Color-Widgets/src/color_wheel.cpp @@ -66,7 +66,7 @@ public: display_flags(FLAGS_DEFAULT), color_from(&QColor::fromHsvF), rainbow_from_hue(&detail::rainbow_hsv) { - QColor bgColor = widget->palette().background().color(); + QColor bgColor = widget->palette().window().color(); bgBrightness = color_widgets::detail::color_lumaF(bgColor); } diff --git a/external/singleapplication/singleapplication.cpp b/external/singleapplication/singleapplication.cpp index f452e70d..1f5a5b8c 100644 --- a/external/singleapplication/singleapplication.cpp +++ b/external/singleapplication/singleapplication.cpp @@ -107,7 +107,8 @@ void SingleApplicationPrivate::genBlockServerName( int timeout ) #endif #ifdef Q_OS_UNIX QProcess process; - process.start( QStringLiteral("whoami") ); + process.start( QStringLiteral("whoami"),QStringList{} ); + if( process.waitForFinished( timeout ) && process.exitCode() == QProcess::NormalExit) { appData.addData( process.readLine() ); diff --git a/src/config/configwindow.cpp b/src/config/configwindow.cpp index 56687e60..665bef8a 100644 --- a/src/config/configwindow.cpp +++ b/src/config/configwindow.cpp @@ -52,7 +52,7 @@ ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) { connect(m_configWatcher, &QFileSystemWatcher::fileChanged, this, changedSlot); - QColor background = this->palette().background().color(); + QColor background = this->palette().window().color(); bool isDark = ColorUtils::colorIsDark(background); QString modifier = isDark ? PathInfo::whiteIconPath() : PathInfo::blackIconPath(); diff --git a/src/config/filenameeditor.cpp b/src/config/filenameeditor.cpp index 36b6cddb..a6c0aa11 100644 --- a/src/config/filenameeditor.cpp +++ b/src/config/filenameeditor.cpp @@ -58,7 +58,7 @@ void FileNameEditor::initWidgets() { // preview m_outputLabel = new QLineEdit(this); m_outputLabel->setDisabled(true); - QString foreground = this->palette().foreground().color().name(); + QString foreground = this->palette().windowText().color().name(); m_outputLabel->setStyleSheet(QStringLiteral("color: %1").arg(foreground)); QPalette pal = m_outputLabel->palette(); QColor color = pal.color(QPalette::Disabled, m_outputLabel->backgroundRole()); diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 7860853f..d7c6e32e 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -83,6 +83,7 @@ void Controller::requestCapture(const CaptureRequest &request) { this->startFullscreenCapture(id); }); break; + // TODO: Figure out the code path that gets here so the deprated warning can be fixed case CaptureRequest::SCREEN_MODE: { int &&number = request.data().toInt(); doLater(request.delay(), this, [this, id, number](){ diff --git a/src/tools/launcher/applauncherwidget.cpp b/src/tools/launcher/applauncherwidget.cpp index e1048b21..34ad3a79 100644 --- a/src/tools/launcher/applauncherwidget.cpp +++ b/src/tools/launcher/applauncherwidget.cpp @@ -103,6 +103,8 @@ void AppLauncherWidget::launch(const QModelIndex &index) { } QString command = index.data(Qt::UserRole).toString().replace( QRegExp("(\\%.)"), '"' + m_tempFile + '"'); + + QString app_name = index.data(Qt::UserRole).toString().split(" ").at(0); bool inTerminal = index.data(Qt::UserRole+1).toBool() || m_terminalCheckbox->isChecked(); if (inTerminal) { @@ -112,7 +114,7 @@ void AppLauncherWidget::launch(const QModelIndex &index) { tr("Unable to launch in terminal.")); } } else { - QProcess::startDetached(command); + QProcess::startDetached(app_name,{m_tempFile}); } if (!m_keepOpen) { close(); diff --git a/src/tools/launcher/terminallauncher.cpp b/src/tools/launcher/terminallauncher.cpp index 451f60fa..4369d2e1 100644 --- a/src/tools/launcher/terminallauncher.cpp +++ b/src/tools/launcher/terminallauncher.cpp @@ -56,5 +56,5 @@ TerminalApp TerminalLauncher::getPreferedTerminal() { bool TerminalLauncher::launchDetached(const QString &command) { TerminalApp app = getPreferedTerminal(); QString s = app.name + " " + app.arg + " " + command; - return QProcess::startDetached(s); + return QProcess::startDetached(app.name, {app.arg,command}); } diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp index b4d2df6e..6999839b 100644 --- a/src/tools/pin/pinwidget.cpp +++ b/src/tools/pin/pinwidget.cpp @@ -58,7 +58,7 @@ int PinWidget::margin() const { } void PinWidget::wheelEvent(QWheelEvent *e) { - int val = e->delta() > 0 ? 15 : -15; + int val = e->angleDelta().y() > 0 ? 15 : -15; int newWidth = qBound(50, m_label->width() + val, maximumWidth()); int newHeight = qBound(50, m_label->height() + val, maximumHeight()); diff --git a/src/tools/text/textconfig.cpp b/src/tools/text/textconfig.cpp index 229d57ed..f63b3069 100644 --- a/src/tools/text/textconfig.cpp +++ b/src/tools/text/textconfig.cpp @@ -36,7 +36,7 @@ TextConfig::TextConfig(QWidget *parent) : QWidget(parent) { int index = fontsCB->findText(font().family()); fontsCB->setCurrentIndex(index); - QColor bgColor(palette().background().color()); + QColor bgColor(palette().windowText().color()); QString iconPrefix = ColorUtils::colorIsDark(bgColor) ? PathInfo::whiteIconPath() : PathInfo::blackIconPath(); diff --git a/src/widgets/capture/buttonhandler.cpp b/src/widgets/capture/buttonhandler.cpp index 373a096d..95a37e32 100644 --- a/src/widgets/capture/buttonhandler.cpp +++ b/src/widgets/capture/buttonhandler.cpp @@ -221,7 +221,7 @@ QVector ButtonHandler::verticalPoints( QRect ButtonHandler::intersectWithAreas(const QRect &rect) { QRect res; - for(const QRect &r : m_screenRegions.rects()) { + for(const QRect &r : m_screenRegions) { QRect temp = rect.intersected(r); if (temp.height() * temp.width() > res.height() * res.width()) { res = temp; diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index cb2a1740..e7eab3c7 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -263,7 +263,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) { painter.setRenderHint(QPainter::Antialiasing); painter.setBrush(m_uiColor); for(auto r: m_selection->handlerAreas()) { - painter.drawRoundRect(r, 100, 100); + painter.drawRoundedRect(r, 100, 100); } } } @@ -510,7 +510,7 @@ void CaptureWidget::keyReleaseEvent(QKeyEvent *e) { } void CaptureWidget::wheelEvent(QWheelEvent *e) { - m_context.thickness += e->delta() / 120; + m_context.thickness += e->angleDelta().y() / 120; m_context.thickness = qBound(0, m_context.thickness, 100); QPoint topLeft = qApp->desktop()->screenGeometry( qApp->desktop()->screenNumber(QCursor::pos())).topLeft(); diff --git a/src/widgets/capture/colorpicker.cpp b/src/widgets/capture/colorpicker.cpp index e714b2b4..249330b4 100644 --- a/src/widgets/capture/colorpicker.cpp +++ b/src/widgets/capture/colorpicker.cpp @@ -82,11 +82,11 @@ void ColorPicker::paintEvent(QPaintEvent *) { highlight.moveTo(highlight.x() - 3, highlight.y() - 3); highlight.setHeight(highlight.height() + 6); highlight.setWidth(highlight.width() + 6); - painter.drawRoundRect(highlight, 100, 100); + painter.drawRoundedRect(highlight, 100, 100); painter.setPen(QColor(Qt::black)); } painter.setBrush(QColor(m_colorList.at(i))); - painter.drawRoundRect(rects.at(i), 100, 100); + painter.drawRoundedRect(rects.at(i), 100, 100); } } diff --git a/src/widgets/panel/sidepanelwidget.cpp b/src/widgets/panel/sidepanelwidget.cpp index b39a2fb9..90ece87c 100644 --- a/src/widgets/panel/sidepanelwidget.cpp +++ b/src/widgets/panel/sidepanelwidget.cpp @@ -73,7 +73,7 @@ SidePanelWidget::SidePanelWidget(QPixmap *p, QWidget *parent) : connect(this, &SidePanelWidget::thicknessChanged, this, &SidePanelWidget::updateThickness); - QColor background = this->palette().background().color(); + QColor background = this->palette().window().color(); bool isDark = ColorUtils::colorIsDark(background); QString modifier = isDark ? PathInfo::whiteIconPath() : PathInfo::blackIconPath(); diff --git a/src/widgets/panel/utilitypanel.cpp b/src/widgets/panel/utilitypanel.cpp index 321a1308..97da5083 100644 --- a/src/widgets/panel/utilitypanel.cpp +++ b/src/widgets/panel/utilitypanel.cpp @@ -90,7 +90,7 @@ void UtilityPanel::initInternalPanel() { m_layout->addLayout(m_upLayout); widget->setLayout(m_layout); - QColor bgColor = palette().background().color(); + QColor bgColor = palette().window().color(); bgColor.setAlphaF(0.0); m_internalPanel->setStyleSheet(QStringLiteral("QScrollArea {background-color: %1}") .arg(bgColor.name()));