Unverified Commit daade48c authored by Maikel Llamaret Heredia's avatar Maikel Llamaret Heredia Committed by GitHub
Browse files

Add files via upload

parent 3dc3663e
/* MystiQ - a C++/Qt5 gui frontend for ffmpeg
* Copyright (C) 2011-2019 Maikel Llamaret Heredia <llamaret@webmisolutions.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGlobal>
#include <QLocale>
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "version.h"
#include "services/constants.h"
#ifdef USE_LIBNOTIFY
#include "services/notificationservice-libnotify.h"
#endif
#define PROJECT_HOMEPAGE "https://llamaret.github.io/MystiQ/"
namespace {
QString url(QString lnk)
{
return QString("<a href=\"%1\">%1</a>").arg(lnk);
}
}
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
QTextBrowser *info = ui->txtInfo;
QTextBrowser *translators = ui->txtTranslators;
info->setOpenExternalLinks(true);
info->setText(
"<b>MystiQ</b> &copy; 2019 SWL-X Project<br>"
+ tr("Version: %1").arg(VERSION_STRING)
#ifdef VERSION_ID_STRING
+ QString(" %1").arg(QString(VERSION_ID_STRING))
#endif
+ " "
+ ((Constants::getBool("Portable"))
/*: Portable version (no installation, no writing registry) */
? tr("Portable") : "")
+ "<br>"
/*: Qt version */
+ tr("Compiled with Qt %1").arg(QT_VERSION_STR)
#ifdef USE_LIBNOTIFY /*: libnotify version */
+ "<br>" + tr("Compiled with libnotify %1")
.arg(NotificationService_libnotify::getVersion())
#endif
+ "<br><br>"
+ tr("MystiQ is a GUI frontend for FFmpeg.")
+ "<br><br>"
//: %1 is the name and email of the programmer
+ tr("Developers: %1").arg("Maikel Llamaret Heredia &lt;llamaret@webmisolutions.com&gt;") + "<br><br>"
//: %1 is the name and email of the logo designer
+ tr("MystiQ Code Name: %1").arg("Hugo Florentino &lt;xxx@xxx.xx&gt;") + "<br><br>"
+ tr("This program is free software; you can redistribute it and/or modify it "
"under the terms of the GNU General Public License version 2 or 3.")
+ "<br><br>"
+ tr("MystiQ Homepage: %1").arg(url(PROJECT_HOMEPAGE))
+ "<br><br>"
+ tr("Some audio-processing functionalities are provided by SoX.")
+ " (" + url("http://sox.sourceforge.net/") + ")<br><br>"
+ tr("FFmpeg presets were taken from VideoMorph and FF Multi Converter.")
+ " (" + url("https://videomorph.webmisolutions.com/") + ")"
+ " (" + url("https://sites.google.com/site/ffmulticonverter/") + ")<br><br>"
+ "<br><br>"
);
translators->setHtml(getTranslators());
//translators->setText(getTranslators());
// Constraint the width of text area to the width of the banner.
//info->setMaximumWidth(ui->lblBanner->pixmap()->width());
// Set the background color of the textbox to the color of the window.
QPalette p = info->palette();
p.setColor(QPalette::Base, this->palette().color(QPalette::Window));
info->setPalette(p);
info->setFrameShape(QTextBrowser::NoFrame); // Hide textbox border.
translators->setPalette(p);
translators->setFrameShape(QTextBrowser::NoFrame);
// Make the window size fixed.
this->adjustSize();
this->setMinimumWidth(this->width());
this->setMinimumHeight(this->height());
this->setMaximumWidth(this->width());
this->setMaximumHeight(this->height());
ui->tabInfo->setAutoFillBackground(true);
ui->tabTranslators->setAutoFillBackground(true);
}
AboutDialog::~AboutDialog()
{
delete ui;
}
QString AboutDialog::getTranslators()
{
struct {QString locale; QString translator;} table[] = {
//: Spanish Language (Spain)
{"es_ES", trad(tr("Spanish (Spain)")
, "Maikel Llamaret <llamaret@webmisolutions.com>")},
};
const int size = sizeof(table) / sizeof(table[0]);
QStringList translators;
QString current_locale = QLocale::system().name();
for (int i=0; i<size; i++) {
// Put the translator of the current language at the top.
if (current_locale.startsWith(table[i].locale))
translators.push_front(table[i].translator);
else
translators.push_back(table[i].translator);
}
return translators.join("");
}
QString AboutDialog::trad(const QString& lang, const QString& author)
{
return trad(lang, QStringList() << author);
}
QString AboutDialog::trad(const QString& lang, const QStringList& authors)
{
QString s = "<ul>";
for (int n = 0; n < authors.count(); n++) {
QString author = authors[n];
s += "<li>"+ author.replace("<", "&lt;").replace(">", "&gt;")
+ "</li>";
}
s+= "</ul>";
return QString("<b>%1</b>: %2").arg(lang).arg(s);
}
/* MystiQ - a C++/Qt5 gui frontend for ffmpeg
* Copyright (C) 2011-2019 Maikel Llamaret Heredia <llamaret@webmisolutions.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog();
private:
Ui::AboutDialog *ui;
QString getTranslators();
QString trad(const QString& lang, const QString& author);
QString trad(const QString & lang, const QStringList & authors);
};
#endif // ABOUTDIALOG_H
This diff is collapsed.
/* MystiQ - a C++/Qt5 gui frontend for ffmpeg
* Copyright (C) 2011-2019 Maikel Llamaret Heredia <llamaret@webmisolutions.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aboutffmpegdialog.h"
#include "ui_aboutffmpegdialog.h"
#include "converter/ffmpeginterface.h"
AboutFFmpegDialog::AboutFFmpegDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutFFmpegDialog)
{
ui->setupUi(this);
QTextBrowser *info = ui->txtInfo;
QTextBrowser *codecinfo = ui->txtCodecInfo;
info->setText(
/*: ffmpeg description */
tr("FFmpeg is a complete, cross-platform solution to record, "
"convert and stream audio and video. It includes "
"libavcodec - the leading audio/video codec library.")
+ "<br><br>"
+ tr("FFmpeg is free software licensed under the LGPL or GPL.")
+ "<br><br>"
/*: visit ffmpeg website */
+ tr("Please visit %1 for more information.")
.arg("<a href=\"http://ffmpeg.org\">http://ffmpeg.org</a>")
+ "<br><br>"
+ FFmpegInterface::getFFmpegVersionInfo().replace("\n", "<br>")
);
info->setOpenExternalLinks(true);
info->setFrameShape(QTextBrowser::NoFrame);
codecinfo->setFrameShape(QTextBrowser::NoFrame);
ui->tabFFmpeg->setAutoFillBackground(true);
ui->tabCodecs->setAutoFillBackground(true);
QPalette p = info->palette();
p.setColor(QPalette::Base, ui->tabFFmpeg->palette().color(QPalette::Window));
info->setPalette(p);
codecinfo->setPalette(p);
codecinfo->setText(FFmpegInterface::getFFmpegCodecInfo());
}
AboutFFmpegDialog::~AboutFFmpegDialog()
{
delete ui;
}
/* MystiQ - a C++/Qt5 gui frontend for ffmpeg
* Copyright (C) 2011-2019 Maikel Llamaret Heredia <llamaret@webmisolutions.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ABOUTFFMPEGDIALOG_H
#define ABOUTFFMPEGDIALOG_H
#include <QDialog>
namespace Ui {
class AboutFFmpegDialog;
}
class AboutFFmpegDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutFFmpegDialog(QWidget *parent = nullptr);
~AboutFFmpegDialog();
private:
Ui::AboutFFmpegDialog *ui;
};
#endif // ABOUTFFMPEGDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutFFmpegDialog</class>
<widget class="QDialog" name="AboutFFmpegDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>551</width>
<height>379</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="windowTitle">
<string>About FFmpeg</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/app/icons/ffmpeg.png</normaloff>:/app/icons/ffmpeg.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabFFmpeg">
<attribute name="title">
<string>FFmpeg</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/app/icons/ffmpeg_large.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="txtInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabCodecs">
<attribute name="title">
<string>Available Codecs</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextBrowser" name="txtCodecInfo"/>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutFFmpegDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutFFmpegDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
/* MystiQ - a C++/Qt5 gui frontend for ffmpeg
* Copyright (C) 2011-2019 Maikel Llamaret Heredia <llamaret@webmisolutions.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "addtaskwizard.h"
#include "ui_addtaskwizard.h"
#include "converter/presets.h"
#include "conversionparameterdialog.h"
#include "services/extensions.h"
#include "services/paths.h"
#include "services/constants.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QDebug>
#include <QSettings>
#include <QProgressDialog>
#include <cassert>
#define DEFAULT_OUTPUT_TO_SOURCE_DIR Constants::getBool("OutputToSourceFolder")
#define PAGEID_SELECTFILES 0
#define PAGEID_PARAMS 1
#define BUSY_INDICATOR_MINIMUM_DURATION 100
enum OutputPathType
{
SelectFolder,
NewFolder,
SourceFolder
};
AddTaskWizard::AddTaskWizard(Presets *presets, QWidget *parent) :
QWizard(parent),
ui(new Ui::AddTaskWizard),
m_presets(presets),
m_current_param(new ConversionParameters),
m_exts(new Extensions())
{
ui->setupUi(this);
// setup signals/slots
connect(ui->btnAdd, SIGNAL(clicked())
, this, SLOT(slotAddFilesToList()));
connect(ui->btnRemove, SIGNAL(clicked())
, this, SLOT(slotRemoveFilesFromList()));
connect(ui->cbExtension, SIGNAL(currentIndexChanged(int))
, this, SLOT(slotExtensionSelected(int)));
connect(ui->cbPreset, SIGNAL(currentIndexChanged(int))
, this, SLOT(slotPresetSelected(int)));
connect(ui->btnEditPreset, SIGNAL(clicked())
, this, SLOT(slotEditPresetButton()));
connect(ui->btnBrowseOutputPath, SIGNAL(clicked())
, this, SLOT(slotBrowseOutputPathButton()));
connect(this, SIGNAL(accepted())
, this, SLOT(slotFinished()));
connect(ui->rbSelectFolder, SIGNAL(toggled(bool))
, ui->cbOutputPath, SLOT(setEnabled(bool)));
connect(ui->rbSelectFolder, SIGNAL(toggled(bool))
, ui->btnBrowseOutputPath, SLOT(setEnabled(bool)));
connect(ui->rbNewFolder, SIGNAL(toggled(bool))
, ui->txtNewFolderName, SLOT(setEnabled(bool)));
ui->rbSelectFolder->setChecked(true); // trigger toggled() event
ui->rbNewFolder->setChecked(true); // trigger toggled() event
ui->rbSourceFolder->setChecked(true); // trigger toggled() event
ui->lstFiles->setSelectionMode(QAbstractItemView::ExtendedSelection);
load_extensions();
ui->cbOutputPath->setEditable(true);
load_settings();
QSettings settings;
// Load Geometry
restoreGeometry(settings.value("addtaskwizard/geometry").toByteArray());
// Hide "auto adjust bitrate" checkbox.
ui->chkAutoAdjustBitrate->setVisible(false);
}
AddTaskWizard::~AddTaskWizard()
{
QSettings settings;
// Save Geometry
settings.setValue("addtaskwizard/geometry", saveGeometry());
delete ui;
delete m_current_param;
delete m_exts;
}
const QList<ConversionParameters>&
AddTaskWizard::getConversionParameters() const
{
return m_params;
}
int AddTaskWizard::exec_openfile()
{
ui->lstFiles->clear();
if (startId() == PAGEID_SELECTFILES) { // popup select file dialog
slotAddFilesToList();
if (ui->lstFiles->count() == 0)
return QWizard::Rejected;
}
return QWizard::exec();
}
int AddTaskWizard::exec(const QStringList &files)
{
ui->lstFiles->clear();
addFiles(files);
return QWizard::exec();
}
bool AddTaskWizard::validateCurrentPage()
{
switch (currentId()) {
case 0: // Select input files
// check if the list is empty
if (ui->lstFiles->count() != 0) { // complete
return true;
} else {
QMessageBox::information(this, this->windowTitle()
, tr("Please select at least one file."));
return false;
}
//break;
case 1: // Select conversion parameters
if (get_output_path_type() == SelectFolder) {
if (!create_directory(ui->cbOutputPath->currentText()))
return false;
} else if (get_output_path_type() == NewFolder) {
for (int i=0; i<ui->lstFiles->count(); i++) {
QString input_file = ui->lstFiles->item(i)->text();
QString output_path = get_output_path(input_file);
if (!create_directory(output_path, /* do not confirm */ false))
return false;
}
}
return true;
//break;
}
return true;
}
void AddTaskWizard::slotAddFilesToList()
{