#include <QCoreApplication>
#include <QLocale>
#include <QTranslator>
#include <QDebug>
#include "StoryChainDocumentParser.h"
#include "StoryUnitDocumentParser.h"
#include "storyboarddocumentparser.h"
#include "ParseFrame.h"

using namespace Parse;
using namespace Parse::Result;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QTranslator translator;
    const QStringList uiLanguages = QLocale::system().uiLanguages();
    for (const QString &locale : uiLanguages) {
        const QString baseName = "DesParser_" + QLocale(locale).name();
        if (translator.load(":/i18n/" + baseName)) {
            a.installTranslator(&translator);
            break;
        }
    }

//    StoryChainDocumentParser frame(nullptr);
//    DocCore doc(nullptr, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storychain");
//    auto retlist = frame.analysis(&doc, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storychain");


//    StoryUnitDocumentParser frame(nullptr);
//    DocCore doc(nullptr, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyunit");
//    auto retlist = frame.analysis(&doc, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyunit");


    StoryBoardDocumentParser frame(nullptr);
    DocCore doc(nullptr, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyboard");
    auto retlist = frame.analysis(&doc, "D:\\Projects\\Cpp\\QtNovelDesc\\DesParser\\example.storyboard");


    for (auto x : qAsConst(retlist)) {
        qDebug().noquote() << x->toString();
    }

    return a.exec();
}
