mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
all: fix gcc warnings and lints
This commit is contained in:
parent
b254f6dabc
commit
e10747addd
11 changed files with 42 additions and 16 deletions
3
Justfile
3
Justfile
|
|
@ -12,6 +12,9 @@ lint-ci:
|
|||
lint-changed:
|
||||
git diff --name-only HEAD | grep "^.*\.cpp\$" | parallel -j$(nproc) --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
|
||||
|
||||
lint-staged:
|
||||
git diff --staged --name-only HEAD | grep "^.*\.cpp\$" | parallel -j$(nproc) --no-notice --will-cite --tty --bar clang-tidy --load={{ env_var("TIDYFOX") }}
|
||||
|
||||
configure target='debug' *FLAGS='':
|
||||
cmake -GNinja -B {{builddir}} \
|
||||
-DCMAKE_BUILD_TYPE={{ if target == "debug" { "Debug" } else { "RelWithDebInfo" } }} \
|
||||
|
|
|
|||
|
|
@ -313,8 +313,12 @@ void ThreadLogging::init() {
|
|||
|
||||
if (logMfd != -1) {
|
||||
this->file = new QFile();
|
||||
this->file->open(logMfd, QFile::ReadWrite, QFile::AutoCloseHandle);
|
||||
this->fileStream.setDevice(this->file);
|
||||
|
||||
if (this->file->open(logMfd, QFile::ReadWrite, QFile::AutoCloseHandle)) {
|
||||
this->fileStream.setDevice(this->file);
|
||||
} else {
|
||||
qCCritical(logLogging) << "Failed to open early logging memfd.";
|
||||
}
|
||||
}
|
||||
|
||||
if (dlogMfd != -1) {
|
||||
|
|
@ -322,14 +326,19 @@ void ThreadLogging::init() {
|
|||
|
||||
this->detailedFile = new QFile();
|
||||
// buffered by WriteBuffer
|
||||
this->detailedFile->open(dlogMfd, QFile::ReadWrite | QFile::Unbuffered, QFile::AutoCloseHandle);
|
||||
this->detailedWriter.setDevice(this->detailedFile);
|
||||
if (this->detailedFile
|
||||
->open(dlogMfd, QFile::ReadWrite | QFile::Unbuffered, QFile::AutoCloseHandle))
|
||||
{
|
||||
this->detailedWriter.setDevice(this->detailedFile);
|
||||
|
||||
if (!this->detailedWriter.writeHeader()) {
|
||||
qCCritical(logLogging) << "Could not write header for detailed logs.";
|
||||
this->detailedWriter.setDevice(nullptr);
|
||||
delete this->detailedFile;
|
||||
this->detailedFile = nullptr;
|
||||
if (!this->detailedWriter.writeHeader()) {
|
||||
qCCritical(logLogging) << "Could not write header for detailed logs.";
|
||||
this->detailedWriter.setDevice(nullptr);
|
||||
delete this->detailedFile;
|
||||
this->detailedFile = nullptr;
|
||||
}
|
||||
} else {
|
||||
qCCritical(logLogging) << "Failed to open early detailed logging memfd.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,11 @@ void CrashHandler::setRelaunchInfo(const RelaunchInfo& info) {
|
|||
}
|
||||
|
||||
QFile file;
|
||||
file.open(this->d->infoFd, QFile::ReadWrite);
|
||||
|
||||
if (!file.open(this->d->infoFd, QFile::ReadWrite)) {
|
||||
qCCritical(logCrashHandler
|
||||
) << "Failed to open instance info memfd, crash recovery will not work.";
|
||||
}
|
||||
|
||||
QDataStream ds(&file);
|
||||
ds << info;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,10 @@ void qsCheckCrash(int argc, char** argv) {
|
|||
auto infoFd = qEnvironmentVariable("__QUICKSHELL_CRASH_INFO_FD").toInt();
|
||||
|
||||
QFile file;
|
||||
file.open(infoFd, QFile::ReadOnly, QFile::AutoCloseHandle);
|
||||
if (!file.open(infoFd, QFile::ReadOnly, QFile::AutoCloseHandle)) {
|
||||
qFatal() << "Failed to open instance info fd.";
|
||||
}
|
||||
|
||||
file.seek(0);
|
||||
|
||||
auto ds = QDataStream(&file);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ void checkCrashRelaunch(char** argv, QCoreApplication* coreApplication) {
|
|||
auto lastInfoFd = lastInfoFdStr.toInt();
|
||||
|
||||
QFile file;
|
||||
file.open(lastInfoFd, QFile::ReadOnly, QFile::AutoCloseHandle);
|
||||
if (!file.open(lastInfoFd, QFile::ReadOnly, QFile::AutoCloseHandle)) {
|
||||
qFatal() << "Failed to open crash info fd. Cannot restart.";
|
||||
}
|
||||
|
||||
file.seek(0);
|
||||
|
||||
auto ds = QDataStream(&file);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ MprisPlayer::MprisPlayer(const QString& address, QObject* parent): QObject(paren
|
|||
} else return static_cast<qlonglong>(-1);
|
||||
});
|
||||
|
||||
this->bLengthSupported.setBinding([this]() { return this->bInternalLength != -1; });
|
||||
this->bLengthSupported.setBinding([this]() { return this->bInternalLength.value() != -1; });
|
||||
|
||||
this->bIsPlaying.setBinding([this]() {
|
||||
return this->bPlaybackState == MprisPlaybackState::Playing;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ UPowerDevice::UPowerDevice(QObject* parent): QObject(parent) {
|
|||
return this->bType == UPowerDeviceType::Battery && this->bPowerSupply;
|
||||
});
|
||||
|
||||
this->bHealthSupported.setBinding([this]() { return this->bHealthPercentage != 0; });
|
||||
this->bHealthSupported.setBinding([this]() { return this->bHealthPercentage.value() != 0; });
|
||||
}
|
||||
|
||||
void UPowerDevice::init(const QString& path) {
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ QString DBusDataTransform<PowerProfile::Enum>::toWire(Data data) {
|
|||
case PowerProfile::PowerSaver: return QStringLiteral("power-saver");
|
||||
case PowerProfile::Balanced: return QStringLiteral("balanced");
|
||||
case PowerProfile::Performance: return QStringLiteral("performance");
|
||||
default: qFatal() << "Attempted to convert invalid power profile" << data << "to wire format.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ WlrLayershell::WlrLayershell(QObject* parent): ProxyWindowBase(parent) {
|
|||
case Qt::BottomEdge: return this->bImplicitHeight + margins.top;
|
||||
case Qt::LeftEdge: return this->bImplicitWidth + margins.right;
|
||||
case Qt::RightEdge: return this->bImplicitWidth + margins.left;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
this->bcExclusionEdge.setBinding([this] { return this->bAnchors.value().exclusionEdge(); });
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ QString I3IpcEvent::eventToString(EventCode event) {
|
|||
case EventCode::BarStateUpdate: return "bar_state_update"; break;
|
||||
case EventCode::Input: return "input"; break;
|
||||
|
||||
case EventCode::Unknown: return "unknown"; break;
|
||||
default: return "unknown"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ XPanelWindow::XPanelWindow(QObject* parent): ProxyWindowBase(parent) {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
this->bcExclusionEdge.setBinding([this] { return this->bAnchors.value().exclusionEdge(); });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue