Make the GUI look for the main binary under "tsmuxer" and "tsMuxeR"

The all-lowercase binary name is the one that's emitted by the current build
system, while the old one is kept for backwards compatibility.

Fixes #63
master
Daniel Kamil Kozar 2019-12-07 19:37:10 +01:00
parent b79ef4c3e4
commit 5ee30737be
No known key found for this signature in database
GPG Key ID: A5FB0175B3A93F03
2 changed files with 59 additions and 56 deletions

View File

@ -893,10 +893,7 @@ void TsMuxerWindow::addFile() {
connect(this, SIGNAL(codecListReady()), this, SLOT(continueAddFile()));
connect(this, SIGNAL(fileAdded()), this, SLOT(addFile()));
runInMuxMode = false;
shellExecute(
QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) +
QDir::separator() + "tsMuxeR",
QStringList() << newFileName);
tsMuxerExecute(QStringList() << newFileName);
}
bool TsMuxerWindow::checkFileDuplicate(const QString &fileName) {
@ -1417,14 +1414,26 @@ void TsMuxerWindow::onProcessError(QProcess::ProcessError error) {
msgBox.exec();
}
void TsMuxerWindow::shellExecute(const QString &process,
const QStringList &args) {
static QString getTsMuxerBinaryPath() {
const auto applicationDirPath =
QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + QDir::separator();
for(auto binaryName : {"tsmuxer", "tsMuxeR"}) {
auto binaryPath = applicationDirPath + binaryName;
if (QFile::exists(binaryPath)) {
return binaryPath;
}
}
return QString();
}
void TsMuxerWindow::tsMuxerExecute(const QStringList &args) {
const auto exePath = getTsMuxerBinaryPath();
ui.buttonMux->setEnabled(false);
procStdOutput.clear();
procErrOutput.clear();
processFinished = false;
processExitCode = -1;
proc.start(process, args);
proc.start(exePath, args);
if (muxForm.isVisible())
muxForm.setProcess(&proc);
}
@ -2110,10 +2119,7 @@ void TsMuxerWindow::appendFile() {
connect(this, SIGNAL(codecListReady()), this, SLOT(continueAppendFile()));
connect(this, SIGNAL(fileAppended()), this, SLOT(appendFile()));
runInMuxMode = false;
shellExecute(
QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) +
QDir::separator() + "tsMuxeR",
QStringList() << newFileName);
tsMuxerExecute(QStringList() << newFileName);
}
void TsMuxerWindow::continueAppendFile() {
@ -2396,10 +2402,7 @@ void TsMuxerWindow::startMuxing() {
disconnect();
// QCoreApplication::dir
runInMuxMode = true;
shellExecute(
QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) +
QDir::separator() + "tsMuxeR",
QStringList() << metaName << quoteStr(ui.outFileName->text()));
tsMuxerExecute(QStringList() << metaName << quoteStr(ui.outFileName->text()));
}
void TsMuxerWindow::saveMetaFileBtnClick() {

View File

@ -3,10 +3,10 @@
#if defined(__GNUC__) && ((__GNUC__ < 4) || \
(__GNUC__ == 4 && __GNUC_MINOR__ <= 6))
#define override
#endif
#define override
#endif
#include <QtGui>
#include <QFileDialog>
#include <QProcess>
@ -14,17 +14,17 @@
#include "ui_tsmuxerwindow.h"
#include "muxForm.h"
typedef QList<double> ChapterList;
enum MplsType {
MPLS_NONE,
MPLS_PRIMARY,
MPLS_M2TS,
};
class QnCheckBoxedHeaderView: public QHeaderView {
typedef QList<double> ChapterList;
enum MplsType {
MPLS_NONE,
MPLS_PRIMARY,
MPLS_M2TS,
};
class QnCheckBoxedHeaderView: public QHeaderView {
Q_OBJECT
typedef QHeaderView base_type;
public:
@ -32,18 +32,18 @@ public:
Qt::CheckState checkState() const;
void setCheckState(Qt::CheckState state);
signals:
void checkStateChanged(Qt::CheckState state);
protected:
virtual void paintEvent(QPaintEvent *e) override;
virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
virtual QSize sectionSizeFromContents(int logicalIndex) const override;
private slots:
void at_sectionClicked(int logicalIndex);
private:
Qt::CheckState m_checkState;
int m_checkColumnIndex;
};
signals:
void checkStateChanged(Qt::CheckState state);
protected:
virtual void paintEvent(QPaintEvent *e) override;
virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
virtual QSize sectionSizeFromContents(int logicalIndex) const override;
private slots:
void at_sectionClicked(int logicalIndex);
private:
Qt::CheckState m_checkState;
int m_checkColumnIndex;
};
struct QtvCodecInfo
{
@ -170,21 +170,21 @@ protected:
virtual bool eventFilter(QObject *obj, QEvent* event) override;
void updateMaxOffsets();
void updateCustomChapters();
void writeSettings();
bool readSettings();
QString getOutputDir() const;
private:
struct MPLSFileInfo
{
MPLSFileInfo(const QString& _name, double _duration): name(_name), duration(_duration) {}
MPLSFileInfo(): duration(0) {}
QString name;
void writeSettings();
bool readSettings();
QString getOutputDir() const;
private:
struct MPLSFileInfo
{
MPLSFileInfo(const QString& _name, double _duration): name(_name), duration(_duration) {}
MPLSFileInfo(): duration(0) {}
QString name;
double duration;
};
bool checkFileDuplicate(const QString& fileName);
void shellExecute(const QString& process, const QStringList& args);
void tsMuxerExecute(const QStringList& args);
void addLines(const QByteArray& arr, QList<QString>& outList, bool isError);
void doAppendInt(const QString& fileName, const QString& parentFileName, double duration, bool doublePrefix, MplsType mplsRole);
bool isDiskOutput() const;
@ -207,7 +207,7 @@ private:
double getRendererAnimationTime() const;
void setRendererAnimationTime(double value);
void setTextItemColor(QString str);
QString getDefaultOutputFileName() const;
QString getDefaultOutputFileName() const;
void updateCurrentColor(int dr, int dg, int db, int rowIndex);
void colorizeCurrentRow(const QtvCodecInfo* codecInfo, int rowIndex = -1);
@ -256,5 +256,5 @@ private:
};
Q_DECLARE_METATYPE(ChapterList);
#endif
#endif