}
case MPV_EVENT_FILE_LOADED:
+ // Add separate audiofile if there is any
+ if (!audioFileToAdd.isEmpty())
+ {
+ const QByteArray audioUtf8 = audioFileToAdd.toUtf8();
+ const char *args2[] = {"audio-add", audioUtf8.constData(), nullptr};
+ sendCommand(args2);
+ audioFileToAdd.clear();
+ }
setState(Media::PlayingState);
break;
const char *args[] = {"loadfile", fileUtf8.constData(), nullptr};
sendCommand(args);
- qApp->processEvents();
-
- const QByteArray audioUtf8 = audio.toUtf8();
- const char *args2[] = {"audio-add", audioUtf8.constData(), nullptr};
- sendCommand(args2);
+ // We are playing audio as separate file. The add audio command must executed when the main file is loaded
+ // Otherwise the audio file doesn't gets played
+ audioFileToAdd = audio;
+ qApp->processEvents();
clearTrackState();
}
}
void MediaMPV::play(const QString &file) {
+ audioFileToAdd.clear();
+
const QByteArray fileUtf8 = file.toUtf8();
const char *args[] = {"loadfile", fileUtf8.constData(), nullptr};
sendCommand(args);
}
void MediaMPV::enqueue(const QString &file) {
+ audioFileToAdd.clear();
const QByteArray fileUtf8 = file.toUtf8();
const char *args[] = {"loadfile", fileUtf8.constData(), "append", nullptr};
sendCommand(args);
Media::State currentState = Media::StoppedState;
bool aboutToFinishEmitted = false;
QString lastErrorString;
+
+ QString audioFileToAdd;
};
#endif // MEDIAMPV_H
CONFIG += c++14 exceptions_off rtti_off optimize_full
TEMPLATE = app
-VERSION = 3.4.1
+VERSION = 3.4.2
DEFINES += APP_VERSION="$$VERSION"
APP_NAME = Minitube
buttonLayout->setAlignment(Qt::AlignLeft);
closeButton = new QPushButton(tr("&Close"), this);
closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
-
closeButton->setDefault(true);
+ closeButton->setShortcut(Qt::Key_Escape);
closeButton->setFocus();
connect(closeButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(goBack()));
buttonLayout->addWidget(closeButton);
}
void ChannelView::appear() {
- updateQuery();
+ updateQuery(true);
MainWindow::instance()->showActionsInStatusBar(statusActions, true);
setFocus();
ChannelAggregator::instance()->start();
icon.addFile(filename, QSize(size, size), mode, state);
}
}
+
+QVector<int> sizes;
+
} // namespace
+void IconUtils::setSizes(const QVector<int> &value) {
+ sizes = value;
+}
+
QIcon IconUtils::fromTheme(const QString &name) {
static const QLatin1String symbolic("-symbolic");
if (name.endsWith(symbolic)) return QIcon::fromTheme(name);
QIcon icon;
// WARN keep these sizes updated with what we really use
- for (int size : {16, 24, 32, 88}) {
+ for (int size : qAsConst(sizes)) {
const QString pathAndName =
path + QString::number(size) + QLatin1Char('/') + QLatin1String(name);
QString iconFilename = pathAndName + normal + ext;
class IconUtils {
public:
+ static void setSizes(const QVector<int> &value);
+
static QIcon fromTheme(const QString &name);
static QIcon fromResources(const char *name);
QNetworkProxyFactory::setUseSystemConfiguration(true);
+ IconUtils::setSizes({16, 24, 32, 88});
+
showWindow(app, pkgDataDir);
return app.exec();
showHome();
#endif
- QTimer::singleShot(1000, this, &MainWindow::lazyInit);
+ QTimer::singleShot(100, this, &MainWindow::lazyInit);
}
void MainWindow::lazyInit() {
qDebug() << "available formats" << urlMap.keys();
const QVector<VideoDefinition> &definitions = VideoDefinition::getDefinitions();
- int previousIndex = std::max(definitions.indexOf(definition) - 1, 0);
+ int previousIndex = std::max(definitions.indexOf(definition), 0);
for (; previousIndex >= 0; previousIndex--) {
const VideoDefinition &previousDefinition = definitions.at(previousIndex);
qDebug() << "Testing format" << previousDefinition.getCode();