diff --git a/src/common/qt.h b/src/common/qt.h index 392c9ff5f..c630b8ab4 100644 --- a/src/common/qt.h +++ b/src/common/qt.h @@ -39,4 +39,15 @@ to_wide(QString const &source) { return source.toStdWString(); } +inline void +mxinfo(QString const &s) { + mxinfo(to_utf8(s)); +} + +inline void +mxmsg(unsigned int level, + QString const &message) { + mxmsg(level, to_utf8(message)); +} + #endif // MTX_COMMON_QT_H diff --git a/src/mmg-qt/forms/main_window.h b/src/mmg-qt/forms/main_window.h index 03b417c9b..b3654e603 100644 --- a/src/mmg-qt/forms/main_window.h +++ b/src/mmg-qt/forms/main_window.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'main_window.ui' ** -** Created: Mon Apr 9 17:38:31 2012 +** Created: Mon Apr 9 19:48:41 2012 ** by: Qt User Interface Compiler version 4.7.4 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! @@ -57,28 +57,15 @@ public: QAction *action_Chapter_editor; QAction *action_Options; QWidget *centralWidget; - QVBoxLayout *verticalLayout_12; + QVBoxLayout *verticalLayout_2; QTabWidget *mainTab; QWidget *inputTab; QHBoxLayout *horizontalLayout_2; - QVBoxLayout *verticalLayout_3; - QLabel *label; - QHBoxLayout *horizontalLayout; - QTreeView *riles; QVBoxLayout *verticalLayout; - QPushButton *addFile; - QPushButton *appendFile; - QPushButton *removeFile; - QPushButton *removeAll; - QPushButton *multipleFileParts; - QSpacerItem *verticalSpacer; + QLabel *label; + QTreeView *files; QLabel *label_2; - QHBoxLayout *horizontalLayout_3; QTreeView *tracks; - QVBoxLayout *verticalLayout_2; - QPushButton *trackUp; - QPushButton *trackDown; - QSpacerItem *verticalSpacer_2; QVBoxLayout *verticalLayout_4; QLabel *label_3; QScrollArea *scrollArea; @@ -212,11 +199,12 @@ public: QPushButton *addAttachment; QPushButton *removeAttachment; QSpacerItem *verticalSpacer_6; - QHBoxLayout *horizontalLayout_5; + QHBoxLayout *horizontalLayout; QSpacerItem *horizontalSpacer_2; - QPushButton *pbStartMuxing; - QPushButton *pbAddToJobQueue; - QPushButton *pbSaveSettings; + QPushButton *addFiles; + QPushButton *startMuxing; + QPushButton *addToJobQueue; + QPushButton *saveSettings; QSpacerItem *horizontalSpacer_3; QMenuBar *menuBar; QMenu *menuFile; @@ -228,7 +216,7 @@ public: { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); - MainWindow->resize(846, 571); + MainWindow->resize(780, 556); actionNew = new QAction(MainWindow); actionNew->setObjectName(QString::fromUtf8("actionNew")); actionSave_job_file = new QAction(MainWindow); @@ -259,10 +247,10 @@ public: action_Options->setObjectName(QString::fromUtf8("action_Options")); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); - verticalLayout_12 = new QVBoxLayout(centralWidget); - verticalLayout_12->setSpacing(6); - verticalLayout_12->setContentsMargins(11, 11, 11, 11); - verticalLayout_12->setObjectName(QString::fromUtf8("verticalLayout_12")); + verticalLayout_2 = new QVBoxLayout(centralWidget); + verticalLayout_2->setSpacing(6); + verticalLayout_2->setContentsMargins(11, 11, 11, 11); + verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); mainTab = new QTabWidget(centralWidget); mainTab->setObjectName(QString::fromUtf8("mainTab")); mainTab->setTabPosition(QTabWidget::North); @@ -272,98 +260,31 @@ public: horizontalLayout_2->setSpacing(6); horizontalLayout_2->setContentsMargins(11, 11, 11, 11); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); - verticalLayout_3 = new QVBoxLayout(); - verticalLayout_3->setSpacing(6); - verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); - label = new QLabel(inputTab); - label->setObjectName(QString::fromUtf8("label")); - - verticalLayout_3->addWidget(label); - - horizontalLayout = new QHBoxLayout(); - horizontalLayout->setSpacing(6); - horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); - riles = new QTreeView(inputTab); - riles->setObjectName(QString::fromUtf8("riles")); - - horizontalLayout->addWidget(riles); - verticalLayout = new QVBoxLayout(); verticalLayout->setSpacing(6); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); - addFile = new QPushButton(inputTab); - addFile->setObjectName(QString::fromUtf8("addFile")); + label = new QLabel(inputTab); + label->setObjectName(QString::fromUtf8("label")); - verticalLayout->addWidget(addFile); + verticalLayout->addWidget(label); - appendFile = new QPushButton(inputTab); - appendFile->setObjectName(QString::fromUtf8("appendFile")); + files = new QTreeView(inputTab); + files->setObjectName(QString::fromUtf8("files")); - verticalLayout->addWidget(appendFile); - - removeFile = new QPushButton(inputTab); - removeFile->setObjectName(QString::fromUtf8("removeFile")); - - verticalLayout->addWidget(removeFile); - - removeAll = new QPushButton(inputTab); - removeAll->setObjectName(QString::fromUtf8("removeAll")); - - verticalLayout->addWidget(removeAll); - - multipleFileParts = new QPushButton(inputTab); - multipleFileParts->setObjectName(QString::fromUtf8("multipleFileParts")); - - verticalLayout->addWidget(multipleFileParts); - - verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - - verticalLayout->addItem(verticalSpacer); - - - horizontalLayout->addLayout(verticalLayout); - - - verticalLayout_3->addLayout(horizontalLayout); + verticalLayout->addWidget(files); label_2 = new QLabel(inputTab); label_2->setObjectName(QString::fromUtf8("label_2")); - verticalLayout_3->addWidget(label_2); + verticalLayout->addWidget(label_2); - horizontalLayout_3 = new QHBoxLayout(); - horizontalLayout_3->setSpacing(6); - horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); tracks = new QTreeView(inputTab); tracks->setObjectName(QString::fromUtf8("tracks")); - horizontalLayout_3->addWidget(tracks); - - verticalLayout_2 = new QVBoxLayout(); - verticalLayout_2->setSpacing(6); - verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); - trackUp = new QPushButton(inputTab); - trackUp->setObjectName(QString::fromUtf8("trackUp")); - - verticalLayout_2->addWidget(trackUp); - - trackDown = new QPushButton(inputTab); - trackDown->setObjectName(QString::fromUtf8("trackDown")); - - verticalLayout_2->addWidget(trackDown); - - verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - - verticalLayout_2->addItem(verticalSpacer_2); + verticalLayout->addWidget(tracks); - horizontalLayout_3->addLayout(verticalLayout_2); - - - verticalLayout_3->addLayout(horizontalLayout_3); - - - horizontalLayout_2->addLayout(verticalLayout_3); + horizontalLayout_2->addLayout(verticalLayout); verticalLayout_4 = new QVBoxLayout(); verticalLayout_4->setSpacing(6); @@ -380,7 +301,7 @@ public: scrollArea->setWidgetResizable(true); scrollAreaWidgetContents = new QWidget(); scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents")); - scrollAreaWidgetContents->setGeometry(QRect(0, 0, 388, 757)); + scrollAreaWidgetContents->setGeometry(QRect(0, -366, 402, 757)); verticalLayout_9 = new QVBoxLayout(scrollAreaWidgetContents); verticalLayout_9->setSpacing(6); verticalLayout_9->setContentsMargins(11, 11, 11, 11); @@ -1080,41 +1001,46 @@ public: mainTab->addTab(attachmentsTab, QString()); - verticalLayout_12->addWidget(mainTab); + verticalLayout_2->addWidget(mainTab); - horizontalLayout_5 = new QHBoxLayout(); - horizontalLayout_5->setSpacing(6); - horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5")); + horizontalLayout = new QHBoxLayout(); + horizontalLayout->setSpacing(6); + horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - horizontalLayout_5->addItem(horizontalSpacer_2); + horizontalLayout->addItem(horizontalSpacer_2); - pbStartMuxing = new QPushButton(centralWidget); - pbStartMuxing->setObjectName(QString::fromUtf8("pbStartMuxing")); + addFiles = new QPushButton(centralWidget); + addFiles->setObjectName(QString::fromUtf8("addFiles")); - horizontalLayout_5->addWidget(pbStartMuxing); + horizontalLayout->addWidget(addFiles); - pbAddToJobQueue = new QPushButton(centralWidget); - pbAddToJobQueue->setObjectName(QString::fromUtf8("pbAddToJobQueue")); + startMuxing = new QPushButton(centralWidget); + startMuxing->setObjectName(QString::fromUtf8("startMuxing")); - horizontalLayout_5->addWidget(pbAddToJobQueue); + horizontalLayout->addWidget(startMuxing); - pbSaveSettings = new QPushButton(centralWidget); - pbSaveSettings->setObjectName(QString::fromUtf8("pbSaveSettings")); + addToJobQueue = new QPushButton(centralWidget); + addToJobQueue->setObjectName(QString::fromUtf8("addToJobQueue")); - horizontalLayout_5->addWidget(pbSaveSettings); + horizontalLayout->addWidget(addToJobQueue); + + saveSettings = new QPushButton(centralWidget); + saveSettings->setObjectName(QString::fromUtf8("saveSettings")); + + horizontalLayout->addWidget(saveSettings); horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - horizontalLayout_5->addItem(horizontalSpacer_3); + horizontalLayout->addItem(horizontalSpacer_3); - verticalLayout_12->addLayout(horizontalLayout_5); + verticalLayout_2->addLayout(horizontalLayout); MainWindow->setCentralWidget(centralWidget); menuBar = new QMenuBar(MainWindow); menuBar->setObjectName(QString::fromUtf8("menuBar")); - menuBar->setGeometry(QRect(0, 0, 846, 24)); + menuBar->setGeometry(QRect(0, 0, 780, 24)); menuFile = new QMenu(menuBar); menuFile->setObjectName(QString::fromUtf8("menuFile")); menuMuxing = new QMenu(menuBar); @@ -1125,6 +1051,100 @@ public: statusBar = new QStatusBar(MainWindow); statusBar->setObjectName(QString::fromUtf8("statusBar")); MainWindow->setStatusBar(statusBar); +#ifndef QT_NO_SHORTCUT + label->setBuddy(files); + label_2->setBuddy(tracks); + label_16->setBuddy(trackName); + label_17->setBuddy(trackLanguage); + label_18->setBuddy(defaultTrackFlag); + label_19->setBuddy(forcedTrackFlag); + label_31->setBuddy(compression); + label_20->setBuddy(trackTacks); + label_22->setBuddy(delay); + label_23->setBuddy(stretchBy); + label_24->setBuddy(defaultDuration); + label_21->setBuddy(timecodes); + label_26->setBuddy(stereoscopy); + label_27->setBuddy(cropping); + label_28->setBuddy(subtitleCharacterSet); + label_29->setBuddy(cues); + label_30->setBuddy(userDefinedTrackOptions); + label_5->setBuddy(title); + label_4->setBuddy(output); + label_6->setBuddy(globalTags); + label_7->setBuddy(segmentinfo); + label_34->setBuddy(splitMaxFiles); + label_9->setBuddy(segmentUIDs); + label_10->setBuddy(previousSegmentUID); + label_11->setBuddy(nextSegmentUID); + label_12->setBuddy(chapters); + label_13->setBuddy(chapterLanguage); + label_14->setBuddy(chapterCharacterSet); + label_15->setBuddy(cueNameFormat); + label_33->setBuddy(userDefinedOptions); +#endif // QT_NO_SHORTCUT + QWidget::setTabOrder(mainTab, files); + QWidget::setTabOrder(files, tracks); + QWidget::setTabOrder(tracks, scrollArea); + QWidget::setTabOrder(scrollArea, trackName); + QWidget::setTabOrder(trackName, trackLanguage); + QWidget::setTabOrder(trackLanguage, defaultTrackFlag); + QWidget::setTabOrder(defaultTrackFlag, forcedTrackFlag); + QWidget::setTabOrder(forcedTrackFlag, compression); + QWidget::setTabOrder(compression, trackTacks); + QWidget::setTabOrder(trackTacks, browseTrackTags); + QWidget::setTabOrder(browseTrackTags, delay); + QWidget::setTabOrder(delay, stretchBy); + QWidget::setTabOrder(stretchBy, defaultDuration); + QWidget::setTabOrder(defaultDuration, timecodes); + QWidget::setTabOrder(timecodes, browseTimecodes); + QWidget::setTabOrder(browseTimecodes, setAspectRatio); + QWidget::setTabOrder(setAspectRatio, aspectRatio); + QWidget::setTabOrder(aspectRatio, setDisplayWidthHeight); + QWidget::setTabOrder(setDisplayWidthHeight, displayWidth); + QWidget::setTabOrder(displayWidth, displayHeight); + QWidget::setTabOrder(displayHeight, stereoscopy); + QWidget::setTabOrder(stereoscopy, cropping); + QWidget::setTabOrder(cropping, aacIsSBR); + QWidget::setTabOrder(aacIsSBR, subtitleCharacterSet); + QWidget::setTabOrder(subtitleCharacterSet, cues); + QWidget::setTabOrder(cues, userDefinedTrackOptions); + QWidget::setTabOrder(userDefinedTrackOptions, title); + QWidget::setTabOrder(title, output); + QWidget::setTabOrder(output, browseOutput); + QWidget::setTabOrder(browseOutput, globalTags); + QWidget::setTabOrder(globalTags, browseGlobalTags); + QWidget::setTabOrder(browseGlobalTags, segmentinfo); + QWidget::setTabOrder(segmentinfo, browseSegmentInfo); + QWidget::setTabOrder(browseSegmentInfo, doNotSplit); + QWidget::setTabOrder(doNotSplit, doSplitAfterSize); + QWidget::setTabOrder(doSplitAfterSize, splitSize); + QWidget::setTabOrder(splitSize, doSplitAfterDuration); + QWidget::setTabOrder(doSplitAfterDuration, splitDuration); + QWidget::setTabOrder(splitDuration, doSplitAfterTimecodes); + QWidget::setTabOrder(doSplitAfterTimecodes, splitTimecodes); + QWidget::setTabOrder(splitTimecodes, doSplitByParts); + QWidget::setTabOrder(doSplitByParts, splitParts); + QWidget::setTabOrder(splitParts, splitMaxFiles); + QWidget::setTabOrder(splitMaxFiles, linkFiles); + QWidget::setTabOrder(linkFiles, segmentUIDs); + QWidget::setTabOrder(segmentUIDs, previousSegmentUID); + QWidget::setTabOrder(previousSegmentUID, nextSegmentUID); + QWidget::setTabOrder(nextSegmentUID, chapters); + QWidget::setTabOrder(chapters, browseChapters); + QWidget::setTabOrder(browseChapters, chapterLanguage); + QWidget::setTabOrder(chapterLanguage, chapterCharacterSet); + QWidget::setTabOrder(chapterCharacterSet, cueNameFormat); + QWidget::setTabOrder(cueNameFormat, webmMode); + QWidget::setTabOrder(webmMode, userDefinedOptions); + QWidget::setTabOrder(userDefinedOptions, editUserDefinedOptions); + QWidget::setTabOrder(editUserDefinedOptions, attachments); + QWidget::setTabOrder(attachments, addAttachment); + QWidget::setTabOrder(addAttachment, removeAttachment); + QWidget::setTabOrder(removeAttachment, addFiles); + QWidget::setTabOrder(addFiles, startMuxing); + QWidget::setTabOrder(startMuxing, addToJobQueue); + QWidget::setTabOrder(addToJobQueue, saveSettings); menuBar->addAction(menuFile->menuAction()); menuBar->addAction(menuMuxing->menuAction()); @@ -1149,9 +1169,12 @@ public: menuTools->addAction(action_Options); retranslateUi(MainWindow); - QObject::connect(pbStartMuxing, SIGNAL(clicked()), MainWindow, SLOT(startMuxingPressed())); - QObject::connect(pbAddToJobQueue, SIGNAL(clicked()), MainWindow, SLOT(onAddToJobQueue())); - QObject::connect(pbSaveSettings, SIGNAL(clicked()), MainWindow, SLOT(onSaveSettings())); + QObject::connect(startMuxing, SIGNAL(clicked()), MainWindow, SLOT(onStartMuxing())); + QObject::connect(addToJobQueue, SIGNAL(clicked()), MainWindow, SLOT(onAddToJobQueue())); + QObject::connect(saveSettings, SIGNAL(clicked()), MainWindow, SLOT(onSaveSettings())); + QObject::connect(addFiles, SIGNAL(clicked()), MainWindow, SLOT(onAddFiles())); + QObject::connect(actionAdd_to_job_queue, SIGNAL(triggered()), MainWindow, SLOT(onAddToJobQueue())); + QObject::connect(actionExit, SIGNAL(triggered()), MainWindow, SLOT(close())); mainTab->setCurrentIndex(0); @@ -1177,14 +1200,7 @@ public: action_Chapter_editor->setText(QApplication::translate("MainWindow", "&Chapter editor", 0, QApplication::UnicodeUTF8)); action_Options->setText(QApplication::translate("MainWindow", "&Options...", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("MainWindow", "Files:", 0, QApplication::UnicodeUTF8)); - addFile->setText(QApplication::translate("MainWindow", "Add", 0, QApplication::UnicodeUTF8)); - appendFile->setText(QApplication::translate("MainWindow", "Append", 0, QApplication::UnicodeUTF8)); - removeFile->setText(QApplication::translate("MainWindow", "Remove", 0, QApplication::UnicodeUTF8)); - removeAll->setText(QApplication::translate("MainWindow", "Remove all", 0, QApplication::UnicodeUTF8)); - multipleFileParts->setText(QApplication::translate("MainWindow", "Multiple Parts", 0, QApplication::UnicodeUTF8)); label_2->setText(QApplication::translate("MainWindow", "Tracks, chapters, tags and attachments:", 0, QApplication::UnicodeUTF8)); - trackUp->setText(QApplication::translate("MainWindow", "up", 0, QApplication::UnicodeUTF8)); - trackDown->setText(QApplication::translate("MainWindow", "down", 0, QApplication::UnicodeUTF8)); label_3->setText(QApplication::translate("MainWindow", "Properties:", 0, QApplication::UnicodeUTF8)); groupBox_7->setTitle(QApplication::translate("MainWindow", "General options", 0, QApplication::UnicodeUTF8)); label_16->setText(QApplication::translate("MainWindow", "Track name:", 0, QApplication::UnicodeUTF8)); @@ -1271,12 +1287,13 @@ public: addAttachment->setText(QApplication::translate("MainWindow", "Add", 0, QApplication::UnicodeUTF8)); removeAttachment->setText(QApplication::translate("MainWindow", "Remove", 0, QApplication::UnicodeUTF8)); mainTab->setTabText(mainTab->indexOf(attachmentsTab), QApplication::translate("MainWindow", "Attachments", 0, QApplication::UnicodeUTF8)); - pbStartMuxing->setText(QApplication::translate("MainWindow", "Start muxing", 0, QApplication::UnicodeUTF8)); - pbAddToJobQueue->setText(QApplication::translate("MainWindow", "Add to job queue", 0, QApplication::UnicodeUTF8)); - pbSaveSettings->setText(QApplication::translate("MainWindow", "Save settings", 0, QApplication::UnicodeUTF8)); - menuFile->setTitle(QApplication::translate("MainWindow", "File", 0, QApplication::UnicodeUTF8)); - menuMuxing->setTitle(QApplication::translate("MainWindow", "Muxing", 0, QApplication::UnicodeUTF8)); - menuTools->setTitle(QApplication::translate("MainWindow", "Tools", 0, QApplication::UnicodeUTF8)); + addFiles->setText(QApplication::translate("MainWindow", "&Add files", 0, QApplication::UnicodeUTF8)); + startMuxing->setText(QApplication::translate("MainWindow", "Sta&rt muxing", 0, QApplication::UnicodeUTF8)); + addToJobQueue->setText(QApplication::translate("MainWindow", "Add to job &queue", 0, QApplication::UnicodeUTF8)); + saveSettings->setText(QApplication::translate("MainWindow", "&Save settings", 0, QApplication::UnicodeUTF8)); + menuFile->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8)); + menuMuxing->setTitle(QApplication::translate("MainWindow", "&Muxing", 0, QApplication::UnicodeUTF8)); + menuTools->setTitle(QApplication::translate("MainWindow", "&Tools", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; diff --git a/src/mmg-qt/forms/main_window.ui b/src/mmg-qt/forms/main_window.ui index de51b0a24..debf9c602 100644 --- a/src/mmg-qt/forms/main_window.ui +++ b/src/mmg-qt/forms/main_window.ui @@ -6,15 +6,15 @@ 0 0 - 846 - 571 + 780 + 556 MainWindow - + @@ -29,117 +29,32 @@ - + Files: + + files + - - - - - - - - - - Add - - - - - - - Append - - - - - - - Remove - - - - - - - Remove all - - - - - - - Multiple Parts - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - + Tracks, chapters, tags and attachments: + + tracks + - - - - - - - - - - up - - - - - - - down - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - + @@ -167,8 +82,8 @@ 0 - 0 - 388 + -366 + 402 757 @@ -184,6 +99,9 @@ Track name: + + trackName + @@ -194,6 +112,9 @@ Language: + + trackLanguage + @@ -204,6 +125,9 @@ "Default track" flag: + + defaultTrackFlag + @@ -230,6 +154,9 @@ "Forced track" flag: + + forcedTrackFlag + @@ -251,6 +178,9 @@ Compression: + + compression + @@ -277,6 +207,9 @@ Tags: + + trackTacks + @@ -307,6 +240,9 @@ Delay (in ms): + + delay + @@ -317,6 +253,9 @@ Stretch by: + + stretchBy + @@ -327,6 +266,9 @@ Default duration/FPS: + + defaultDuration + @@ -401,6 +343,9 @@ Timecode file: + + timecodes + @@ -504,6 +449,9 @@ Stereoscopy: + + stereoscopy + @@ -514,6 +462,9 @@ Cropping: + + cropping + @@ -555,6 +506,9 @@ Character set: + + subtitleCharacterSet + @@ -581,6 +535,9 @@ Indexing (cues): + + cues + @@ -612,6 +569,9 @@ User defined options: + + userDefinedTrackOptions + @@ -659,6 +619,9 @@ File title: + + title + @@ -669,6 +632,9 @@ Destination: + + output + @@ -690,6 +656,9 @@ Global tags: + + globalTags + @@ -711,6 +680,9 @@ Segment info: + + segmentinfo + @@ -858,6 +830,9 @@ Maximum number of files: + + splitMaxFiles + @@ -901,6 +876,9 @@ Segment UIDs: + + segmentUIDs + @@ -911,6 +889,9 @@ Previous segment UID: + + previousSegmentUID + @@ -921,6 +902,9 @@ Next segment UID: + + nextSegmentUID + @@ -940,6 +924,9 @@ Chapter file: + + chapters + @@ -961,6 +948,9 @@ Language: + + chapterLanguage + @@ -971,6 +961,9 @@ Character set: + + chapterCharacterSet + @@ -981,6 +974,9 @@ Cue name format: + + cueNameFormat + @@ -1009,6 +1005,9 @@ User-defined options: + + userDefinedOptions + @@ -1098,7 +1097,7 @@ - + @@ -1113,23 +1112,30 @@ - + - Start muxing + &Add files - + - Add to job queue + Sta&rt muxing - + - Save settings + Add to job &queue + + + + + + + &Save settings @@ -1155,13 +1161,13 @@ 0 0 - 846 + 780 24 - File + &File @@ -1173,7 +1179,7 @@ - Muxing + &Muxing @@ -1185,7 +1191,7 @@ - Tools + &Tools @@ -1269,17 +1275,82 @@ + + mainTab + files + tracks + scrollArea + trackName + trackLanguage + defaultTrackFlag + forcedTrackFlag + compression + trackTacks + browseTrackTags + delay + stretchBy + defaultDuration + timecodes + browseTimecodes + setAspectRatio + aspectRatio + setDisplayWidthHeight + displayWidth + displayHeight + stereoscopy + cropping + aacIsSBR + subtitleCharacterSet + cues + userDefinedTrackOptions + title + output + browseOutput + globalTags + browseGlobalTags + segmentinfo + browseSegmentInfo + doNotSplit + doSplitAfterSize + splitSize + doSplitAfterDuration + splitDuration + doSplitAfterTimecodes + splitTimecodes + doSplitByParts + splitParts + splitMaxFiles + linkFiles + segmentUIDs + previousSegmentUID + nextSegmentUID + chapters + browseChapters + chapterLanguage + chapterCharacterSet + cueNameFormat + webmMode + userDefinedOptions + editUserDefinedOptions + attachments + addAttachment + removeAttachment + addFiles + startMuxing + addToJobQueue + saveSettings + - pbStartMuxing + startMuxing clicked() MainWindow - startMuxingPressed() + onStartMuxing() - 320 - 527 + 374 + 526 224 @@ -1288,7 +1359,7 @@ - pbAddToJobQueue + addToJobQueue clicked() MainWindow onAddToJobQueue() @@ -1304,7 +1375,7 @@ - pbSaveSettings + saveSettings clicked() MainWindow onSaveSettings() @@ -1319,10 +1390,59 @@ + + addFiles + clicked() + MainWindow + onAddFiles() + + + 251 + 505 + + + 141 + 507 + + + + + actionAdd_to_job_queue + triggered() + MainWindow + onAddToJobQueue() + + + -1 + -1 + + + 389 + 277 + + + + + actionExit + triggered() + MainWindow + close() + + + -1 + -1 + + + 389 + 277 + + + onStartMuxing() onAddToJobQueue() onSaveSettings() + onAddFiles() diff --git a/src/mmg-qt/main_window.cpp b/src/mmg-qt/main_window.cpp index f17d60000..24f1d78d9 100644 --- a/src/mmg-qt/main_window.cpp +++ b/src/mmg-qt/main_window.cpp @@ -1,7 +1,13 @@ #include "common/common_pch.h" +#include "common/qt.h" #include "mmg-qt/main_window.h" #include "mmg-qt/forms/main_window.h" +#include "mmg-qt/util/file_identifier.h" +#include "mmg-qt/util/file_type_filter.h" +#include "mmg-qt/util/settings.h" + +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow{parent} @@ -13,3 +19,38 @@ MainWindow::MainWindow(QWidget *parent) MainWindow::~MainWindow() { delete ui; } + +void +MainWindow::onAddFiles() { + auto fileNames = selectFilesToAdd(); + if (fileNames.empty()) + return; + + for (auto &fileName : fileNames) + addFile(fileName, false); +} + +QStringList +MainWindow::selectFilesToAdd() { + QFileDialog dlg{this}; + dlg.setNameFilters(FileTypeFilter::get()); + dlg.setFileMode(QFileDialog::ExistingFiles); + dlg.setDirectory(Settings::get().m_lastOpenDir); + dlg.setWindowTitle(QY("Add media files")); + + if (!dlg.exec()) + return QStringList{}; + + Settings::get().m_lastOpenDir = dlg.directory(); + + return dlg.selectedFiles(); +} + +void +MainWindow::addFile(QString const &fileName, + bool /*append*/) { + FileIdentifier identifier{ this, fileName }; + if (!identifier.identify()) + return; + +} diff --git a/src/mmg-qt/main_window.h b/src/mmg-qt/main_window.h index 1c54a6643..5d3b29354 100644 --- a/src/mmg-qt/main_window.h +++ b/src/mmg-qt/main_window.h @@ -1,6 +1,9 @@ #ifndef MTX_MMGQT_MAIN_WINDOW_H #define MTX_MMGQT_MAIN_WINDOW_H +#include "common/common_pch.h" + +#include #include namespace Ui { @@ -11,11 +14,18 @@ class MainWindow : public QMainWindow { Q_OBJECT; public: - explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow(); + explicit MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + +public slots: + virtual void onAddFiles(); + +protected: + virtual QStringList selectFilesToAdd(); + virtual void addFile(QString const &fileName, bool append); private: - Ui::MainWindow *ui; + Ui::MainWindow *ui; }; #endif // MTX_MMGQT_MAIN_WINDOW_H diff --git a/src/mmg-qt/mmg_qt.cpp b/src/mmg-qt/mmg_qt.cpp index de4105322..a300fb696 100644 --- a/src/mmg-qt/mmg_qt.cpp +++ b/src/mmg-qt/mmg_qt.cpp @@ -5,12 +5,6 @@ #include "mmg-qt/mmg_qt.h" #include "mmg-qt/main_window.h" -mkvmerge_settings_t::mkvmerge_settings_t() - : executable(Q("mkvmerge")) - , priority(priority_normal) -{ -} - int main(int argc, char **argv) { diff --git a/src/mmg-qt/mmg_qt.h b/src/mmg-qt/mmg_qt.h index b9c39285c..a0a862268 100644 --- a/src/mmg-qt/mmg_qt.h +++ b/src/mmg-qt/mmg_qt.h @@ -7,19 +7,4 @@ #include "common/qt.h" -struct mkvmerge_settings_t { - enum process_priority_e { - priority_lowest, - priority_low, - priority_normal, - priority_high, - priority_highest, - }; - - QString executable; - process_priority_e priority; - - mkvmerge_settings_t(); -}; - #endif // MTX_MMGQT_MMG_QT_H diff --git a/src/mmg-qt/util/file_identifier.cpp b/src/mmg-qt/util/file_identifier.cpp new file mode 100644 index 000000000..62839d43a --- /dev/null +++ b/src/mmg-qt/util/file_identifier.cpp @@ -0,0 +1,74 @@ +#include "common/common_pch.h" + +#include "common/qt.h" +#include "mmg-qt/util/file_identifier.h" +#include "mmg-qt/util/process.h" +#include "mmg-qt/util/settings.h" + +#include +#include + +FileIdentifier::FileIdentifier(QWidget *parent, + QString const &fileName) + : m_parent(parent) + , m_exitCode(0) + , m_fileName(fileName) +{ +} + +FileIdentifier::~FileIdentifier() { +} + +bool +FileIdentifier::identify() { + if (m_fileName.isEmpty()) + return false; + + QStringList args; + args << "--output-charset" << "utf-8" << "--identify-for-mmg" << m_fileName; + + auto process = Process::execute(Settings::get().m_mkvmergeExe, args); + auto exitCode = process->process().exitCode(); + m_output = process->output(); + + mxinfo(boost::format("oh yeah, code %2%: %1%\n") % to_utf8(m_output.join(":::")) % exitCode); + + if (0 == exitCode) + return true; + + if (3 == exitCode) { + auto pos = m_output.isEmpty() ? -1 : m_output[0].indexOf("container:"); + auto container = -1 == pos ? QY("unknown") : m_output[0].mid(pos + 11); + + QMessageBox::critical(m_parent, QY("Unsupported file format"), QY("The file is an unsupported container format (%1).").arg(container)); + + return false; + } + + QMessageBox::critical(m_parent, QY("Unrecognized file format"), QY("The file was not recognized as a supported format (exit code: %1).").arg(exitCode)); + + return false; +} + +QString const & +FileIdentifier::fileName() + const { + return m_fileName; +} + +void +FileIdentifier::setFileName(QString const &fileName) { + m_fileName = fileName; +} + +int +FileIdentifier::exitCode() + const { + return m_exitCode; +} + +QStringList const & +FileIdentifier::output() + const { + return m_output; +} diff --git a/src/mmg-qt/util/file_identifier.h b/src/mmg-qt/util/file_identifier.h new file mode 100644 index 000000000..a04917f0a --- /dev/null +++ b/src/mmg-qt/util/file_identifier.h @@ -0,0 +1,31 @@ +#ifndef MTX_MMGQT_FILE_IDENTIFIER_H +#define MTX_MMGQT_FILE_IDENTIFIER_H + +#include "common/common_pch.h" + +#include +#include + +class FileIdentifier: public QObject { + Q_OBJECT; + +private: + QWidget *m_parent; + int m_exitCode; + QStringList m_output; + QString m_fileName; + +public: + FileIdentifier(QWidget *parent = nullptr, QString const &fileName = QString{}); + virtual ~FileIdentifier(); + + virtual bool identify(); + + virtual QString const &fileName() const; + virtual void setFileName(QString const &fileName); + + virtual int exitCode() const; + virtual QStringList const &output() const; +}; + +#endif // MTX_MMGQT_FILE_IDENTIFIER_H diff --git a/src/mmg-qt/util/file_type_filter.cpp b/src/mmg-qt/util/file_type_filter.cpp new file mode 100644 index 000000000..2a5bf82f5 --- /dev/null +++ b/src/mmg-qt/util/file_type_filter.cpp @@ -0,0 +1,48 @@ +#include "common/common_pch.h" + +#include "common/file_types.h" +#include "common/qt.h" +#include "mmg-qt/util/file_type_filter.h" + +#include + +QStringList FileTypeFilter::s_filter; + +QStringList const & +FileTypeFilter::get() { + if (!s_filter.isEmpty()) + return s_filter; + + auto &file_types = file_type_t::get_supported(); + + std::map all_extensions_map; + for (auto &file_type : file_types) { + auto extensions = to_qs(file_type.extensions).split(" "); + QStringList extensions_full; + + for (auto &extension : extensions) { + all_extensions_map[extension] = true; + extensions_full << QString{"*.%1"}.arg(extension); + +#if !defined(SYS_WINDOWS) + auto extension_upper = extension.toUpper(); + all_extensions_map[extension_upper] = true; + if (extension_upper != extension) + extensions_full << QString("*.%1").arg(extension_upper); +#endif // !SYS_WINDOWS + } + + s_filter << QString("%1 (%2)").arg(to_qs(file_type.title)).arg(extensions_full.join(" ")); + } + + QStringList all_extensions; + for (auto &extension : all_extensions_map) + all_extensions << QString("*.%1").arg(extension.first); + + std::sort(s_filter.begin(), s_filter.end()); + + s_filter.push_front(QY("All files (*)")); + s_filter.push_front(QY("All supported media files (%1)").arg(all_extensions.join(" "))); + + return s_filter; +} diff --git a/src/mmg-qt/util/file_type_filter.h b/src/mmg-qt/util/file_type_filter.h new file mode 100644 index 000000000..2f5c2fcd5 --- /dev/null +++ b/src/mmg-qt/util/file_type_filter.h @@ -0,0 +1,16 @@ +#ifndef MTX_MMGQT_FILE_TYPE_FILTER_H +#define MTX_MMGQT_FILE_TYPE_FILTER_H + +#include "common/common_pch.h" + +#include + +class FileTypeFilter { +public: + static QStringList const & get(); + +public: + static QStringList s_filter; +}; + +#endif // MTX_MMGQT_FILE_TYPE_FILTER_H diff --git a/src/mmg-qt/util/process.cpp b/src/mmg-qt/util/process.cpp index dcfdc61f9..4c8f288de 100644 --- a/src/mmg-qt/util/process.cpp +++ b/src/mmg-qt/util/process.cpp @@ -11,7 +11,7 @@ Process::Process(QString const &command, : m_command(command) , m_args(args) { - connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(data_available())); + connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(dataAvailable())); } Process::~Process() { diff --git a/src/mmg-qt/util/settings.cpp b/src/mmg-qt/util/settings.cpp new file mode 100644 index 000000000..cfb2cd5cd --- /dev/null +++ b/src/mmg-qt/util/settings.cpp @@ -0,0 +1,24 @@ +#include "common/common_pch.h" + +#include "mmg-qt/util/settings.h" + +Settings Settings::s_settings; + +Settings::Settings() + : m_mkvmergeExe("mkvmerge") + , m_priority(priority_normal) +{ +} + +Settings & +Settings::get() { + return s_settings; +} + +void +Settings::load() { +} + +void +Settings::save() { +} diff --git a/src/mmg-qt/util/settings.h b/src/mmg-qt/util/settings.h new file mode 100644 index 000000000..ee5b2e434 --- /dev/null +++ b/src/mmg-qt/util/settings.h @@ -0,0 +1,36 @@ +#ifndef MTX_MMGQT_SETTINGS_H +#define MTX_MMGQT_SETTINGS_H + +#include "common/common_pch.h" + +#include +#include + +class Settings: public QObject { + Q_OBJECT; +public: + enum process_priority_e { + priority_lowest, + priority_low, + priority_normal, + priority_high, + priority_highest, + }; + + QString m_mkvmergeExe; + process_priority_e m_priority; + QDir m_lastOpenDir; + +public: + Settings(); + void load(); + void save(); + +public: + static Settings s_settings; + static Settings &get(); +}; + +// extern Settings g_settings; + +#endif // MTX_MMGQT_SETTINGS_H