mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
Fix compiler warnings (#4023)
* Fix unused return value * Fix deprecated operator+ * Fix truncation from double to float * Fix unreferenced local variable * Use qWarning instead of AbstractLogger, because AbstractLogger creates a popup which could be annoying for missing translation messages.
This commit is contained in:
@@ -130,7 +130,7 @@ void ShortcutsWidget::onShortcutCellClicked(int row, int col)
|
|||||||
|
|
||||||
// set no shortcut is Backspace
|
// set no shortcut is Backspace
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
if (shortcutValue == QKeySequence(Qt::CTRL + Qt::Key_Backspace)) {
|
if (shortcutValue == QKeySequence(Qt::CTRL | Qt::Key_Backspace)) {
|
||||||
shortcutValue = QKeySequence("");
|
shortcutValue = QKeySequence("");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
31
src/main.cpp
31
src/main.cpp
@@ -88,21 +88,34 @@ void configureApp(bool gui)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool foundTranslation;
|
||||||
// Configure translations
|
// Configure translations
|
||||||
for (const QString& path : PathInfo::translationsPaths()) {
|
for (const QString& path : PathInfo::translationsPaths()) {
|
||||||
bool match = translator.load(QLocale(),
|
foundTranslation =
|
||||||
QStringLiteral("Internationalization"),
|
translator.load(QLocale(),
|
||||||
QStringLiteral("_"),
|
QStringLiteral("Internationalization"),
|
||||||
path);
|
QStringLiteral("_"),
|
||||||
if (match) {
|
path);
|
||||||
|
if (foundTranslation) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!foundTranslation) {
|
||||||
|
QLocale l;
|
||||||
|
qWarning() << QStringLiteral("No Flameshot translation found for %1")
|
||||||
|
.arg(l.uiLanguages().join(", "));
|
||||||
|
}
|
||||||
|
|
||||||
qtTranslator.load(QLocale::system(),
|
foundTranslation =
|
||||||
"qt",
|
qtTranslator.load(QLocale::system(),
|
||||||
"_",
|
"qt",
|
||||||
QLibraryInfo::path(QLibraryInfo::TranslationsPath));
|
"_",
|
||||||
|
QLibraryInfo::path(QLibraryInfo::TranslationsPath));
|
||||||
|
if (!foundTranslation) {
|
||||||
|
qWarning() << QStringLiteral("No Qt translation found for %1")
|
||||||
|
.arg(QLocale::languageToString(
|
||||||
|
QLocale::system().language()));
|
||||||
|
}
|
||||||
|
|
||||||
auto app = QCoreApplication::instance();
|
auto app = QCoreApplication::instance();
|
||||||
app->installTranslator(&translator);
|
app->installTranslator(&translator);
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ bool ConfigHandler::setShortcut(const QString& actionName,
|
|||||||
qDebug() << actionName;
|
qDebug() << actionName;
|
||||||
static QVector<QKeySequence> reservedShortcuts = {
|
static QVector<QKeySequence> reservedShortcuts = {
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
Qt::CTRL + Qt::Key_Backspace,
|
Qt::CTRL | Qt::Key_Backspace,
|
||||||
Qt::Key_Escape,
|
Qt::Key_Escape,
|
||||||
#else
|
#else
|
||||||
Qt::Key_Backspace,
|
Qt::Key_Backspace,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ FileNameHandler::FileNameHandler(QObject* parent)
|
|||||||
auto err = AbstractLogger::error(AbstractLogger::Stderr);
|
auto err = AbstractLogger::error(AbstractLogger::Stderr);
|
||||||
try {
|
try {
|
||||||
std::locale::global(std::locale());
|
std::locale::global(std::locale());
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception&) {
|
||||||
err << "Locales on your system are not properly configured. Falling "
|
err << "Locales on your system are not properly configured. Falling "
|
||||||
"back to defaults";
|
"back to defaults";
|
||||||
|
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ void ColorPickerWidget::repaint(int i, QPainter& painter)
|
|||||||
int nSteps = lastRect.height() / nStep;
|
int nSteps = lastRect.height() / nStep;
|
||||||
// 0.02 - start rainbow color, 0.33 - end rainbow color from range:
|
// 0.02 - start rainbow color, 0.33 - end rainbow color from range:
|
||||||
// 0.0 - 1.0
|
// 0.0 - 1.0
|
||||||
float h = 0.02;
|
float h = 0.02f;
|
||||||
for (int radius = nSteps; radius > 0; radius -= nStep * 2) {
|
for (int radius = nSteps; radius > 0; radius -= nStep * 2) {
|
||||||
// calculate color
|
// calculate color
|
||||||
float fHStep = (0.33 - h) / (nSteps / nStep / 2);
|
float fHStep = (0.33 - h) / (nSteps / nStep / 2);
|
||||||
QColor color = QColor::fromHslF(h, 0.95, 0.5);
|
QColor color = QColor::fromHslF(h, 0.95f, 0.5f);
|
||||||
|
|
||||||
// set color and draw circle
|
// set color and draw circle
|
||||||
painter.setPen(color);
|
painter.setPen(color);
|
||||||
|
|||||||
Reference in New Issue
Block a user