dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) : QDialog(parent), ui(new Ui::dlgPackageExporter) { mpHost = host; ui->setupUi(this); treeWidget = ui->treeWidget; closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close); exportButton = new QPushButton(tr("&Export")); // //HEIKO: added ability to make fully fledged Mudlet packages including a package // name config file and arbitray additional package content selection. // However, this feature is currently restricted to windows only // until quazip is part of the other Mudlet builds //#ifdef Q_OS_WIN ui->browseButton->hide(); ui->filePath->hide(); ui->textLabel1->hide(); packageName = QInputDialog::getText(0,"Package Name", "Package Name"); QString packagePath = QFileDialog::getExistingDirectory(0,"Where do you want to save the package?","Where do you want to save the package?"); tempDir = QDir::homePath()+"/.config/mudlet/profiles/"+mpHost->getName()+"/tmp/"; packagePath.replace("\\", "/"); tempDir = tempDir + "/" + packageName; QDir packageDir = QDir(tempDir); if ( !packageDir.exists() ){ packageDir.mkpath(tempDir); } zipFile = packagePath + "/" + packageName + ".zip"; filePath = tempDir + "/" + packageName + ".xml"; QString luaConfig = tempDir + "/config.lua"; QFile configFile(luaConfig); QStringList strings; if (configFile.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&configFile); out << "mpackage = \"" << packageName << "\"\n"; out.flush(); configFile.close(); } connect(ui->addFiles, SIGNAL(clicked()), this, SLOT(slot_addFiles())); //#else // ui->addFiles->hide(); // ui->textLabel1_2->hide(); // connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button())); // exportButton->setDisabled(true); // disabled by default until the user selects a location //#endif ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole); connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package())); listTriggers(); listAliases(); listKeys(); listScripts(); listActions(); listTimers(); }
dlgPackageExporter::dlgPackageExporter(QWidget *parent, Host* host) : QDialog(parent), ui(new Ui::dlgPackageExporter) { mpHost = host; ui->setupUi(this); treeWidget = ui->treeWidget; connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(slot_browse_button())); closeButton = ui->buttonBox->addButton (QDialogButtonBox::Close); exportButton = new QPushButton(tr("&Export")); exportButton->setDisabled(true); // disabled by default until the user selects a location ui->buttonBox->addButton(exportButton, QDialogButtonBox::ResetRole); connect(exportButton, SIGNAL(clicked()), this, SLOT(slot_export_package())); listTriggers(); listAliases(); listKeys(); listScripts(); listActions(); listTimers(); }
int main( int argc, const char **argv ) { rtError rc; rtRemoteEnvironment *env= 0; const char* srcName= 0; const char* fileName= 0; const char* endpointName= 0; bool toFile= false; bool toEndpoint= false; int duration= -1; int len; printf("mediacapture-test v1.0\n"); if ( argc > 4 ) { showUsage(); } else { if ( argc > 1 ) { len= strlen(argv[1]); if ( (len == 4) && !strncmp( argv[1], "file", len) ) { toFile= true; } else if ( (len == 8) && !strncmp( argv[1], "endpoint", len) ) { toEndpoint= true; } } if ( argc > 2 ) { if ( toFile ) { fileName= argv[2]; } else if ( toEndpoint ) { endpointName= argv[2]; } } if ( argc > 3 ) { duration= atoi(argv[3]); } if ( !toFile && !toEndpoint ) { showUsage(); exit(0); } if ( duration < 0 ) { duration= 30000; } printf("will capture to %s (%s)\n", (toFile?"file":"endpoint"), (toFile?fileName:endpointName)); env= rtEnvironmentGetGlobal(); rc= rtRemoteInit(env); if ( rc == RT_OK ) { rtObjectRef registry; struct sigaction sigint; rc= rtRemoteLocateObject(env, "mediacaptureregistry", registry); if ( rc == RT_OK ) { sigint.sa_handler= signalHandler; sigemptyset(&sigint.sa_mask); sigint.sa_flags= SA_RESETHAND; sigaction(SIGINT, &sigint, NULL); setBlockingMode(NON_BLOCKING_ENABLED); listActions(); gRunning= true; while( gRunning ) { rtRemoteProcessSingleItem( env ); if ( isKeyHit() ) { int src= -1; int c= fgetc(stdin); switch( c ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': src= c-'0'; getAvailablePipelines(env, registry); if ( toFile ) { captureSourceToFile( src, fileName, duration, env ); } else { startCaptureSourceToEndpoint( src, endpointName, duration, env ); } break; case 's': if ( !toFile ) { if ( gSrcActive != -1 ) { stopCaptureSourceToEndpoint( gSrcActive, env ); } } break; case 'l': displayPipelineList(env, registry); break; case 'i': displayMediaConsumptionInfo(env, registry); break; case 'c': clearMediaConsumptionInfo(env, registry); break; case 'q': gRunning= false; break; default: listActions(); break; } } usleep( 10000 ); } setBlockingMode(NON_BLOCKING_DISABLED); } else { printf("error: unable to locate registry: %d", rc); } } else { printf("error: rtRemoteInit rc %d\n", rc); } } return 0; }