mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Disable use of Qt APIs deprecated in 5.15.0 and earlier versions (#4133)
This commit is contained in:
parent
3303cdc0cb
commit
fbfa5e0f41
|
@ -111,6 +111,7 @@
|
|||
- Dev: Got rid of BaseTheme (#4132)
|
||||
- Dev: Removed official support for QMake. (#3839, #3883)
|
||||
- Dev: Rewrote LimitedQueue (#3798)
|
||||
- Dev: Set cmake `QT_DISABLE_DEPRECATED_BEFORE` to disable deprecated APIs up to Qt 5.15.0 (#4133)
|
||||
- Dev: Overhauled highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801, #3835)
|
||||
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
||||
- Dev: Batched checking live status for all channels after startup. (#3757, #3762, #3767)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
set(LIBRARY_PROJECT "${PROJECT_NAME}-lib")
|
||||
set(EXECUTABLE_PROJECT "${PROJECT_NAME}")
|
||||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)
|
||||
|
||||
set(SOURCE_FILES
|
||||
Application.cpp
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
namespace ipc = boost::interprocess;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <QProcess>
|
||||
# include <QSettings>
|
||||
|
||||
# include <Windows.h>
|
||||
# include "singletons/WindowManager.hpp"
|
||||
|
@ -98,9 +98,8 @@ void registerNmManifest(Paths &paths, const QString &manifestFilename,
|
|||
file.flush();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// clang-format off
|
||||
QProcess::execute("REG ADD \"" + registryKeyName + "\" /ve /t REG_SZ /d \"" + manifestPath + "\" /f");
|
||||
// clang-format on
|
||||
QSettings registry(registryKeyName, QSettings::NativeFormat);
|
||||
registry.setValue("Default", manifestPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -179,10 +179,10 @@ void Updates::installUpdates()
|
|||
})
|
||||
.onSuccess([this](auto result) -> Outcome {
|
||||
QByteArray object = result.getData();
|
||||
auto filename =
|
||||
auto filePath =
|
||||
combinePath(getPaths()->miscDirectory, "Update.exe");
|
||||
|
||||
QFile file(filename);
|
||||
QFile file(filePath);
|
||||
file.open(QIODevice::Truncate | QIODevice::WriteOnly);
|
||||
|
||||
if (file.write(object) == -1)
|
||||
|
@ -203,7 +203,7 @@ void Updates::installUpdates()
|
|||
file.flush();
|
||||
file.close();
|
||||
|
||||
if (QProcess::startDetached(filename))
|
||||
if (QProcess::startDetached(filePath, {}))
|
||||
{
|
||||
QApplication::exit(0);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ void LoggingChannel::addMessage(MessagePtr message)
|
|||
|
||||
QString LoggingChannel::generateOpeningString(const QDateTime &now) const
|
||||
{
|
||||
QString ret = QLatin1Literal("# Start logging at ");
|
||||
QString ret("# Start logging at ");
|
||||
|
||||
ret.append(now.toString("yyyy-MM-dd HH:mm:ss "));
|
||||
ret.append(now.timeZoneAbbreviation());
|
||||
|
@ -120,7 +120,7 @@ QString LoggingChannel::generateOpeningString(const QDateTime &now) const
|
|||
|
||||
QString LoggingChannel::generateClosingString(const QDateTime &now) const
|
||||
{
|
||||
QString ret = QLatin1Literal("# Stop logging at ");
|
||||
QString ret("# Stop logging at ");
|
||||
|
||||
ret.append(now.toString("yyyy-MM-dd HH:mm:ss"));
|
||||
ret.append(now.timeZoneAbbreviation());
|
||||
|
|
|
@ -90,7 +90,8 @@ bool openLinkIncognito(const QString &link)
|
|||
#ifdef Q_OS_WIN
|
||||
auto command = getCommand(link);
|
||||
|
||||
return QProcess::startDetached(command);
|
||||
// TODO: split command into program path and incognito argument
|
||||
return QProcess::startDetached(command, {});
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,7 @@ AttachedWindow::AttachedWindow(void *_target, int _yOffset)
|
|||
, yOffset_(_yOffset)
|
||||
{
|
||||
QLayout *layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
this->setLayout(layout);
|
||||
|
||||
auto *split = new Split(this);
|
||||
|
|
|
@ -144,7 +144,7 @@ void BaseWindow::init()
|
|||
{
|
||||
QHBoxLayout *buttonLayout = this->ui_.titlebarBox =
|
||||
new QHBoxLayout();
|
||||
buttonLayout->setMargin(0);
|
||||
buttonLayout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(buttonLayout);
|
||||
|
||||
// title
|
||||
|
@ -343,14 +343,15 @@ bool BaseWindow::event(QEvent *event)
|
|||
|
||||
void BaseWindow::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (event->orientation() != Qt::Vertical)
|
||||
// ignore horizontal mouse wheels
|
||||
if (event->angleDelta().x() != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->modifiers() & Qt::ControlModifier)
|
||||
{
|
||||
if (event->delta() > 0)
|
||||
if (event->angleDelta().y() > 0)
|
||||
{
|
||||
getSettings()->setClampedUiScale(
|
||||
getSettings()->getClampedUiScale() + 0.1);
|
||||
|
|
|
@ -29,7 +29,7 @@ StreamView::StreamView(ChannelPtr channel, const QUrl &url)
|
|||
chat->setChannel(std::move(channel));
|
||||
|
||||
this->layout()->setSpacing(0);
|
||||
this->layout()->setMargin(0);
|
||||
this->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -153,7 +153,7 @@ void Window::addLayout()
|
|||
this->getLayoutContainer()->setLayout(layout);
|
||||
|
||||
// set margin
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
this->notebook_->setAllowUserTabManagement(true);
|
||||
this->notebook_->setShowAddButton(true);
|
||||
|
|
|
@ -167,11 +167,11 @@ EmotePopup::EmotePopup(QWidget *parent)
|
|||
QRegularExpression searchRegex("\\S*");
|
||||
searchRegex.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
QHBoxLayout *layout2 = new QHBoxLayout(this);
|
||||
layout2->setMargin(8);
|
||||
layout2->setContentsMargins(8, 8, 8, 8);
|
||||
layout2->setSpacing(8);
|
||||
|
||||
this->search_ = new QLineEdit();
|
||||
|
@ -214,7 +214,7 @@ EmotePopup::EmotePopup(QWidget *parent)
|
|||
|
||||
this->notebook_ = new Notebook(this);
|
||||
layout->addWidget(this->notebook_);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
this->subEmotesView_ = makeView("Subs");
|
||||
this->channelEmotesView_ = makeView("Channel");
|
||||
|
|
|
@ -32,8 +32,7 @@ void NotificationPopup::updatePosition()
|
|||
{
|
||||
Location location = BottomRight;
|
||||
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
const QRect rect = desktop->availableGeometry();
|
||||
const QRect rect = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
|
||||
switch (location)
|
||||
{
|
||||
|
|
|
@ -90,7 +90,8 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
|
|||
|
||||
layout->setSpacing(0);
|
||||
// provide draggable margin if frameless
|
||||
layout->setMargin(closeAutomatically ? 15 : 1);
|
||||
auto marginPx = closeAutomatically ? 15 : 1;
|
||||
layout->setContentsMargins(marginPx, marginPx, marginPx, marginPx);
|
||||
layout->addWidget(this->ui_.threadView, 1);
|
||||
layout->addWidget(this->ui_.replyInput);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void SettingsDialog::initUi()
|
|||
.assign(&this->ui_.pageStack)
|
||||
.withoutMargin();
|
||||
|
||||
this->ui_.pageStack->setMargin(0);
|
||||
this->ui_.pageStack->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
outerBox->addSpacing(12);
|
||||
|
||||
|
@ -193,9 +193,7 @@ void SettingsDialog::filterElements(const QString &text)
|
|||
|
||||
void SettingsDialog::addTabs()
|
||||
{
|
||||
this->ui_.tabContainer->setMargin(0);
|
||||
this->ui_.tabContainer->setSpacing(0);
|
||||
|
||||
this->ui_.tabContainer->setContentsMargins(0, 20, 0, 20);
|
||||
|
||||
// Constructors are wrapped in std::function to remove some strain from first time loading.
|
||||
|
|
|
@ -29,7 +29,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
|||
|
||||
// create layout
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
vbox->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// create button layout
|
||||
QHBoxLayout *buttons = new QHBoxLayout(this);
|
||||
|
|
|
@ -13,7 +13,7 @@ EffectLabel::EffectLabel(BaseWidget *parent, int spacing)
|
|||
|
||||
this->label_.setAlignment(Qt::AlignCenter);
|
||||
|
||||
this->hbox_.setMargin(0);
|
||||
this->hbox_.setContentsMargins(0, 0, 0, 0);
|
||||
this->hbox_.addSpacing(spacing);
|
||||
this->hbox_.addWidget(&this->label_);
|
||||
this->hbox_.addSpacing(spacing);
|
||||
|
@ -29,7 +29,7 @@ EffectLabel2::EffectLabel2(BaseWidget *parent, int padding)
|
|||
// this->label_.setAlignment(Qt::AlignCenter);
|
||||
this->label_.setCentered(true);
|
||||
|
||||
hbox->setMargin(0);
|
||||
hbox->setContentsMargins(0, 0, 0, 0);
|
||||
// hbox.addSpacing(spacing);
|
||||
hbox->addWidget(&this->label_);
|
||||
// hbox.addSpacing(spacing);
|
||||
|
|
|
@ -248,13 +248,13 @@ void SearchPopup::initLayout()
|
|||
// VBOX
|
||||
{
|
||||
auto *layout1 = new QVBoxLayout(this);
|
||||
layout1->setMargin(0);
|
||||
layout1->setContentsMargins(0, 0, 0, 0);
|
||||
layout1->setSpacing(0);
|
||||
|
||||
// HBOX
|
||||
{
|
||||
auto *layout2 = new QHBoxLayout(this);
|
||||
layout2->setMargin(8);
|
||||
layout2->setContentsMargins(8, 8, 8, 8);
|
||||
layout2->setSpacing(8);
|
||||
|
||||
// SEARCH INPUT
|
||||
|
|
|
@ -96,7 +96,7 @@ Split::Split(QWidget *parent)
|
|||
this->setFocusProxy(this->input_->ui_.textEdit);
|
||||
|
||||
this->vbox_->setSpacing(0);
|
||||
this->vbox_->setMargin(1);
|
||||
this->vbox_->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
this->vbox_->addWidget(this->header_);
|
||||
this->vbox_->addWidget(this->view_, 1);
|
||||
|
|
|
@ -330,7 +330,7 @@ void SplitHeader::initializeLayout()
|
|||
},
|
||||
this->managedConnections_);
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
this->setLayout(layout);
|
||||
|
||||
|
|
|
@ -209,9 +209,8 @@ void SplitInput::themeChangedEvent()
|
|||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
this->ui_.textEdit->setPalette(placeholderPalette);
|
||||
#endif
|
||||
|
||||
this->ui_.vbox->setMargin(
|
||||
int((this->theme->isLightTheme() ? 4 : 2) * this->scale()));
|
||||
auto marginPx = (this->theme->isLightTheme() ? 4 : 2) * this->scale();
|
||||
this->ui_.vbox->setContentsMargins(marginPx, marginPx, marginPx, marginPx);
|
||||
|
||||
this->ui_.emoteButton->getLabel().setStyleSheet("color: #000");
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ SplitOverlay::SplitOverlay(Split *parent)
|
|||
{
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
this->layout_ = layout;
|
||||
layout->setMargin(1);
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
layout->setSpacing(1);
|
||||
|
||||
layout->setRowStretch(1, 1);
|
||||
|
|
Loading…
Reference in a new issue