- Timestamp:
- Mar 24, 2016, 11:28:41 PM (9 years ago)
- Location:
- Vago/trunk/Vago
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Vago/trunk/Vago/converter.cpp
r1031 r1035 37 37 38 38 commandToExec=commands.mid(currentIndex,(nextIndex-currentIndex)); 39 this->myProcess->start( GlobalVars::OniSplitExeName+" "+commandToExec);39 this->myProcess->start(Util::getOniSplitExeName() +" "+commandToExec); 40 40 this->myProcess->waitForFinished(-1); 41 41 -
Vago/trunk/Vago/main.cpp
r999 r1035 1 //#define USING_VM_TABLET_WARNING_FIX // Comment this line if not using a mac vm2 3 #ifdef USING_VM_TABLET_WARNING_FIX4 #include <qapplication.h>5 void myMessageOutput(QtMsgType type, const QMessageLogContext &, const QString & str);6 #endif7 8 1 #include <QtWidgets/QApplication> 9 2 #include "mainwindow.h" … … 11 4 int main(int argc, char *argv[]) 12 5 { 13 14 #ifdef USING_VM_TABLET_WARNING_FIX15 qInstallMessageHandler(myMessageOutput);16 #endif17 6 18 7 QApplication a(argc, argv); … … 24 13 } 25 14 26 #ifdef USING_VM_TABLET_WARNING_FIX27 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 message35 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 10 10 ui->setupUi(this); 11 11 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()); 17 15 this->myLogger->writeString("True app dir: "+QDir::currentPath()); 18 16 19 17 this->setWindowTitle("Vago v"+GlobalVars::AppVersion); 20 18 21 if(!QFile::exists( this->AppDir+"/"+GlobalVars::OniSplitString)){19 if(!QFile::exists(Util::getAppPath()+"/"+GlobalVars::OniSplitString)){ 22 20 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."); 23 21 exit(1); 24 22 } 25 23 26 if(!QFile::exists( this->AppDir+"/"+GlobalVars::XmlToolsString)){24 if(!QFile::exists(Util::getAppPath()+"/"+GlobalVars::XmlToolsString)){ 27 25 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."); 28 26 exit(1); 29 27 } 30 28 31 this->vagoSettings = new QSettings( this->AppDir+ "/" + this->VagoSettingsName, QSettings::IniFormat);29 this->vagoSettings = new QSettings(Util::getAppPath() + "/" + this->VagoSettingsName, QSettings::IniFormat); 32 30 33 31 //First Execution? Old configuration? Settings missed? … … 38 36 } 39 37 if(!this->vagoSettings->contains("Workspace")){ 40 this->vagoSettings->setValue("Workspace", this->AppDir+"/VagoWorkspace");38 this->vagoSettings->setValue("Workspace", Util::getAppPath()+"/VagoWorkspace"); 41 39 iniChanged=true; 42 40 } … … 121 119 122 120 //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); 124 122 125 123 // User interface … … 189 187 void MainWindow::on_actionSound_Wizard_triggered() 190 188 { 191 SoundWizard myWizard ( this->AppDir, this->workspaceWizardsLocation, this->myLogger, &this->commandMap);189 SoundWizard myWizard (Util::getAppPath(), this->workspaceWizardsLocation, this->myLogger, &this->commandMap); 192 190 myWizard.exec(); 193 191 } … … 1189 1187 { 1190 1188 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"); 1193 1191 myProcess->waitForFinished(-1); 1194 1192 QString result=myProcess->readAllStandardOutput(); … … 1200 1198 { 1201 1199 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"); 1204 1202 myProcess->waitForFinished(-1); 1205 1203 QString result=myProcess->readLine(); … … 1573 1571 } 1574 1572 1575 /**1576 Gets application directory. In mac os gets the .app directory1577 **/1578 QString MainWindow::getOSIndependentAppPath(){1579 #ifdef Q_OS_MAC1580 QDir dir = QDir(QCoreApplication::applicationDirPath());1581 if(dir.absolutePath().contains(".app")){ // include bundle, but we don't want it1582 dir.cdUp();1583 dir.cdUp();1584 dir.cdUp();1585 }1586 return dir.absolutePath();1587 #else1588 return QDir::currentPath();1589 #endif1590 }1591 1592 1573 void MainWindow::connectSlots(){ 1593 1574 -
Vago/trunk/Vago/mainwindow.h
r999 r1035 184 184 Ui::MainWindow *ui; 185 185 Logger *myLogger; 186 QString AppDir;187 186 QString workspaceLocation; //Workspace location 188 187 QString workspaceWizardsLocation; //Workspace wizard location -
Vago/trunk/Vago/manualcommands.cpp
r771 r1035 1 1 #include "manualcommands.h" 2 2 #include "ui_manualcommands.h" 3 #include <QDebug> 3 4 4 5 ManualCommands::ManualCommands(QWidget *parent) : … … 10 11 this->myProcess = new QProcess(); 11 12 this->myProcess->setProcessChannelMode(QProcess::MergedChannels); 13 this->myProcess->setWorkingDirectory(Util::getAppPath()); 12 14 ui->leManualCommand->installEventFilter(this); 13 15 … … 60 62 } 61 63 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()); 63 67 this->myProcess->waitForFinished(120000); //wait 2 minutes at maximum 64 68 ui->ptOutput->appendPlainText("> "+command); … … 135 139 !(this->nextInsertHistoryIdx==0 && this->searchHistoryIdx==this->limHistory-1)){ //for when it did the round 136 140 this->searchHistoryIdx++; 137 141 } 138 142 139 143 //rotate -
Vago/trunk/Vago/packageWizard/packagewizard.cpp
r998 r1035 205 205 } 206 206 QDir().mkpath(path); //create path if doesn't exist 207 if(!Util::c pDir(sourceFolder,path+Util::cutName(sourceFolder))){//copy contents (creates dest destination automatically if not exists yet)208 QString errorString="An error occurred while cop ping 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" 209 209 "Copying from "+sourceFolder+"\n to "+path+Util::cutName(sourceFolder); 210 210 Util::showErrorLogPopUp(errorString); -
Vago/trunk/Vago/readme.txt
r998 r1035 1 1 Readme.txt 2 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 Vago GUI v0.9 a3 Vago GUI v0.9b 4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 5 … … 26 26 ---------------------------------- 27 27 28 Script10k, "faob2@hotmail.com"28 s10k, "faob2@hotmail.com" 29 29 30 30 Oni Central Forum: … … 37 37 ---------------------------------- 38 38 Change Log: 39 ---------------------------------- 40 0.9b, 25-03-2016 41 - Fixes for Mac OS X 10.11: fixed OniSplit integration, fixed startup bug (Iritsen's fix), 42 fixed bug when copying and creating AEI packages 43 - Fixed OniSplit command in Sound Package Wizard 39 44 ---------------------------------- 40 45 0.9a, 25-04-2014 -
Vago/trunk/Vago/soundWizard/soundpagefinal.cpp
r815 r1035 197 197 for(int i=0; i<this->page2Table->rowCount(); i++){ 198 198 199 (*this->oniSplitCommands) << this->commandMap->value(" general->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert199 (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert 200 200 201 201 currFileName=this->page2Table->item(i,0)->text(); // get current file name … … 213 213 } 214 214 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"); 216 216 217 217 this->myConverter->start(); // finally process the onisplit commands -
Vago/trunk/Vago/util.cpp
r998 r1035 140 140 } 141 141 142 // Copied from here: http://stackoverflow.com/questions/2536524/copy-directory-using-qt (ty roop)143 bool c pDir(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) 143 bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit) 144 144 { 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 } 158 164 } 159 } else if (info.isFile()) {160 if (!QFile::copy(srcItemPath, dstItemPath)){161 return false;165 else 166 { 167 continue; 162 168 } 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 167 193 return true; 168 194 } … … 187 213 } 188 214 215 189 216 QString fullTrim(QString str) { 190 217 … … 196 223 197 224 void openLogFile(){ 198 QDesktopServices::openUrl(QUrl("file:///"+ QDir::currentPath()+"/"+GlobalVars::AppLogName));225 QDesktopServices::openUrl(QUrl("file:///"+Util::getAppPath()+"/"+GlobalVars::AppLogName)); 199 226 } 200 227 … … 250 277 } 251 278 252 } 279 /** 280 Gets application directory. In mac os gets the .app directory 281 **/ 282 QString 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 296 QString getAppPath(){ 297 return getOSIndependentAppPath(); 298 } 299 300 QString getOniSplitExeName(){ 301 302 #ifdef Q_OS_MAC 303 return getMonoExecutablePath() + " " + GlobalVars::OniSplitString; 304 #elif 305 return GlobalVars::OniSplitString; 306 #endif 307 } 308 309 QString 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 319 QString 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 13 13 14 14 namespace GlobalVars{ 15 const QString AppVersion="0.9a"; 15 16 const QString AppVersion="0.9b"; 16 17 const QString OniSplitString="OniSplit.exe"; 17 18 const QString XmlToolsString="xmlTools.exe"; … … 19 20 #ifdef Q_OS_WIN 20 21 const QString OniExe="Oni.exe"; 21 const QString OniSplitExeName=OniSplitString;22 const QString XmlToolsExeName=XmlToolsString;23 22 #else 24 23 const QString OniExe="Oni.app/Contents/MacOS/Oni"; 25 const QString OniSplitExeName="mono "+OniSplitString; // Mac uses mono to run .net applications26 const QString XmlToolsExeName="mono "+XmlToolsString;27 24 #endif 28 25 … … 55 52 QString fullTrim(QString str); 56 53 QString normalizeDecimalSeparator(QString value); 54 QString getOSIndependentAppPath(); 55 QString getAppPath(); 56 QString getOniSplitExeName(); 57 QString getXmlToolsExeName(); 58 #ifdef Q_OS_MAC 59 QString getMonoExecutablePath(); 60 #endif 57 61 58 62 QStringList multipleDirDialog(QString title); … … 65 69 bool isStringInteger(QString myString); 66 70 bool isStringDouble(QString myString); 67 bool c pDir(const QString &srcPath, const QString &dstPath);71 bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit); 68 72 bool rmDir(const QString &dirPath); 69 bool removeDir(const QString &dirName);70 73 QRect getScreenResolution(); 71 74 void showPopUp(QString message); … … 77 80 void openLogFile(); 78 81 } 79 80 82 #endif // UTIL_H -
Vago/trunk/Vago/xmlprocessor.cpp
r815 r1035 19 19 for(int i=0; i<this->commands->size(); i++){ 20 20 21 myProcess->start( GlobalVars::XmlToolsExeName+" "+this->commands->at(i));21 myProcess->start(Util::getXmlToolsExeName() +" "+this->commands->at(i)); 22 22 myProcess->waitForFinished(-1); 23 23 result=myProcess->readAllStandardError();
Note:
See TracChangeset
for help on using the changeset viewer.