Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/cli/commandlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ QString optionsToString(const QList<CommandOption>& options,
QStringLiteral(" ").repeated(size + 4).prepend("\n");
for (int i = 0; i < options.length(); ++i) {
result += QStringLiteral(" %1 %2\n")
.arg(dashedOptionList.at(i).leftJustified(size, ' '))
.arg(options.at(i).description().replace(
QLatin1String("\n"), linePadding));
.arg(dashedOptionList.at(i).leftJustified(size, ' '),
options.at(i).description().replace(
QLatin1String("\n"), linePadding));
}
if (!subcommands.isEmpty()) {
result += QLatin1String("\n");
Expand All @@ -69,8 +69,8 @@ QString optionsToString(const QList<CommandOption>& options,
}
for (const auto& subcommand : subcommands) {
result += QStringLiteral(" %1 %2\n")
.arg(subcommand.name().leftJustified(size, ' '))
.arg(subcommand.description());
.arg(subcommand.name().leftJustified(size, ' '),
subcommand.description());
}
return result;
}
Expand Down Expand Up @@ -142,8 +142,7 @@ bool CommandLineParser::processOptions(const QStringList& args,
}
err << QStringLiteral("the option '%1' is not a valid option "
"for the argument '%2'.")
.arg(arg)
.arg(argName);
.arg(arg, argName);
ok = false;
return ok;
}
Expand Down Expand Up @@ -329,9 +328,7 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
node->subNodes.isEmpty() ? "" : "[" + QObject::tr("subcommands") + "]";
helpText += (QObject::tr("Usage") + ": %1 [%2-" + QObject::tr("options") +
QStringLiteral("] %3\n\n"))
.arg(args.join(QStringLiteral(" ")))
.arg(argName)
.arg(argText);
.arg(args.join(QStringLiteral(" ")), argName, argText);

