Commit b0078669 authored by Julius Künzel's avatar Julius Künzel
Browse files

Fix some compiler and CppCheck warnings

Recognized thanks to the new CI
parent 024e44d2
Pipeline #106293 passed with stage
in 5 minutes and 18 seconds
......@@ -697,9 +697,8 @@ void KeyframeView::paintEvent(QPaintEvent *event)
int base = int(tickOffset / frameSize);
tickOffset = frameSize - (tickOffset - (base * frameSize));
// Draw frame ticks
int scaledTick = 0;
for (int i = 0; i < maxWidth / frameSize; i++) {
scaledTick = int(m_offset + (i * frameSize) + tickOffset);
int scaledTick = int(m_offset + (i * frameSize) + tickOffset);
if (scaledTick >= maxWidth + m_offset) {
break;
}
......
......@@ -268,7 +268,7 @@ KdenliveDoc::~KdenliveDoc()
if (m_url.isEmpty()) {
// Document was never saved, delete cache folder
QString documentId = QDir::cleanPath(getDocumentProperty(QStringLiteral("documentid")));
bool ok;
bool ok = false;
documentId.toLongLong(&ok, 10);
if (ok && !documentId.isEmpty()) {
QDir baseCache = getCacheDir(CacheBase, &ok);
......@@ -1361,7 +1361,7 @@ void KdenliveDoc::loadDocumentProperties()
QDir dir(path);
dir.cdUp();
m_projectFolder = dir.absolutePath();
bool ok;
bool ok = false;
// Ensure document storage folder is writable
QString documentId = QDir::cleanPath(getDocumentProperty(QStringLiteral("documentid")));
documentId.toLongLong(&ok, 10);
......
......@@ -68,7 +68,7 @@ public:
Kdenlive::MonitorId id() { return m_id; }
~AbstractMonitor() override;
bool isActive() const;
virtual void mute(bool mute, bool updateIconOnly = false) = 0;
virtual void mute(bool mute) = 0;
public slots:
virtual void stop() = 0;
......
......@@ -546,8 +546,6 @@ void Monitor::slotGetCurrentImage(bool request)
if (request) {
slotActivateMonitor();
refreshMonitor(true);
}
if (request) {
// Update analysis state
QTimer::singleShot(500, m_monitorManager, &MonitorManager::checkScopes);
} else {
......@@ -1504,18 +1502,10 @@ void Monitor::stop()
m_glMonitor->stop();
}
void Monitor::mute(bool mute, bool updateIconOnly)
void Monitor::mute(bool mute)
{
// TODO: we should set the "audio_off" property to 1 to mute the consumer instead of changing volume
QIcon icon;
if (mute || KdenliveSettings::volume() == 0) {
icon = QIcon::fromTheme(QStringLiteral("audio-volume-muted"));
} else {
icon = QIcon::fromTheme(QStringLiteral("audio-volume-medium"));
}
if (!updateIconOnly) {
m_glMonitor->setVolume(mute ? 0 : KdenliveSettings::volume() / 100.0);
}
m_glMonitor->setVolume(mute ? 0 : KdenliveSettings::volume() / 100.0);
}
void Monitor::start()
......
......@@ -99,7 +99,7 @@ public:
void updateAudioForAnalysis();
void switchMonitorInfo(int code);
void restart();
void mute(bool, bool updateIconOnly = false) override;
void mute(bool) override;
/** @brief Returns the action displaying record toolbar */
QAction *recAction();
void refreshIcons();
......
......@@ -360,7 +360,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QStringList
if(file.isEmpty() || fileName.isEmpty()) {
continue;
}
QTreeWidgetItem *item = new QTreeWidgetItem(parentItem, QStringList() << file);
auto *item = new QTreeWidgetItem(parentItem, QStringList() << file);
if (isSlideshow) {
// we store each slideshow in a separate subdirectory
item->setData(0, Qt::UserRole, ix);
......@@ -528,8 +528,8 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap<QStrin
void ArchiveWidget::slotCheckSpace()
{
KDiskFreeSpaceInfo inf = KDiskFreeSpaceInfo::freeSpaceInfo(archive_url->url().toLocalFile());
KIO::filesize_t freeSize = inf.available();
QStorageInfo info(archive_url->url().toLocalFile());
auto freeSize = static_cast<KIO::filesize_t>(info.bytesAvailable());
if (freeSize > m_requestedSize) {
// everything is ok
buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
......
......@@ -48,13 +48,13 @@ const QString AbstractScopeWidget::directions[] = {QStringLiteral("North"), QStr
AbstractScopeWidget::AbstractScopeWidget(bool trackMouse, QWidget *parent)
: QWidget(parent)
, m_scopePalette(QPalette())
, m_mousePos(0, 0)
, m_semaphoreHUD(1)
, m_semaphoreScope(1)
, m_semaphoreBackground(1)
{
m_scopePalette = QPalette();
m_scopePalette.setBrush(QPalette::Window, QBrush(dark2));
m_scopePalette.setBrush(QPalette::Base, QBrush(dark));
m_scopePalette.setBrush(QPalette::Button, QBrush(dark));
......
......@@ -59,7 +59,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
const uint partH = wh - distBottom;
// Statistics
uchar minR = 255, minG = 255, minB = 255, maxR = 0, maxG = 0, maxB = 0, r, g, b;
uchar minR = 255, minG = 255, minB = 255, maxR = 0, maxG = 0, maxB = 0;
// Number of input pixels that will fall on one scope pixel.
// Must be a float because the acceleration factor can be high, leading to <1 expected px per px.
......@@ -79,9 +79,9 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
for (uint i = 0, x = 0; i < byteCount; i += stepsize) {
auto *col = reinterpret_cast<const QRgb *>(bits);
r = uchar(qRed(*col));
g = uchar(qGreen(*col));
b = uchar(qBlue(*col));
auto r = uchar(qRed(*col));
auto g = uchar(qGreen(*col));
auto b = uchar(qBlue(*col));
double dx = x * double(wPrediv);
......
......@@ -39,7 +39,7 @@ public:
/** @brief Give keyboard focus to timeline qml */
void focusTimeline();
/** @brief Initiate timeline clip context menu */
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *timelineRulerMenu, QMenu *guideMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu, QMenu *subtitleClipMenu);
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *guideMenu, QMenu *timelineRulerMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu, QMenu *subtitleClipMenu);
bool loading;
void connectSubtitleModel(bool firstConnect);
void unsetModel();
......
......@@ -232,11 +232,11 @@ void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
void MyTextItem::updateTW(bool enabled, int step, int mode, int sigma, int seed)
{
tw_enabled = enabled;
tw_step = step;
tw_mode = mode;
tw_sigma = sigma;
tw_seed = seed;
m_tw_enabled = enabled;
m_tw_step = step;
m_tw_mode = mode;
m_tw_sigma = sigma;
m_tw_seed = seed;
}
void MyTextItem::loadTW(const QStringList &info)
......@@ -251,9 +251,9 @@ void MyTextItem::loadTW(const QStringList &info)
QStringList MyTextItem::twInfo() const
{
QStringList info;
info << QString::number(tw_enabled) << QString::number(tw_step)
<< QString::number(tw_mode)
<< QString::number(tw_sigma) << QString::number(tw_seed);
info << QString::number(int(m_tw_enabled)) << QString::number(m_tw_step)
<< QString::number(m_tw_mode)
<< QString::number(m_tw_sigma) << QString::number(m_tw_seed);
return info;
}
......
......@@ -47,7 +47,7 @@ public:
void updateShadow(bool enabled, int blur, int xoffset, int yoffset, QColor color);
QStringList shadowInfo() const;
void loadShadow(const QStringList &info);
void updateTW(bool enabled, int mode, int step, int sigma, int seed);
void updateTW(bool enabled, int step, int mode, int sigma, int seed);
QStringList twInfo() const;
void loadTW(const QStringList &info);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt) override;
......@@ -67,11 +67,11 @@ private:
void updateShadow();
void blurShadow(QImage &image, int radius);
void refreshFormat();
bool tw_enabled;
int tw_step;
int tw_mode;
int tw_sigma;
int tw_seed;
bool m_tw_enabled;
int m_tw_step;
int m_tw_mode;
int m_tw_sigma;
int m_tw_seed;
public slots:
void updateGeometry(int, int, int);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment