Changeset 1035


Ignore:
Timestamp:
Mar 24, 2016, 11:28:41 PM (9 years ago)
Author:
s10k
Message:

Vago 9.0b

Location:
Vago/trunk/Vago
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • Vago/trunk/Vago/converter.cpp

    r1031 r1035  
    3737
    3838            commandToExec=commands.mid(currentIndex,(nextIndex-currentIndex));
    39             this->myProcess->start(GlobalVars::OniSplitExeName+" "+commandToExec);
     39            this->myProcess->start(Util::getOniSplitExeName() +" "+commandToExec);
    4040            this->myProcess->waitForFinished(-1);
    4141
  • Vago/trunk/Vago/main.cpp

    r999 r1035  
    1 //#define USING_VM_TABLET_WARNING_FIX // Comment this line if not using a mac vm
    2 
    3 #ifdef USING_VM_TABLET_WARNING_FIX
    4 #include <qapplication.h>
    5 void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str);
    6 #endif
    7 
    81#include <QtWidgets/QApplication>
    92#include "mainwindow.h"
     
    114int main(int argc, char *argv[])
    125{
    13 
    14 #ifdef USING_VM_TABLET_WARNING_FIX
    15     qInstallMessageHandler(myMessageOutput);
    16 #endif
    176
    187    QApplication a(argc, argv);
     
    2413}
    2514
    26 #ifdef USING_VM_TABLET_WARNING_FIX
    27 void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str)
    28 {
    29 
    30     const char * msg = str.toStdString().c_str();
    31 
    32     switch (type) {
    33     case QtWarningMsg:
    34         if(QString(msg)=="QNSView handleTabletEvent: This tablet device is unknown (received no proximity event for it). Discarding event."){ // ignore this message
    35             return;
    36         }
    37         else{
    38             fprintf(stderr, "%s\n", msg);
    39             break;
    40         }
    41     case QtFatalMsg:
    42         fprintf(stderr, "%s\n", msg);
    43         abort();
    44     default:
    45         fprintf(stderr, "%s\n", msg);
    46         break;
    47     }
    48 }
    49 #endif
  • Vago/trunk/Vago/mainwindow.cpp

    r1031 r1035  
    1010    ui->setupUi(this);
    1111
    12     this->AppDir=getOSIndependentAppPath();
    13 
    14     this->myLogger = new Logger(this->AppDir); //start logger
    15 
    16     this->myLogger->writeString("Detected AppDir: "+this->AppDir);
     12    this->myLogger = new Logger(Util::getAppPath()); //start logger
     13
     14    this->myLogger->writeString("Detected AppDir: "+Util::getAppPath());
    1715    this->myLogger->writeString("True app dir: "+QDir::currentPath());
    1816
    1917    this->setWindowTitle("Vago v"+GlobalVars::AppVersion);
    2018
    21     if(!QFile::exists(this->AppDir+"/"+GlobalVars::OniSplitString)){
     19    if(!QFile::exists(Util::getAppPath()+"/"+GlobalVars::OniSplitString)){
    2220        Util::showErrorPopUp("OniSplit not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit.");
    2321        exit(1);
    2422    }
    2523
    26     if(!QFile::exists(this->AppDir+"/"+GlobalVars::XmlToolsString)){
     24    if(!QFile::exists(Util::getAppPath()+"/"+GlobalVars::XmlToolsString)){
    2725        Util::showErrorPopUp("xmlTools not found. Please download it at "+GlobalVars::ModsDomain+" and put it in the same folder of Vago. \n\nProgram will now exit.");
    2826        exit(1);
    2927    }
    3028
    31     this->vagoSettings = new QSettings(this->AppDir + "/" + this->VagoSettingsName, QSettings::IniFormat);
     29    this->vagoSettings = new QSettings(Util::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat);
    3230
    3331    //First Execution? Old configuration? Settings missed?
     
    3836    }
    3937    if(!this->vagoSettings->contains("Workspace")){
    40         this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace");
     38        this->vagoSettings->setValue("Workspace", Util::getAppPath()+"/VagoWorkspace");
    4139        iniChanged=true;
    4240    }
     
    121119
    122120    //Create a thread for do the conversion in background
    123     this->myConverter = new Converter(this->AppDir,this->myLogger,this->listToProccess);
     121    this->myConverter = new Converter(Util::getAppPath(),this->myLogger,this->listToProccess);
    124122
    125123    // User interface
     
    189187void MainWindow::on_actionSound_Wizard_triggered()
    190188{
    191     SoundWizard myWizard (this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
     189    SoundWizard myWizard (Util::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap);
    192190    myWizard.exec();
    193191}
     
    11891187{
    11901188    QProcess *myProcess = new QProcess();
    1191     myProcess->setWorkingDirectory(this->AppDir);
    1192     myProcess->start(GlobalVars::OniSplitExeName+" -version");
     1189    myProcess->setWorkingDirectory(Util::getAppPath());
     1190    myProcess->start(Util::getOniSplitExeName()+" -version");
    11931191    myProcess->waitForFinished(-1);
    11941192    QString result=myProcess->readAllStandardOutput();
     
    12001198{
    12011199    QProcess *myProcess = new QProcess();
    1202     myProcess->setWorkingDirectory(this->AppDir);
    1203     myProcess->start(GlobalVars::XmlToolsExeName+" version");
     1200    myProcess->setWorkingDirectory(Util::getAppPath());
     1201    myProcess->start(Util::getXmlToolsExeName()+" version");
    12041202    myProcess->waitForFinished(-1);
    12051203    QString result=myProcess->readLine();
     
    15731571}
    15741572
    1575 /**
    1576   Gets application directory. In mac os gets the .app directory
    1577   **/
    1578 QString MainWindow::getOSIndependentAppPath(){
    1579 #ifdef Q_OS_MAC
    1580     QDir dir = QDir(QCoreApplication::applicationDirPath());
    1581     if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
    1582         dir.cdUp();
    1583         dir.cdUp();
    1584         dir.cdUp();
    1585     }
    1586     return dir.absolutePath();
    1587 #else
    1588     return  QDir::currentPath();
    1589 #endif
    1590 }
    1591 
    15921573void MainWindow::connectSlots(){
    15931574
  • Vago/trunk/Vago/mainwindow.h

    r999 r1035  
    184184    Ui::MainWindow *ui;
    185185    Logger *myLogger;
    186     QString AppDir;
    187186    QString workspaceLocation; //Workspace location
    188187    QString workspaceWizardsLocation; //Workspace wizard location
  • Vago/trunk/Vago/manualcommands.cpp

    r771 r1035  
    11#include "manualcommands.h"
    22#include "ui_manualcommands.h"
     3#include <QDebug>
    34
    45ManualCommands::ManualCommands(QWidget *parent) :
     
    1011    this->myProcess = new QProcess();
    1112    this->myProcess->setProcessChannelMode(QProcess::MergedChannels);
     13    this->myProcess->setWorkingDirectory(Util::getAppPath());
    1214    ui->leManualCommand->installEventFilter(this);
    1315
     
    6062    }
    6163
    62     this->myProcess->start(GlobalVars::OniSplitExeName+" "+ui->leManualCommand->text());
     64    QString var = Util::getOniSplitExeName() +" "+ui->leManualCommand->text();
     65
     66    this->myProcess->start(Util::getOniSplitExeName()+" "+ui->leManualCommand->text());
    6367    this->myProcess->waitForFinished(120000); //wait 2 minutes at maximum
    6468    ui->ptOutput->appendPlainText("> "+command);
     
    135139                        !(this->nextInsertHistoryIdx==0 && this->searchHistoryIdx==this->limHistory-1)){ //for when it did the round
    136140                    this->searchHistoryIdx++;
    137                  }
     141                }
    138142
    139143                //rotate
  • Vago/trunk/Vago/packageWizard/packagewizard.cpp

    r998 r1035  
    205205        }
    206206        QDir().mkpath(path); //create path if doesn't exist
    207         if(!Util::cpDir(sourceFolder,path+Util::cutName(sourceFolder))){//copy contents (creates dest destination automatically if not exists yet)
    208             QString errorString="An error occurred while copping the folder/files to the package folder: \n"
     207        if(!Util::copyDir(sourceFolder,path+Util::cutName(sourceFolder),false)){//copy contents (creates dest destination automatically if not exists yet)
     208            QString errorString="An error occurred while copying the folder/files to the package folder: \n"
    209209                    "Copying from "+sourceFolder+"\n to "+path+Util::cutName(sourceFolder);
    210210            Util::showErrorLogPopUp(errorString);
  • Vago/trunk/Vago/readme.txt

    r998 r1035  
    11Readme.txt
    22~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 Vago GUI v0.9a
     3Vago GUI v0.9b
    44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    55
     
    2626----------------------------------
    2727
    28 Script10k, "faob2@hotmail.com"
     28s10k, "faob2@hotmail.com"
    2929
    3030Oni Central Forum:
     
    3737----------------------------------
    3838Change Log:
     39----------------------------------
     400.9b, 25-03-2016
     41- Fixes for Mac OS X 10.11: fixed OniSplit integration, fixed startup bug (Iritsen's fix),
     42fixed bug when copying and creating AEI packages
     43- Fixed OniSplit command in Sound Package Wizard
    3944----------------------------------
    40450.9a, 25-04-2014
  • Vago/trunk/Vago/soundWizard/soundpagefinal.cpp

    r815 r1035  
    197197    for(int i=0; i<this->page2Table->rowCount(); i++){
    198198
    199         (*this->oniSplitCommands) << this->commandMap->value("general->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
     199        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
    200200
    201201        currFileName=this->page2Table->item(i,0)->text(); // get current file name
     
    213213    }
    214214
    215     (*this->oniSplitCommands) << this->commandMap->value("general->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(GlobalVars::VagoTemporaryDir+"/*.xml");
     215    (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(GlobalVars::VagoTemporaryDir+"/*.xml");
    216216
    217217    this->myConverter->start(); // finally process the onisplit commands
  • Vago/trunk/Vago/util.cpp

    r998 r1035  
    140140}
    141141
    142 //Copied from here: http://stackoverflow.com/questions/2536524/copy-directory-using-qt (ty roop)
    143 bool cpDir(const QString &srcPath, const QString &dstPath)
     142// from here: https://gzeki.com/blog/view/Recursive_copy_files_from_one_directory_to_another_in_C++_(Qt_5)
     143bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit)
    144144{
    145     rmDir(dstPath);
    146 
    147     QDir parentDstDir(QFileInfo(dstPath).path());
    148     if (!parentDstDir.mkdir(QFileInfo(dstPath).fileName()))
    149         return false;
    150 
    151     QDir srcDir(srcPath);
    152     foreach(const QFileInfo &info, srcDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) {
    153         QString srcItemPath = srcPath + "/" + info.fileName();
    154         QString dstItemPath = dstPath + "/" + info.fileName();
    155         if (info.isDir()) {
    156             if (!cpDir(srcItemPath, dstItemPath)) {
    157                 return false;
     145    QDir dir;
     146    dir.setPath(from_dir);
     147
     148    from_dir += QDir::separator();
     149    to_dir += QDir::separator();
     150
     151    foreach (QString copy_file, dir.entryList(QDir::Files))
     152    {
     153        QString from = from_dir + copy_file;
     154        QString to = to_dir + copy_file;
     155
     156        if (QFile::exists(to))
     157        {
     158            if (replace_on_conflit)
     159            {
     160                if (QFile::remove(to) == false)
     161                {
     162                    return false;
     163                }
    158164            }
    159         } else if (info.isFile()) {
    160             if (!QFile::copy(srcItemPath, dstItemPath)) {
    161                 return false;
     165            else
     166            {
     167                continue;
    162168            }
    163         } else {
    164             qDebug("Unhandled item" + info.filePath().toUtf8() + "in cpDir");
    165         }
    166     }
     169        }
     170
     171        if (QFile::copy(from, to) == false)
     172        {
     173            return false;
     174        }
     175    }
     176
     177    foreach (QString copy_dir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
     178    {
     179        QString from = from_dir + copy_dir;
     180        QString to = to_dir + copy_dir;
     181
     182        if (dir.mkpath(to) == false)
     183        {
     184            return false;
     185        }
     186
     187        if (copyDir(from, to, replace_on_conflit) == false)
     188        {
     189            return false;
     190        }
     191    }
     192
    167193    return true;
    168194}
     
    187213}
    188214
     215
    189216QString fullTrim(QString str) {
    190217
     
    196223
    197224void openLogFile(){
    198     QDesktopServices::openUrl(QUrl("file:///"+QDir::currentPath()+"/"+GlobalVars::AppLogName));
     225    QDesktopServices::openUrl(QUrl("file:///"+Util::getAppPath()+"/"+GlobalVars::AppLogName));
    199226}
    200227
     
    250277}
    251278
    252 }
     279/**
     280  Gets application directory. In mac os gets the .app directory
     281  **/
     282QString getOSIndependentAppPath(){
     283#ifdef Q_OS_MAC
     284    QDir dir = QDir(QCoreApplication::applicationDirPath());
     285    if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it
     286        dir.cdUp();
     287        dir.cdUp();
     288        dir.cdUp();
     289    }
     290    return dir.absolutePath();
     291#else
     292    return  QDir::currentPath();
     293#endif
     294}
     295
     296QString getAppPath(){
     297    return getOSIndependentAppPath();
     298}
     299
     300QString getOniSplitExeName(){
     301
     302#ifdef Q_OS_MAC
     303    return getMonoExecutablePath() + " " + GlobalVars::OniSplitString;
     304#elif
     305    return GlobalVars::OniSplitString;
     306#endif
     307}
     308
     309QString getXmlToolsExeName(){
     310
     311#ifdef Q_OS_MAC
     312    return getMonoExecutablePath() + " " + GlobalVars::XmlToolsString;
     313#elif
     314    return GlobalVars::XmlToolsString;
     315#endif
     316}
     317
     318#ifdef Q_OS_MAC
     319QString getMonoExecutablePath(){
     320
     321    // Only way that I found to get mono working in 10.11
     322    QString possibleMonoDir = "/usr/local/bin/mono";
     323    QFileInfo checkFile(possibleMonoDir);
     324
     325    if (checkFile.exists() && checkFile.isFile()) {
     326        return possibleMonoDir;
     327    } else {
     328        return "mono";
     329    }
     330
     331}
     332#endif
     333
     334}
  • Vago/trunk/Vago/util.h

    r998 r1035  
    1313
    1414namespace GlobalVars{
    15 const QString AppVersion="0.9a";
     15
     16const QString AppVersion="0.9b";
    1617const QString OniSplitString="OniSplit.exe";
    1718const QString XmlToolsString="xmlTools.exe";
     
    1920#ifdef Q_OS_WIN
    2021const QString OniExe="Oni.exe";
    21 const QString OniSplitExeName=OniSplitString;
    22 const QString XmlToolsExeName=XmlToolsString;
    2322#else
    2423const QString OniExe="Oni.app/Contents/MacOS/Oni";
    25 const QString OniSplitExeName="mono "+OniSplitString; // Mac uses mono to run .net applications
    26 const QString XmlToolsExeName="mono "+XmlToolsString;
    2724#endif
    2825
     
    5552QString fullTrim(QString str);
    5653QString normalizeDecimalSeparator(QString value);
     54QString getOSIndependentAppPath();
     55QString getAppPath();
     56QString getOniSplitExeName();
     57QString getXmlToolsExeName();
     58#ifdef Q_OS_MAC
     59QString getMonoExecutablePath();
     60#endif
    5761
    5862QStringList multipleDirDialog(QString title);
     
    6569bool isStringInteger(QString myString);
    6670bool isStringDouble(QString myString);
    67 bool cpDir(const QString &srcPath, const QString &dstPath);
     71bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit);
    6872bool rmDir(const QString &dirPath);
    69 bool removeDir(const QString &dirName);
    7073QRect getScreenResolution();
    7174void showPopUp(QString message);
     
    7780void openLogFile();
    7881}
    79 
    8082#endif // UTIL_H
  • Vago/trunk/Vago/xmlprocessor.cpp

    r815 r1035  
    1919    for(int i=0; i<this->commands->size(); i++){
    2020
    21         myProcess->start(GlobalVars::XmlToolsExeName+" "+this->commands->at(i));
     21        myProcess->start(Util::getXmlToolsExeName() +" "+this->commands->at(i));
    2222        myProcess->waitForFinished(-1);
    2323        result=myProcess->readAllStandardError();
Note: See TracChangeset for help on using the changeset viewer.