// short section about default behavior
helpText += QObject::tr("Per default runs Flameshot in the background and "
Expand Down
2 changes: 0 additions & 2 deletions src/core/flameshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@
QString path = req.path();

if (tasks & CR::PRINT_GEOMETRY) {
QByteArray byteArray;
QBuffer buffer(&byteArray);
QTextStream(stdout)
<< selection.width() << "x" << selection.height() << "+"
<< selection.x() << "+" << selection.y() << "\n";
Expand Down Expand Up @@ -403,7 +401,7 @@
widget->show();
widget->activateWindow();
// NOTE: lambda can't capture 'this' because it might be destroyed later
CR::ExportTask tasks = tasks;

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x64-portable

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x86-portable

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x86-installer

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x64-installer

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x86-installer

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x64-installer

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x64-portable

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]

Check warning on line 404 in src/core/flameshot.cpp

View workflow job for this annotation

GitHub Actions / VS 2019 x86-portable

uninitialized local variable 'tasks' used [C:\a\flameshot\flameshot\build\src\flameshot.vcxproj]
QObject::connect(
widget, &ImgUploaderBase::uploadOk, [=](const QUrl& url) {
if (ConfigHandler().copyURLAfterUpload()) {
Expand Down
3 changes: 1 addition & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,7 @@ int main(int argc, char* argv[])
QTextStream(stdout)
<< QStringLiteral("The new pattern is '%1'\n"
"Parsed pattern example: %2\n")
.arg(newFilename)
.arg(fh.parsedPattern());
.arg(newFilename, fh.parsedPattern());
}
if (tray) {
config.setDisabledTrayIcon(parser.value(trayOption) == "false");
Expand Down
2 changes: 1 addition & 1 deletion src/tools/circlecount/circlecounttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QIcon CircleCountTool::icon(const QColor& background, bool inEditor) const

QString CircleCountTool::info()
{
m_tempString = QString("%1 - %2").arg(name()).arg(count());
m_tempString = QString("%1 - %2").arg(name(), count());
return m_tempString;
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/launcher/applauncherwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ AppLauncherWidget::AppLauncherWidget(const QPixmap& p, QWidget* parent)
QStringList appsLocations =
QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);

for (auto appsLocation : appsLocations) {
for (const auto& appsLocation : appsLocations) {
QDir appsDir(appsLocation);
m_parser.processDirectory(QDir(appsDir));
}
Expand Down
6 changes: 3 additions & 3 deletions src/tools/text/textconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ TextConfig::TextConfig(QWidget* parent)
m_leftAlignButton->setCheckable(true);
m_leftAlignButton->setAutoExclusive(true);
connect(m_leftAlignButton, &QPushButton::clicked, this, [this] {
alignmentChanged(Qt::AlignLeft);
emit alignmentChanged(Qt::AlignLeft);
});
m_leftAlignButton->setToolTip(tr("Left Align"));

Expand All @@ -87,7 +87,7 @@ TextConfig::TextConfig(QWidget* parent)
m_centerAlignButton->setCheckable(true);
m_centerAlignButton->setAutoExclusive(true);
connect(m_centerAlignButton, &QPushButton::clicked, this, [this] {
alignmentChanged(Qt::AlignCenter);
emit alignmentChanged(Qt::AlignCenter);
});
m_centerAlignButton->setToolTip(tr("Center Align"));

Expand All @@ -96,7 +96,7 @@ TextConfig::TextConfig(QWidget* parent)
m_rightAlignButton->setCheckable(true);
m_rightAlignButton->setAutoExclusive(true);
connect(m_rightAlignButton, &QPushButton::clicked, this, [this] {
alignmentChanged(Qt::AlignRight);
emit alignmentChanged(Qt::AlignRight);
});
m_rightAlignButton->setToolTip(tr("Right Align"));

Expand Down
2 changes: 1 addition & 1 deletion src/tools/text/texttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ QString TextTool::name() const
QString TextTool::info()
{
if (m_text.length() > 0) {
m_tempString = QString("%1 - %2").arg(name()).arg(m_text.trimmed());
m_tempString = QString("%1 - %2").arg(name(), m_text.trimmed());
m_tempString = m_tempString.split("\n").at(0);
if (m_tempString.length() > MAX_INFO_LENGTH) {
m_tempString.truncate(MAX_INFO_LENGTH);
Expand Down
7 changes: 2 additions & 5 deletions src/utils/confighandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,7 @@ bool ConfigHandler::checkShortcutConflicts(AbstractLogger* log) const
reportedInLog.append(*key2);
*log << tr("Shortcut conflict: '%1' and '%2' "
"have the same shortcut: %3\n")
.arg(*key1)
.arg(*key2)
.arg(value1);
.arg(*key1, *key2, value1);
}
}
}
Expand Down Expand Up @@ -651,8 +649,7 @@ bool ConfigHandler::checkSemantics(AbstractLogger* log,
}
if (log != nullptr) {
*log << tr("Bad value in '%1'. Expected: %2\n")
.arg(key)
.arg(valueHandler->expected());
.arg(key, valueHandler->expected());
}
if (offenders != nullptr) {
offenders->append(key);
Expand Down
1 change: 0 additions & 1 deletion src/utils/screengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)

QRect ScreenGrabber::screenGeometry(QScreen* screen)
{
QPixmap p;
QRect geometry;
if (m_info.waylandDetected()) {
QPoint topLeft(0, 0);
Expand Down
5 changes: 2 additions & 3 deletions src/utils/valuehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ QVariant BoundedInt::fallback()

QString BoundedInt::expected()
{
return QStringLiteral("number between %1 and %2").arg(m_min).arg(m_max);
return QStringLiteral("number between %1 and %2").arg(m_min, m_max);
}

// LOWER BOUNDED INT
Expand Down Expand Up @@ -446,8 +446,7 @@ QString UserColors::expected()
{
return QStringLiteral(
"list of colors(min %1 and max %2) separated by comma")
.arg(m_min - 1)
.arg(m_max - 1);
.arg(m_min - 1, m_max - 1);
}

QVariant UserColors::representation(const QVariant& val)
Expand Down
8 changes: 4 additions & 4 deletions src/widgets/capture/capturebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ QString CaptureButton::styleSheet() const
// foreground color
QColor color = ColorUtils::colorIsDark(m_mainColor) ? Qt::white : Qt::black;

return baseSheet.arg(m_mainColor.name())
.arg(contrast.name())
.arg(GlobalValues::buttonBaseSize() / 2)
.arg(color.name());
return baseSheet.arg(m_mainColor.name(),
contrast.name(),
QString::number(GlobalValues::buttonBaseSize() / 2),
color.name());
}

void CaptureButton::setColor(const QColor& c)
Expand Down
20 changes: 10 additions & 10 deletions src/widgets/capture/capturewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ void CaptureWidget::initQuitPrompt()
"QLabel, QCheckBox { color: %2 }"
"QPushButton { background-color: %1; color: %2 }";
QColor text = ColorUtils::colorIsDark(m_uiColor) ? Qt::white : Qt::black;
QString styleSheet = baseSheet.arg(m_uiColor.name()).arg(text.name());
QString styleSheet = baseSheet.arg(m_uiColor.name(), text.name());

m_quitPrompt->setStyleSheet(styleSheet);
m_quitPrompt->setWindowTitle(tr("Quit Capture"));
Expand Down Expand Up @@ -591,11 +591,12 @@ void CaptureWidget::paintEvent(QPaintEvent* paintEvent)
QRect xybox;
QFontMetrics fm = painter.fontMetrics();

QString xy = QString("%1x%2+%3+%4")
.arg(static_cast<int>(selection.width() * scale))
.arg(static_cast<int>(selection.height() * scale))
.arg(static_cast<int>(selection.left() * scale))
.arg(static_cast<int>(selection.top() * scale));
QString xy =
QString("%1x%2+%3+%4")
.arg(QString::number(static_cast<int>(selection.width() * scale)),
QString::number(static_cast<int>(selection.height() * scale)),
QString::number(static_cast<int>(selection.left() * scale)),
QString::number(static_cast<int>(selection.top() * scale)));

xybox = fm.boundingRect(xy);
// the small numbers here are just margins so the text doesn't
Expand Down Expand Up @@ -1637,9 +1638,8 @@ void CaptureWidget::updateSizeIndicator()
}
if (m_sizeIndButton) {
const QRect& selection = extendedSelection();
m_sizeIndButton->setText(QStringLiteral("%1\n%2")
.arg(selection.width())
.arg(selection.height()));
m_sizeIndButton->setText(
QStringLiteral("%1\n%2").arg(selection.width(), selection.height()));
}
}

Expand Down Expand Up @@ -1744,7 +1744,7 @@ void CaptureWidget::drawToolsData(bool drawSelection)
// TODO refactor this for performance. The objects should not all be updated
// at once every time
QPixmap pixmapItem = m_context.origScreenshot;
for (auto toolItem : m_captureToolObjects.captureToolObjects()) {
for (const auto& toolItem : m_captureToolObjects.captureToolObjects()) {
processPixmapWithTool(&pixmapItem, toolItem);
update(paddedUpdateRect(toolItem->boundingRect()));
}
Expand Down
4 changes: 0 additions & 4 deletions src/widgets/capture/magnifierwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ void MagnifierWidget::drawMagnifierCircle(QPainter& painter)
drawPos.y() + magZoom * (-0.5),
magZoom * (m_magPixels),
magZoom);
QRectF crossHairBorder(drawPos.x() - magZoom * (m_magPixels + 0.5) - 1,
drawPos.y() - magZoom * (m_magPixels + 0.5) - 1,
m_pixels * magZoom + 2,
m_pixels * magZoom + 2);
const auto frag =
QPainter::PixmapFragment::create(drawPos, magniRect, magZoom, magZoom);

Expand Down
3 changes: 1 addition & 2 deletions src/widgets/capture/overlaymessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ QString OverlayMessage::compileFromKeyMap(
"<td align=\"right\"><b>%1 </b></td>"
"<td align=\"left\">&nbsp;&nbsp;%2</td>"
"</tr>")
.arg(pair.first)
.arg(pair.second);
.arg(pair.first, pair.second);
}
str += QStringLiteral("</table>");
return str;
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/imagelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void ImageLabel::setScreenshot(const QPixmap& pixmap)
{
m_pixmap = pixmap;
const QString tooltip =
QStringLiteral("%1x%2 px").arg(m_pixmap.width()).arg(m_pixmap.height());
QStringLiteral("%1x%2 px").arg(m_pixmap.width(), m_pixmap.height());
setToolTip(tooltip);
setScaledPixmap();
}
Expand Down
5 changes: 4 additions & 1 deletion src/widgets/infowindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ InfoWindow::InfoWindow(QWidget* parent)
ui->VersionDetails->setText(GlobalValues::versionInfo());
ui->OperatingSystemDetails->setText(generateKernelString());

connect(
ui->CopyInfoButton, &QPushButton::clicked, this, &InfoWindow::copyInfo);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
QRect position = frameGeometry();
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
Expand Down Expand Up @@ -50,7 +53,7 @@ QString generateKernelString()
return kernelVersion;
}

void InfoWindow::on_CopyInfoButton_clicked()
void InfoWindow::copyInfo()
{
FlameshotDaemon::copyToClipboard(GlobalValues::versionInfo() + "\n" +
generateKernelString());
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/infowindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class InfoWindow : public QWidget
void keyPressEvent(QKeyEvent* event);

private slots:
void on_CopyInfoButton_clicked();
void copyInfo();
};

QString generateKernelString();
Loading