updated application startup
This commit is contained in:
parent
5a93c6186c
commit
ed65b659de
|
@ -13,6 +13,7 @@
|
|||
# include <c++utilities/application/fakeqtconfigarguments.h>
|
||||
#endif
|
||||
#include <c++utilities/application/argumentparser.h>
|
||||
#include <c++utilities/application/commandlineutils.h>
|
||||
#include <c++utilities/application/failure.h>
|
||||
|
||||
#include <iostream>
|
||||
|
@ -120,12 +121,14 @@ int main(int argc, char *argv[])
|
|||
parser.parseArgs(argc, argv);
|
||||
if(qtConfigArgs.areQtGuiArgsPresent()) {
|
||||
#ifdef GUI_QTWIDGETS
|
||||
return QtGui::runWidgetsGui(argc, argv, fileArg.values().empty() ? QString() : QString::fromLocal8Bit(fileArg.values().front().data()));
|
||||
return QtGui::runWidgetsGui(argc, argv, qtConfigArgs, fileArg.values().empty() ? QString() : QString::fromLocal8Bit(fileArg.values().front().data()));
|
||||
#else
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
cout << "Application has not been build with Qt widgets GUI support." << endl;
|
||||
#endif
|
||||
}
|
||||
} catch(Failure &ex) {
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
cout << "Unable to parse arguments. " << ex.what() << "\nSee --help for available commands." << endl;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <c++utilities/application/failure.h>
|
||||
#include <c++utilities/application/argumentparser.h>
|
||||
#include <c++utilities/application/commandlineutils.h>
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
#include <c++utilities/conversion/conversionexception.h>
|
||||
#include <c++utilities/io/ansiescapecodes.h>
|
||||
|
@ -122,6 +123,7 @@ void printNotifications(const MediaFileInfo &fileInfo, const char *head = nullpt
|
|||
|
||||
void printFieldNames(const StringVector ¶meterValues)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
VAR_UNUSED(parameterValues)
|
||||
cout << "title album artist genre year comment bpm bps lyricist track disk part totalparts encoder\n"
|
||||
"recorddate performers duration language encodersettings lyrics synchronizedlyrics grouping\n"
|
||||
|
@ -130,6 +132,7 @@ void printFieldNames(const StringVector ¶meterValues)
|
|||
|
||||
void removeBackupFiles(const StringVector ¶meterValues, const Argument &recursiveArg)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
QDir dir(QString::fromStdString(parameterValues.at(0)));
|
||||
QStringList affectedFiles;
|
||||
int filesFound = Utility::removeBackupFiles(dir, affectedFiles, &cout, recursiveArg.isPresent());
|
||||
|
@ -367,7 +370,8 @@ unsigned int parseFieldDenotations(const StringVector &fieldDenotations, bool re
|
|||
|
||||
void generateFileInfo(const StringVector ¶meterValues, const Argument &inputFileArg, const Argument &outputFileArg, const Argument &validateArg)
|
||||
{
|
||||
Q_UNUSED(parameterValues)
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
VAR_UNUSED(parameterValues)
|
||||
try {
|
||||
// parse tags
|
||||
MediaFileInfo inputFileInfo(inputFileArg.values().front());
|
||||
|
@ -422,6 +426,7 @@ void printProperty(const char *propName, const intType value, const char *suffix
|
|||
|
||||
void displayFileInfo(const StringVector &, const Argument &filesArg)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
if(!filesArg.valueCount()) {
|
||||
cout << "Error: No files have been specified." << endl;
|
||||
return;
|
||||
|
@ -516,6 +521,7 @@ void displayFileInfo(const StringVector &, const Argument &filesArg)
|
|||
|
||||
void displayTagInfo(const StringVector ¶meterValues, const Argument &filesArg)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
if(!filesArg.valueCount()) {
|
||||
cout << "Error: No files have been specified." << endl;
|
||||
return;
|
||||
|
@ -594,6 +600,7 @@ void setTagInfo(const StringVector ¶meterValues, const Argument &filesArg, c
|
|||
const Argument &treatUnknownFilesAsMp3FilesArg, const Argument &id3v1UsageArg, const Argument &id3v2UsageArg,
|
||||
const Argument &mergeMultipleSuccessiveTagsArg, const Argument &id3v2VersionArg, const Argument &encodingArg)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
if(!filesArg.valueCount()) {
|
||||
cout << "Error: No files have been specified." << endl;
|
||||
return;
|
||||
|
@ -709,6 +716,7 @@ void setTagInfo(const StringVector ¶meterValues, const Argument &filesArg, c
|
|||
|
||||
void extractField(const StringVector ¶meterValues, const Argument &inputFileArg, const Argument &outputFileArg)
|
||||
{
|
||||
CMD_UTILS_START_CONSOLE;
|
||||
FieldDenotation fields[knownFieldArraySize];
|
||||
unsigned int validDenotations = parseFieldDenotations(parameterValues, true, fields);
|
||||
if(validDenotations != 1) {
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
#include "initiate.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "application/settings.h"
|
||||
|
||||
#include <qtutilities/resources/qtconfigarguments.h>
|
||||
#include <qtutilities/resources/resources.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
using namespace ApplicationUtilities;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
int runWidgetsGui(int argc, char *argv[], const QString &path)
|
||||
int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &path)
|
||||
{
|
||||
SET_QT_APPLICATION_INFO;
|
||||
QApplication a(argc, argv);
|
||||
LOAD_QT_TRANSLATIONS;
|
||||
// load resources needed by classes of qtutilities
|
||||
QtUtilitiesResources::init();
|
||||
Theme::setup();
|
||||
// apply settings specified via command line args
|
||||
qtConfigArgs.applySettings();
|
||||
LOAD_QT_TRANSLATIONS;
|
||||
Settings::restore();
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
QT_FORWARD_DECLARE_CLASS(QString)
|
||||
|
||||
namespace ApplicationUtilities {
|
||||
class QtConfigArguments;
|
||||
}
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
int runWidgetsGui(int argc, char *argv[], const QString &path);
|
||||
int runWidgetsGui(int argc, char *argv[], const ApplicationUtilities::QtConfigArguments &qtConfigArgs, const QString &path);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue