Commit 25c924be authored by Laurent Montel's avatar Laurent Montel 😁

Fix indent, use const'ref, use explicit when necessary

parent 9999e7e3
......@@ -70,7 +70,6 @@ UnicodeWidget::UnicodeWidget(UnicodeDialog::InputMethod inputMeth, QWidget *pare
arrowDown->setToolTip(i18n("Next Unicode character (Arrow Down)"));
unicodeNumber->setToolTip(i18n("Enter your Unicode number here. Allowed characters: [0-9] and [a-f]."));
unicodeNumber->selectAll(); // Selection will be reset by setToolTip and similar, so set it here
}
UnicodeWidget::~UnicodeWidget()
......@@ -123,7 +122,7 @@ bool UnicodeWidget::controlCharacter(uint value)
QString UnicodeWidget::trimmedUnicodeNumber(QString text)
{
while (text.length() > 0 && text.at(0) == QChar('0')) {
while (!text.isEmpty() && text.at(0) == QChar('0')) {
text = text.remove(0, 1);
}
return text;
......
......@@ -360,7 +360,7 @@ void Wizard::checkMltComponents()
result << QString(formats.get(i));
m_mltCheck.formats_list->addItems(result);
KdenliveSettings::setSupportedformats(result);
checkMissingCodecs();
checkMissingCodecs();
delete consumer;
}
......@@ -428,24 +428,24 @@ void Wizard::checkMissingCodecs()
QStringList requiredACodecs;
QStringList requiredVCodecs;
foreach(const QString &filename, fileList) {
QDomDocument doc;
QFile file(exportFolder + filename);
doc.setContent(&file, false);
file.close();
QString std;
QString format;
QDomNodeList profiles = doc.elementsByTagName("profile");
for (int i = 0; i < profiles.count(); ++i) {
std = profiles.at(i).toElement().attribute("args");
format.clear();
QDomDocument doc;
QFile file(exportFolder + filename);
doc.setContent(&file, false);
file.close();
QString std;
QString format;
QDomNodeList profiles = doc.elementsByTagName("profile");
for (int i = 0; i < profiles.count(); ++i) {
std = profiles.at(i).toElement().attribute("args");
format.clear();
if (std.startsWith("acodec=")) format = std.section("acodec=", 1, 1);
else if (std.contains(" acodec=")) format = std.section(" acodec=", 1, 1);
else if (std.contains(" acodec=")) format = std.section(" acodec=", 1, 1);
if (!format.isEmpty()) requiredACodecs << format.section(' ', 0, 0).toLower();
format.clear();
format.clear();
if (std.startsWith("vcodec=")) format = std.section("vcodec=", 1, 1);
else if (std.contains(" vcodec=")) format = std.section(" vcodec=", 1, 1);
else if (std.contains(" vcodec=")) format = std.section(" vcodec=", 1, 1);
if (!format.isEmpty()) requiredVCodecs << format.section(' ', 0, 0).toLower();
}
}
}
requiredACodecs.removeDuplicates();
requiredVCodecs.removeDuplicates();
......@@ -453,38 +453,38 @@ void Wizard::checkMissingCodecs()
if (replaceLibfaacCodec) requiredACodecs.replaceInStrings("aac", "libfaac");
for (int i = 0; i < acodecsList.count(); ++i)
requiredACodecs.removeAll(acodecsList.at(i));
requiredACodecs.removeAll(acodecsList.at(i));
for (int i = 0; i < vcodecsList.count(); ++i)
requiredVCodecs.removeAll(vcodecsList.at(i));
requiredVCodecs.removeAll(vcodecsList.at(i));
if (!requiredACodecs.isEmpty() || !requiredVCodecs.isEmpty()) {
QString missing = requiredACodecs.join(",");
if (!missing.isEmpty() && !requiredVCodecs.isEmpty()) missing.append(',');
missing.append(requiredVCodecs.join(","));
missing.prepend(i18n("The following codecs were not found on your system. Check our <a href=''>online manual</a> if you need them: "));
// Some codecs required for rendering are not present on this system, warn user
show();
QString missing = requiredACodecs.join(",");
if (!missing.isEmpty() && !requiredVCodecs.isEmpty()) missing.append(',');
missing.append(requiredVCodecs.join(","));
missing.prepend(i18n("The following codecs were not found on your system. Check our <a href=''>online manual</a> if you need them: "));
// Some codecs required for rendering are not present on this system, warn user
show();
#if KDE_IS_VERSION(4,7,0)
KMessageWidget *infoMessage = new KMessageWidget(this);
m_startLayout->insertWidget(1, infoMessage);
infoMessage->setCloseButtonVisible(false);
infoMessage->setWordWrap(true);
infoMessage->setMessageType(KMessageWidget::Warning);
infoMessage->setMessageType(KMessageWidget::Warning);
#if KDE_IS_VERSION(4,10,0)
connect(infoMessage, SIGNAL(linkActivated(QString)), this, SLOT(slotOpenManual()));
infoMessage->setText(missing);
connect(infoMessage, SIGNAL(linkActivated(QString)), this, SLOT(slotOpenManual()));
infoMessage->setText(missing);
#else
// clickable text in kmessagewidget only available since KDE 4.10
// remove link from text
missing.remove(QRegExp("<[^>]*>"));
// clickable text in kmessagewidget only available since KDE 4.10
// remove link from text
missing.remove(QRegExp("<[^>]*>"));
infoMessage->setText(missing);
QAction *manualAction = new QAction(i18n("Check online manual"), this);
connect(manualAction, SIGNAL(triggered()), this, SLOT(slotOpenManual()));
infoMessage->addAction(manualAction);
QAction *manualAction = new QAction(i18n("Check online manual"), this);
connect(manualAction, SIGNAL(triggered()), this, SLOT(slotOpenManual()));
infoMessage->addAction(manualAction);
#endif
infoMessage->animatedShow();
#else
m_welcomeLabel->setText(m_welcomeLabel->text() + "<br><hr />" + missing);
connect(m_welcomeLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotOpenManual()));
m_welcomeLabel->setText(m_welcomeLabel->text() + "<br><hr />" + missing);
connect(m_welcomeLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotOpenManual()));
#endif
}
......@@ -503,14 +503,14 @@ void Wizard::slotCheckPrograms()
QString playpath = KStandardDirs::findExe("ffplay");
item->setIcon(0, m_okIcon);
if (exepath.isEmpty()) {
// Check for libav version
exepath = KStandardDirs::findExe("avconv");
if (exepath.isEmpty()) item->setIcon(0, m_badIcon);
// Check for libav version
exepath = KStandardDirs::findExe("avconv");
if (exepath.isEmpty()) item->setIcon(0, m_badIcon);
}
if (playpath.isEmpty()) {
// Check for libav version
playpath = KStandardDirs::findExe("avplay");
if (playpath.isEmpty()) item->setIcon(0, m_badIcon);
// Check for libav version
playpath = KStandardDirs::findExe("avplay");
if (playpath.isEmpty()) item->setIcon(0, m_badIcon);
}
if (!exepath.isEmpty()) KdenliveSettings::setFfmpegpath(exepath);
if (!playpath.isEmpty()) KdenliveSettings::setFfplaypath(playpath);
......@@ -544,11 +544,11 @@ void Wizard::slotCheckPrograms()
item->setData(1, Qt::UserRole, i18n("Required to preview your DVD"));
item->setSizeHint(0, itemSize);
if (KStandardDirs::findExe("xine").isEmpty()) {
if (!KStandardDirs::findExe("vlc").isEmpty()) {
item->setText(1, i18n("vlc"));
item->setIcon(0, m_okIcon);
}
else item->setIcon(0, m_badIcon);
if (!KStandardDirs::findExe("vlc").isEmpty()) {
item->setText(1, i18n("vlc"));
item->setIcon(0, m_okIcon);
}
else item->setIcon(0, m_badIcon);
}
else item->setIcon(0, m_okIcon);
......@@ -571,15 +571,15 @@ void Wizard::slotCheckPrograms()
}
}
void Wizard::installExtraMimes(QString baseName, QStringList globs)
void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs)
{
QString mimefile = baseName;
mimefile.replace('/', '-');
KMimeType::Ptr mime = KMimeType::mimeType(baseName);
QStringList missingGlobs;
foreach(const QString & glob, globs) {
KMimeType::Ptr type = KMimeType::findByPath(glob, 0, true);
QString mimeName = type->name();
KMimeType::Ptr type = KMimeType::findByPath(glob, 0, true);
QString mimeName = type->name();
if (!mimeName.contains("audio") && !mimeName.contains("video")) missingGlobs << glob;
}
if (missingGlobs.isEmpty()) return;
......@@ -709,7 +709,7 @@ void Wizard::adjustSettings()
{
if (m_extra.installmimes->isChecked()) {
QStringList globs;
globs << "*.mts" << "*.m2t" << "*.mod" << "*.ts" << "*.m2ts" << "*.m2v";
installExtraMimes("video/mpeg", globs);
globs.clear();
......
......@@ -38,20 +38,22 @@
class WizardDelegate: public QItemDelegate
{
public:
WizardDelegate(QAbstractItemView* parent = 0): QItemDelegate(parent) {
explicit WizardDelegate(QAbstractItemView* parent = 0)
: QItemDelegate(parent)
{
}
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
if (index.column() == 1) {
painter->save();
QStyleOptionViewItemV4 opt(option);
QStyleOptionViewItemV4 opt(option);
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
QFont font = painter->font();
font.setBold(true);
painter->setFont(font);
QRect r1 = option.rect;
QRect r1 = option.rect;
r1.adjust(0, textMargin, 0, - textMargin);
int mid = (int)((r1.height() / 2));
r1.setBottom(r1.y() + mid);
......@@ -75,7 +77,7 @@ class Wizard : public QWizard
Q_OBJECT
public:
explicit Wizard(bool upgrade, QWidget * parent = 0);
void installExtraMimes(QString baseName, QStringList globs);
void installExtraMimes(const QString &baseName, const QStringList &globs);
void runUpdateMimeDatabase();
void adjustSettings();
bool isOk() const;
......
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