void HumanoidDataLogger::saveData() { const wxDateTime now = wxDateTime::UNow(); wxString dataDirectory(dataSaveDirectory.c_str(),wxConvUTF8); wxString curFilePath = dataDirectory + wxT("/recentData.dat"); dataDirectory += now.FormatISODate(); wxString dataFile = now.FormatISODate() + wxT("_") + now.FormatISOTime() + wxT(".dat"); dataFile.Replace(wxT(":"), wxT("-")); wxString dataPath = dataDirectory + wxT("/") + dataFile; if(! wxDirExists(dataDirectory)) { wxMkdir(dataDirectory); } stringstream ss; ss << dataPath.mb_str(); setFile(ss.str()); writeRecords(); FILE * curFile = fopen(curFilePath.mb_str(),"w"); fprintf(curFile, "%s",ss.str().c_str()); fclose(curFile); }
system::error_code Application::prepare() { if(m_OptCameraName.empty()) { SI(hal::DeviceManager).enumerateDevices<hal::Camera>([this](intrusive_ptr<hal::Camera> const &c) -> bool { m_Camera = c; return false; }); } else { m_Camera = SI(hal::DeviceManager).findDevice<hal::Camera>(m_OptCameraName); } if(!m_Camera || m_Camera->open()) return base::makeErrorCode(base::kENoSuchDevice); m_Camera->beginConfiguration(); m_Camera->setPreviewSize(Vec2i(m_OptCameraWidth, m_OptCameraHeight)); if(!m_Camera->getSupportedVideoSizes().empty()) { m_Camera->setVideoSize(Vec2i(m_OptCameraWidth, m_OptCameraHeight)); } m_Camera->endConfiguration(); m_PoseTracker = SI(cv::AlgorithmLibrary).createPoseTracker(m_OptTracker); m_PoseTracker->setImageSize(m_Camera->getPreviewSize()); if(loadCameraCalibration(dataDirectory()/(std::string(m_Camera->name() + ".ccal")))) { m_PoseTracker->setCalibration(m_CameraCalibration); //m_Camera->close(); //m_Camera.reset(); //return base::makeErrorCode(base::kENotFound); } if(m_PoseTracker->prepare()) { m_Camera->close(); m_Camera.reset(); m_PoseTracker.reset(); return base::makeErrorCode(base::kENotFound); } m_Camera->cameraDelegate() += this; m_Camera->startPreview(); m_Camera->startRecording(); m_CameraServer.setCamera(m_Camera); m_CameraServer.start(); m_RemoteControlServer.start(); return base::makeErrorCode(base::kENoError); }
void So2sdrBandmap::showHelp() { if (help == 0) { // open help file and display it directory.setCurrent(dataDirectory()+"/so2sdr-bandmap-help"); help = new HelpDialog("so2sdr-bandmap-help.html", this); } help->show(); help->setFocus(); }
void VPiano::slotSaveKeyboardMap() { releaseKb(); QString fileName = QFileDialog::getSaveFileName(this, tr("Save keyboard map definition"), dataDirectory(), tr("Keyboard map (*.xml)")); if (!fileName.isEmpty()) { ui.pianokeybd->getKeyboardMap()->saveToXMLFile(fileName); } grabKb(); }
void VPiano::slotLoadKeyboardMap() { releaseKb(); QString fileName = QFileDialog::getOpenFileName(0, tr("Open keyboard map definition"), dataDirectory(), tr("Keyboard map (*.xml)")); if (!fileName.isEmpty()) { ui.pianokeybd->getKeyboardMap()->loadFromXMLFile(fileName); } grabKb(); }
GLMotif::PopupWindow* CartesianGrid3DParameterDialog::createDialog() { WidgetFactory factory; GLMotif::PopupWindow* parameterDialogPopup=factory.createPopupWindow("ParameterDialogPopup", "CartesianGrid3D Parameters"); GLMotif::RowColumn* parameterDialog=factory.createRowColumn("ParameterDialog", 3); factory.setLayout(parameterDialog); openFileButton = factory.createButton("OpenFileButton", "Load Data"); openFileStatusA = factory.createLabel("OpenFileStatusA", ""); openFileStatusB = factory.createLabel("OpenFileStatusB", ""); openFileButton->getSelectCallbacks().add(this, &CartesianGrid3DParameterDialog::openFileCallback); char cwd[512]; getcwd(cwd, 512); std::string dataDirectory(cwd); IO::DirectoryPtr dirptr = IO::openDirectory(dataDirectory.c_str()); fileDialog = new GLMotif::FileSelectionDialog(Vrui::getWidgetManager(), "Open file...", dirptr, ".grid"); // Need to modify FileSelectionDialog to accept filterDescriptions. For ex: "Simple Grid (.grid)" // fileDialog->addFileNameFilters("Numpy Array (.npy)"); fileDialog->getOKCallbacks().add(this, &CartesianGrid3DParameterDialog::fileOpenAction); fileDialog->getCancelCallbacks().add(this, &CartesianGrid3DParameterDialog::fileCancelAction); /* factory.createLabel("Dummy3", ""); openFileStatusC = factory.createLabel("OpenFileStatusC", ""); factory.createLabel("Dummy4", ""); */ factory.createLabel("Dummy3b", ""); shapeLabel = factory.createLabel("ShapeLabel", ""); shapeValue = factory.createLabel("ShapeValue", ""); factory.createLabel("Dummy5", ""); factory.createLabel("Dummy6", ""); factory.createLabel("Dummy7", ""); factory.createLabel("StepSizeLabel", "step size"); stepSizeValue=factory.createTextField("StepSizeValue", 10); double step_size = IntegrationStepSize::instance()->getSavedValue("CartesianGrid3D"); if (step_size > 0.0) stepSizeValue->setString(toString(step_size).c_str()); else stepSizeValue->setString("0.01"); stepSizeSlider=factory.createSlider("StepSizeSlider", 15.0); stepSizeSlider->setValueRange(0.0001, 0.05, 0.0001); if (step_size > 0.0) stepSizeSlider->setValue(step_size); else stepSizeSlider->setValue(0.01); stepSizeSlider->getValueChangedCallbacks().add(this, &CartesianGrid3DParameterDialog::sliderCallback); parameterDialog->manageChild(); return parameterDialogPopup; }
void tst_qqmltranslation::idTranslation() { QTranslator translator; translator.load(QLatin1String("qmlid_fr"), dataDirectory()); QCoreApplication::installTranslator(&translator); QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("idtranslation.qml")); QObject *object = component.create(); QVERIFY(object != 0); { QQmlContext *context = qmlContext(object); QQmlEnginePrivate *engine = QQmlEnginePrivate::get(context->engine()); QQmlTypeData *typeData = engine->typeLoader.getType(context->baseUrl()); QQmlCompiledData *cdata = typeData->compiledData(); QVERIFY(cdata); const QV4::CompiledData::Unit *unit = cdata->compilationUnit->data; const QV4::CompiledData::Object *rootObject = unit->objectAt(unit->indexOfRootObject); const QV4::CompiledData::Binding *binding = rootObject->bindingTable(); for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) { const QString propertyName = unit->stringAt(binding->propertyNameIndex); if (propertyName == "idTranslation") { if (binding->type != QV4::CompiledData::Binding::Type_TranslationById) qDebug() << "binding for property" << propertyName << "is not a compiled translation"; QCOMPARE(binding->type, quint32(QV4::CompiledData::Binding::Type_TranslationById)); } else { QVERIFY(binding->type != QV4::CompiledData::Binding::Type_Translation); } } } QCOMPARE(object->property("idTranslation").toString(), QLatin1String("bonjour tout le monde")); QCOMPARE(object->property("idTranslation2").toString(), QLatin1String("bonjour tout le monde")); QCOMPARE(object->property("idTranslation3").toString(), QLatin1String("bonjour tout le monde")); QCoreApplication::removeTranslator(&translator); delete object; }
bool ofxRGBDScene::loadFromFolder(string sourceMediaFolder, bool countFrames){ clear(); calibrationFolder = ""; videoPath = ""; alternativeHiResVideoPath = ""; pairingsFile = ""; mediaFolder = sourceMediaFolder; if(sourceMediaFolder.find("_calibration") != string::npos) { ofLogWarning("ofxRGBDScene::loadFromFolder -- Discarding _calibration folder"); return false; } if(sourceMediaFolder.find("_Renderbin/") != string::npos){ ofLogWarning("ofxRGBDScene::loadFromFolder -- Discarding Render Bin"); return false; } ofDirectory dataDirectory(mediaFolder); if(!dataDirectory.exists()){ ofLogWarning("ofxRGBDScene::loadFromFolder -- folder " + mediaFolder + " -- Directory doesn't exist."); return false; } if(!dataDirectory.isDirectory()){ ofLogWarning("ofxRGBDScene::loadFromFolder -- folder " + mediaFolder + " -- Isn't a directory!"); return false; } dataDirectory.listDir(); int numFiles = dataDirectory.numFiles(); if(numFiles == 0){ ofLogWarning("ofxRGBDScene::loadFromFolder -- folder " + mediaFolder + " -- Directory is empty."); return false; } vector<string> components = ofSplitString( mediaFolder, "/"); name = components[components.size()-1]; ////////////////////////////////////////////// // DEPTH ////////////////////////////////////////////// bool depthFolderFound = false; for(int i = 0; i < dataDirectory.numFiles(); i++){ if(dataDirectory.getFile(i).isDirectory() && (dataDirectory.getName(i).find("depth") != string::npos || dataDirectory.getName(i).find("TAKE") != string::npos) ){ depthFolder = dataDirectory.getPath(i); depthFolderFound = true; } } if(!depthFolderFound){ depthFolder = mediaFolder + "/depth/"; } ofDirectory depthDirectory = ofDirectory(depthFolder); //potentially a legacy folder. check to see if there are +20 PNG or raws's //indicating the files need to be moved ofDirectory mainDirectory(sourceMediaFolder); mainDirectory.allowExt("png"); mainDirectory.allowExt("raw"); mainDirectory.listDir(); if(mainDirectory.numFiles() > 20){ //create the depth directory if we haven't yet if(!depthDirectory.exists()){ depthDirectory.create(); } //move all the files from the main folder into the depth directory for(int i = 0; i < mainDirectory.numFiles(); i++){ string destinationPath = ofFilePath::getEnclosingDirectory(mainDirectory.getPath(i)) + "depth/" + mainDirectory.getName(i); //cout << "ofxRGBDScene -- Legacy Format -- moved to " << destinationPath << endl; //mainDirectory.getFile(i).moveTo( destinationPath ); } } if(depthDirectory.exists()){ if(countFrames){ ofDirectory compresseDepthFrames(depthFolder); compresseDepthFrames.allowExt("png"); compressedDepthFrameCount = compresseDepthFrames.listDir(); ofDirectory uncompressedDepthFrames(depthFolder); uncompressedDepthFrames.allowExt("raw"); uncompressedDepthFrameCount = uncompressedDepthFrames.listDir(); totalDepthFrameCount = uncompressedDepthFrameCount + compressedDepthFrameCount; hasDepth = (totalDepthFrameCount > 0); } else { //guess it hasDepth = true; } } ////////////////////////////////////////////// // END DEPTH ////////////////////////////////////////////// ////////////////////////////////////////////// // COLOR ////////////////////////////////////////////// string colorFolder = mediaFolder + "/color/"; ofDirectory colorDirectory = ofDirectory(colorFolder); ofDirectory mainDirectoryColor = ofDirectory(sourceMediaFolder); //TODO: make an xml file for video formats mainDirectoryColor.allowExt("mov"); mainDirectoryColor.allowExt("mpg"); mainDirectoryColor.allowExt("mepg"); mainDirectoryColor.allowExt("mp4"); mainDirectoryColor.listDir(); //move the movies into the color/ dir if they are hanging outside if(mainDirectoryColor.numFiles() > 0){ if(!colorDirectory.exists()){ colorDirectory.create(); } for(int i = 0; i < mainDirectoryColor.numFiles(); i++){ string destinationPath = ofFilePath::getEnclosingDirectory(mainDirectoryColor.getPath(i)) + "color/" + mainDirectoryColor.getName(i); // cout << "ofxRGBDScene -- Legacy Format -- moved to " << destinationPath << endl; // mainDirectoryColor.getFile(i).moveTo( destinationPath ); } } if(colorDirectory.exists()){ //TODO: make an xml file for video formats colorDirectory.allowExt("mpeg"); colorDirectory.allowExt("mov"); colorDirectory.allowExt("mpg"); colorDirectory.allowExt("mp4"); colorDirectory.listDir(); if(colorDirectory.numFiles() == 0){ hasColor = false; } else if(colorDirectory.numFiles() == 1){ hasColor = true; videoPath = colorDirectory.getPath(0); } else { int largestIndex = 0; int smallestIndex = 0; uint64_t largestSize = colorDirectory.getFile(0).getSize(); uint64_t smallestSize = colorDirectory.getFile(0).getSize(); for(int i = 0; i < colorDirectory.numFiles(); i++){ uint64_t size = colorDirectory.getFile(i).getSize(); cout << colorDirectory.getName(i) << " size is " << size << endl; if(largestSize < size){ largestSize = size; largestIndex = i; } if(size < smallestSize){ smallestSize = size; smallestIndex = i; } } hasColor = true; hasAlternativeHiResVideo = true; alternativeHiResVideoPath = colorDirectory.getPath(largestIndex); videoPath = colorDirectory.getPath(smallestIndex); // cout << "video path is " << videoPath << " alternative is " << alternativeHiResVideoPath << endl; // cout << "largest size is " << largestSize << " smallest size is " << smallestSize << endl; } if(hasColor){ videoThumbsPath = ofFilePath::removeExt(videoPath); if(!ofDirectory(videoThumbsPath).exists()){ ofDirectory(videoThumbsPath).create(true); } } } ////////////////////////////////////////////// // END COLOR ////////////////////////////////////////////// ////////////////////////////////////////////// // PAIRINGS FILE ////////////////////////////////////////////// if(hasColor){ ofDirectory mainDirectoryPairings = ofDirectory(sourceMediaFolder); mainDirectoryPairings.allowExt("xml"); mainDirectoryPairings.listDir(); for(int i = 0; i < mainDirectoryPairings.numFiles(); i++){ if(mainDirectoryPairings.getName(i).find("pairings") != string::npos){ pairingsFile = mainDirectoryPairings.getPath(i); hasPairings = true; } if(mainDirectoryPairings.getName(i).find("xyshift") != string::npos){ xyshiftFile = mainDirectoryPairings.getPath(i); hasXYShift = true; } } if(!hasPairings){ pairingsFile = mediaFolder + "/pairings.xml"; } if(!hasXYShift){ xyshiftFile = mediaFolder + "/xyshift.xml"; } } ////////////////////////////////////////////// // END PAIRINGS FILE ////////////////////////////////////////////// ////////////////////////////////////////////// // CALIBRATION ////////////////////////////////////////////// if(hasColor){ vector<string> calibrationFolders; calibrationFolders.push_back(mediaFolder + "/_calibration/matrices/"); calibrationFolders.push_back(mediaFolder + "/calibration/"); calibrationFolders.push_back(mediaFolder + "/../_calibration/matrices/"); for(int i = 0; i < calibrationFolders.size(); i++){ ofDirectory calibrationDirectory = ofDirectory(calibrationFolders[i]); hasCalibration = calibrationDirectory.exists(); if(hasCalibration){ calibrationFolder = calibrationFolders[i]; break; } } } ////////////////////////////////////////////// // END CALIBRATION ////////////////////////////////////////////// ////////////////////////////////////////////// // REPORT ////////////////////////////////////////////// bool debug = true; if(debug){ cout << "REPORT FOR " << sourceMediaFolder << endl; cout << "has DEPTH? " << (hasDepth ? "YES" : "NO") << endl; if(hasDepth){ cout << " # COMPRESSED DEPTH FRAMES " << compressedDepthFrameCount << endl; if(uncompressedDepthFrameCount > 0){ cout << " # UNCOMPRESSED DEPTH FRAMES " << uncompressedDepthFrameCount << endl; } } cout << "has COLOR? " << (hasColor ? "YES" : "NO") << endl; if(hasColor){ cout << "has VIDEO " << (hasColor ? "YES" : "NO") << endl; cout << "has HI RES " << (hasAlternativeHiResVideo ? "YES" : "NO") << endl; cout << "has CALIBRATION " << (hasCalibration ? "YES" : "NO") << endl; cout << "has PAIRINGS " << (hasPairings ? "YES" : "NO") << endl; if(hasPairings){ cout << "pairings! " << pairingsFile << endl; } } } ////////////////////////////////////////////// // END REPORT ////////////////////////////////////////////// return valid(); }
BrowserApplication::BrowserApplication(int &argc, char **argv) : QApplication(argc, argv) , m_localServer(0) { QCoreApplication::setOrganizationDomain(QLatin1String("arora-browser.org")); QCoreApplication::setApplicationName(QLatin1String("Arora")); QString version = QString("0.2 (Change: %1 %2)").arg(GITCHANGENUMBER).arg(GITVERSION); QCoreApplication::setApplicationVersion(version); #ifdef Q_WS_QWS // Use a different server name for QWS so we can run an X11 // browser and a QWS browser in parallel on the same machine for // debugging QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws"); #else QString serverName = QCoreApplication::applicationName(); #endif QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { QTextStream stream(&socket); QStringList args = QCoreApplication::arguments(); if (args.count() > 1) stream << args.last(); else stream << QString(); stream.flush(); socket.waitForBytesWritten(); return; } #if defined(Q_WS_MAC) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif m_localServer = new QLocalServer(this); connect(m_localServer, SIGNAL(newConnection()), this, SLOT(newLocalSocketConnection())); if (!m_localServer->listen(serverName)) { if (m_localServer->serverError() == QAbstractSocket::AddressInUseError && QFile::exists(m_localServer->serverName())) { QFile::remove(m_localServer->serverName()); m_localServer->listen(serverName); } } QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); QString localSysName = QLocale::system().name(); installTranslator(QLatin1String("qt_") + localSysName); installTranslator(dataDirectory() + QDir::separator() + "locale" + QDir::separator() + localSysName); QSettings settings; settings.beginGroup(QLatin1String("sessions")); m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray(); settings.endGroup(); #if defined(Q_WS_MAC) connect(this, SIGNAL(lastWindowClosed()), this, SLOT(lastWindowClosed())); #endif QTimer::singleShot(0, this, SLOT(postLaunch())); }
So2sdrBandmap::So2sdrBandmap(QStringList args, QWidget *parent) : QMainWindow(parent) { setupUi(this); initPointers(); initVariables(); // check to see if user directory exists initialized = checkUserDirectory(); settingsFile = userDirectory()+"/so2sdr-bandmap.ini"; // check for optional command argument giving station config file name if (args.size() > 1) { settingsFile = args[1].trimmed(); // Qt doesn't understand that ~/... implies home directory... if (settingsFile.left(1)=="~") { if (settingsFile.left(2)=="~/") { settingsFile=QDir::homePath()+settingsFile.right(settingsFile.size()-1); } else { // for cases like ~name : no easy way to parse, give up QMessageBox msgBox; msgBox.setText("Please use the complete path to the settings file."); msgBox.setInformativeText(settingsFile); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); close(); } } } QFileInfo fi(settingsFile); if (!fi.exists()) { QMessageBox msgBox; msgBox.setText("The settings file "+settingsFile+" does not exist."); msgBox.setInformativeText("Do you want to create it?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); if (msgBox.exec()==QMessageBox::Cancel) { close(); } firstTime=true; } settings = new QSettings(settingsFile,QSettings::IniFormat,this); if (settings->status()!=QSettings::NoError) { errorBox.showMessage("ERROR: problem starting qsettings"); } // if run the first time with default settings file for second radio, // set second radio if (firstTime && settingsFile.right(19)=="so2sdr-bandmap2.ini") { settings->setValue(s_sdr_nrig,1); } // restore window size and position QString tmp="BandmapWindow"; settings->beginGroup(tmp); resize(settings->value("size", QSize(400, 594)).toSize()); move(settings->value("pos", QPoint(200, 200)).toPoint()); settings->endGroup(); directory.setCurrent(dataDirectory()); setWindowIcon(QIcon("icon24x24.png")); if (settings->value(s_sdr_reverse_scroll,s_sdr_reverse_scroll_def).toBool()) { horizontalLayout->removeWidget(CallLabel); horizontalLayout->removeWidget(FreqLabel); horizontalLayout->removeWidget(display); horizontalLayout->insertWidget(0,CallLabel); horizontalLayout->insertWidget(1,FreqLabel); horizontalLayout->insertWidget(2,display); } freqPixmap = QPixmap(FreqLabel->width(), settings->value(s_sdr_fft,s_sdr_fft_def).toInt()); callPixmap = QPixmap(CallLabel->width(), settings->value(s_sdr_fft,s_sdr_fft_def).toInt()); ipAddress= QHostAddress(QHostAddress::LocalHost).toString(); if (!server.listen(QHostAddress::LocalHost, settings->value(s_sdr_bandmap_tcp_port,s_sdr_bandmap_tcp_port_def).toInt())) { qDebug("couldn't start tcp server"); } connect(&server, SIGNAL(newConnection()), this, SLOT(startConnection())); setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::NoFocus); display->setFocusPolicy(Qt::NoFocus); CallLabel->setFocusPolicy(Qt::NoFocus); FreqLabel->setFocusPolicy(Qt::NoFocus); checkBoxMark.setText("Mark"); checkBoxMark.setToolTip("Enables signal detection."); toolBar->setMovable(false); QWidget* spacer1 = new QWidget(); spacer1->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); toolBar->addWidget(spacer1); toolBar->addWidget(&checkBoxMark); txLabel.clear(); txLabel.setText("<font color=#000000>TX"); toolBar->addWidget(&txLabel); slider.setToolTip("Gain for signal detection. To the right is LESS sensitive."); slider.setOrientation(Qt::Horizontal); connect(&slider,SIGNAL(valueChanged(int)),this,SLOT(updateLevel(int))); slider.setFixedWidth(60); slider.setMaximum(200); slider.setMinimum(0); slider.setSingleStep(10); slider.setPageStep(50); slider.setValue(settings->value(s_sdr_level,s_sdr_level_def).toInt()); toolBar->addWidget(&slider); QWidget* spacer2 = new QWidget(); spacer2->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); toolBar->addWidget(spacer2); toolBar->addAction("&Help",this,SLOT(showHelp())); iqDialog = new IQBalance(this, Qt::Window); iqDialog->clearPlots(); showToolBar = new QAction("&toolbar",this); scaleX1 = new QAction("Zoom x&1", this); scaleX2 = new QAction("Zoom x&2", this); deleteAct = new QAction("&Delete Call", this); checkBoxMark.setChecked(settings->value(s_sdr_peakdetect,s_sdr_peakdetect_def).toBool()); iqShowData = new QAction("IQ Balance", this); connect(iqShowData, SIGNAL(triggered()), this, SLOT(showIQData())); connect(&checkBoxMark, SIGNAL(clicked()), this, SLOT(emitParams())); connect(deleteAct, SIGNAL(triggered()), this, SLOT(deleteCallMouse())); showToolBar->setCheckable(true); showToolBar->setChecked(true); connect(showToolBar,SIGNAL(triggered(bool)),this,SLOT(setShowToolbar(bool))); scaleX1->setCheckable(true); scaleX2->setCheckable(true); scaleX2->setChecked(false); scaleX1->setChecked(true); connect(scaleX1, SIGNAL(triggered()), this, SLOT(setScaleX1())); connect(scaleX2, SIGNAL(triggered()), this, SLOT(setScaleX2())); connect(actionRun,SIGNAL(triggered()),this,SLOT(start())); sdrSetup = new SDRDialog(*settings,this); connect(actionSetup,SIGNAL(triggered()),sdrSetup,SLOT(show())); connect(actionSetup,SIGNAL(triggered()),this,SLOT(disconnectSignals())); connect(sdrSetup,SIGNAL(setupErrors(QString)),&errorBox,SLOT(showMessage(QString))); connect(sdrSetup,SIGNAL(update()),this,SLOT(setSdrType())); connect(sdrSetup,SIGNAL(restartSdr()),this,SLOT(restartSdr())); connect(display, SIGNAL(displayMouseQSY(int)), this, SLOT(mouseQSYDelta(int))); toolBarHeight = toolBar->height(); // select type of SDR, create data source sdrSource spectrumProcessor = new Spectrum(this,*settings,userDirectory()); switch ((SdrType)settings->value(s_sdr_type,s_sdr_type_def).toInt()) { case soundcard_t: sdrSource = new AudioReaderPortAudio(settingsFile); break; case afedri_t: sdrSource = new Afedri(settingsFile); break; case network_t: sdrSource = new NetworkSDR(settingsFile); break; } setSdrType(); sdrSource->moveToThread(&sdrThread); connect(actionSetup,SIGNAL(triggered()),sdrSource,SLOT(stop()),Qt::DirectConnection); connect(&sdrThread,SIGNAL(started()),sdrSource,SLOT(initialize())); connect(sdrSource,SIGNAL(stopped()),&sdrThread,SLOT(quit())); connect(sdrSource,SIGNAL(stopped()),this,SLOT(disconnectSignals())); connect(sdrSource,SIGNAL(error(QString)),&errorBox,SLOT(showMessage(QString))); connect(spectrumProcessor, SIGNAL(spectrumReady(unsigned char*, unsigned char)), display, SLOT(plotSpectrum(unsigned char*, unsigned char))); connect(sdrSource, SIGNAL(ready(unsigned char *, unsigned char)),spectrumProcessor, SLOT(processData(unsigned char *, unsigned char)),Qt::QueuedConnection); connect(iqDialog, SIGNAL(closed(bool)), spectrumProcessor, SLOT(setPlotPoints(bool))); connect(iqDialog, SIGNAL(restart()), spectrumProcessor, SLOT(clearIQ())); connect(spectrumProcessor, SIGNAL(qsy(int)), this, SLOT(findQsy(int))); connect(spectrumProcessor, SIGNAL(clearPlot()), iqDialog, SLOT(clearPlots())); connect(spectrumProcessor, SIGNAL(gainPoint(int, double)), iqDialog, SLOT(plotGainPoint(int, double))); connect(spectrumProcessor, SIGNAL(phasePoint(int, double)), iqDialog, SLOT(plotPhasePoint(int, double))); connect(spectrumProcessor, SIGNAL(gainScale(double, double)), iqDialog, SLOT(setGainScale(double, double))); connect(spectrumProcessor, SIGNAL(phaseScale(double, double)), iqDialog, SLOT(setPhaseScale(double, double))); connect(spectrumProcessor, SIGNAL(plotGainFunc(double, double, double, double)), iqDialog, SLOT(plotGainFunc(double, double, double, double))); connect(spectrumProcessor, SIGNAL(plotPhaseFunc(double, double, double, double)), iqDialog, SLOT(plotPhaseFunc(double, double, double, double))); // vfoPos is the position of the red line indicating center vfoPos = (height()-toolBarHeight)/ 2; dragPos = vfoPos; display->setVfoPos(vfoPos); makeFreqScaleAbsolute(); FreqLabel->setPixmap(freqPixmap); FreqLabel->update(); startTimers(); show(); }
void tst_qqmltranslation::translation() { QFETCH(QString, translation); QFETCH(QUrl, testFile); QFETCH(bool, verifyCompiledData); QTranslator translator; translator.load(translation, dataDirectory()); QCoreApplication::installTranslator(&translator); QQmlEngine engine; QQmlComponent component(&engine, testFile); QObject *object = component.create(); QVERIFY(object != 0); if (verifyCompiledData) { QQmlContext *context = qmlContext(object); QQmlEnginePrivate *engine = QQmlEnginePrivate::get(context->engine()); QQmlTypeData *typeData = engine->typeLoader.getType(context->baseUrl()); QQmlCompiledData *cdata = typeData->compiledData(); QVERIFY(cdata); QSet<QString> compiledTranslations; compiledTranslations << QStringLiteral("basic") << QStringLiteral("disambiguation") << QStringLiteral("singular") << QStringLiteral("plural"); const QV4::CompiledData::Unit *unit = cdata->compilationUnit->data; const QV4::CompiledData::Object *rootObject = unit->objectAt(unit->indexOfRootObject); const QV4::CompiledData::Binding *binding = rootObject->bindingTable(); for (quint32 i = 0; i < rootObject->nBindings; ++i, ++binding) { const QString propertyName = unit->stringAt(binding->propertyNameIndex); const bool expectCompiledTranslation = compiledTranslations.contains(propertyName); if (expectCompiledTranslation) { if (binding->type != QV4::CompiledData::Binding::Type_Translation) qDebug() << "binding for property" << propertyName << "is not a compiled translation"; QCOMPARE(binding->type, quint32(QV4::CompiledData::Binding::Type_Translation)); } else { if (binding->type == QV4::CompiledData::Binding::Type_Translation) qDebug() << "binding for property" << propertyName << "is not supposed to be a compiled translation"; QVERIFY(binding->type != QV4::CompiledData::Binding::Type_Translation); } } } QCOMPARE(object->property("basic").toString(), QLatin1String("bonjour")); QCOMPARE(object->property("basic2").toString(), QLatin1String("au revoir")); QCOMPARE(object->property("basic3").toString(), QLatin1String("bonjour")); QCOMPARE(object->property("disambiguation").toString(), QLatin1String("salut")); QCOMPARE(object->property("disambiguation2").toString(), QString::fromUtf8("\xc3\xa0 plus tard")); QCOMPARE(object->property("disambiguation3").toString(), QLatin1String("salut")); QCOMPARE(object->property("noop").toString(), QLatin1String("bonjour")); QCOMPARE(object->property("noop2").toString(), QLatin1String("au revoir")); QCOMPARE(object->property("singular").toString(), QLatin1String("1 canard")); QCOMPARE(object->property("singular2").toString(), QLatin1String("1 canard")); QCOMPARE(object->property("plural").toString(), QLatin1String("2 canards")); QCOMPARE(object->property("plural2").toString(), QLatin1String("2 canards")); QCoreApplication::removeTranslator(&translator); delete object; }
void So2sdr::showDupesheet(int nr, int checkboxState) { if (checkboxState == Qt::Unchecked) { // need to disconnect, otherwise signal will toggle checkbox again and // reopen the dupesheet disconnect(dupesheet[nr], SIGNAL(destroyed()), dupesheetCheckBox[nr], SLOT(toggle())); // save window position if (dupesheet[nr]) { switch (nr) { case 0: settings->beginGroup("DupeSheetWindow1"); break; case 1: settings->beginGroup("DupeSheetWindow2"); break; } settings->setValue("size",dupesheet[nr]->size()); settings->setValue("pos", dupesheet[nr]->pos()); settings->endGroup(); } dupesheet[nr]->close(); dupesheet[nr]=0; nDupesheet--; // if we still have one dupesheet open, repopulate it if (nDupesheet==1) populateDupesheet(); } else { if (!dupesheet[nr]) { dupesheet[nr] = new DupeSheet(this); dupesheet[nr]->setWindowIcon(QIcon(dataDirectory() + "/icon24x24.png")); dupesheet[nr]->installEventFilter(this); dupesheet[nr]->setAttribute(Qt::WA_DeleteOnClose); dupesheet[nr]->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes0->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes0->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes0->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes1->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes1->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes1->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes2->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes2->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes2->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes3->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes3->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes3->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes4->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes4->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes4->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes5->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes5->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes5->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes6->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes6->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes6->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes7->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes7->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes7->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes8->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes8->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes8->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); dupesheet[nr]->Dupes9->setFocusPolicy(Qt::NoFocus); dupesheet[nr]->Dupes9->setLineWrapMode(QTextEdit::NoWrap); dupesheet[nr]->Dupes9->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // restore geometry switch (nr) { case 0: settings->beginGroup("DupeSheetWindow1"); break; case 1: settings->beginGroup("DupeSheetWindow2"); break; } dupesheet[nr]->resize(settings->value("size", QSize(750, 366)).toSize()); dupesheet[nr]->move(settings->value("pos", QPoint(400, 400)).toPoint()); settings->endGroup(); } nDupesheet++; populateDupesheet(); dupesheet[nr]->show(); connect(dupesheet[nr], SIGNAL(destroyed()), dupesheetCheckBox[nr], SLOT(toggle())); } }
bool testApp::loadAssetsFromCompositionDirectory(string currentMediaFolder) { cout << "loading media folder " << currentMediaFolder << endl; if(!playerElementAdded){ populateTimelineElements(); } ofDirectory dataDirectory(currentMediaFolder); dataDirectory.listDir(); string currentCompositionFile = currentCompositionDirectory+"compositionsettings.xml"; projectsettings.loadFile(currentCompositionFile); int numFiles = dataDirectory.numFiles(); string calibrationDirectory = ""; string videoPath = ""; string smallVideoPath = ""; string depthImageDirectory = ""; string pairingsFile = ""; for(int i = 0; i < numFiles; i++){ cout << "testin file " << dataDirectory.getName(i) << endl; string testFile = dataDirectory.getName(i); if(testFile.find("calibration") != string::npos){ calibrationDirectory = dataDirectory.getPath(i); } if(testFile.find("depth") != string::npos){ depthImageDirectory = dataDirectory.getPath(i); } if(testFile.find("mov") != string::npos){ if(testFile.find("small") == string::npos){ videoPath = dataDirectory.getPath(i); } else { smallVideoPath = dataDirectory.getPath(i); } } if(testFile.find("pairings") != string::npos){ pairingsFile = dataDirectory.getPath(i); } } if(smallVideoPath == ""){ ofSystemAlertDialog("Error loading composition " + currentCompositionDirectory + " no Small Video File found."); return false; } if(calibrationDirectory == ""){ ofSystemAlertDialog("Error loading composition " + currentCompositionDirectory + ". No calibration/ directory found."); return false; } if(depthImageDirectory == ""){ ofSystemAlertDialog("Error loading composition " + currentCompositionDirectory + ". No Depth directory found. Make sure the folder containing the depth images has 'depth' in the name"); return false; } if(pairingsFile == ""){ pairingsFile = currentCompositionDirectory + ofFilePath::removeExt(smallVideoPath) + "pairings.xml"; } if(!loadAlignmentMatrices(calibrationDirectory)){ ofSystemAlertDialog("Load Failed -- Couldn't Load Calibration Direcotry."); return false; } if(!loadVideoFile(videoPath, smallVideoPath)){ ofSystemAlertDialog("Load Failed -- Couldn't load video."); return false; } if(!loadDepthSequence(depthImageDirectory)){ ofSystemAlertDialog("Load Failed -- Couldn't load dpeth iamges."); return false; } cam.cameraPositionFile = currentCompositionDirectory + "camera_position.xml"; cam.loadCameraPosition(); alignmentScrubber.setXMLFileName(pairingsFile); alignmentScrubber.load(); ofDirectory compFolder(currentCompositionDirectory); if(!compFolder.exists()){ compFolder.create(true); } return true; }
/*! parses .cty file, makes country list - lat=latitude of station +=N - lon=longitude of station +=W - ZoneType: 0: read CQ zones/countries 1: read ITU zones/ARRL countries */ void Cty::initialize(double la, double lo, int ZoneType) { /*! CTY file format Column Length Description - 1 26 country Name - 27 5 CQ Zone - 32 5 ITU Zone - 37 5 2-letter continent abbreviation - 42 9 Latitude in degrees, + for North - 51 10 Longitude in degrees, + for West - 61 9 Local time offset from GMT - 70 6 Primary DXCC Prefix (A "*" preceding this prefix indicates that the country is on the DARC WAEDC list, and counts in CQ-sponsored contests, but not ARRL-sponsored contests). */ double mylat=la; double mylon=lo; QFile file(dataDirectory()+"/"+settings.value(c_cty,c_cty_def).toString()); int indx; // sunrise/sunset times for station sunTimes(mylat, mylon, mySun); // sunrise/sunset times and bearings for CQ or ITU zones. These are used for // certain countries that span many zones QString zoneFileName; switch (ZoneType) { case 0:zoneFileName=dataDirectory()+"/cq_zone_latlong.dat";break; case 1:zoneFileName=dataDirectory()+"/itu_zone_latlong.dat";break; } QFile file2(zoneFileName); if (file2.open(QIODevice::ReadOnly | QIODevice::Text)) { // add blank for 0, zones start with 1 zoneBearing.append(0); zoneSun.append(""); while (!file2.atEnd()) { QString buffer; buffer=file2.readLine(80); if (buffer.contains('#')) continue; // #=comment line buffer=buffer.trimmed(); QStringList field = buffer.split(" ", QString::SkipEmptyParts); double lat=field.at(1).toDouble(); double lon=field.at(2).toDouble(); QString sunTime; QString set; sunTimes(lat, -lon, sunTime); zoneSun.append(sunTime); double dist; double head; qrb(mylon * -1.0, mylat, lon , lat, &dist, &head); zoneBearing.append(qRound(head)); } file2.close(); } else { // file missing, just make these blank int nz=40; if (ZoneType==1) nz=80; for (int i=0;i<nz;i++) { zoneBearing.append(0); zoneSun.append("ERR"); } } if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QString tmp = "ERROR: can't open file " + settings.value(c_cty,c_cty_def).toString(); emit(ctyError(tmp)); return; } nARRLCty = 0; nCQCty = 0; indx = 0; while (!file.atEnd()) { QByteArray buffer, tmp, tmp2, buffer_a, buffer_e; int i0, i1, i2, i3, i4, cqz, ituz; // get one record // all records are at least one line buffer = file.readLine(); tmp = file.readLine(); buffer_e.clear(); // zone exceptions for main pfx while (tmp.contains("#")) { buffer_e.append(tmp); while (!tmp.contains(";")) { tmp = file.readLine(); buffer_e.append(tmp); } tmp = file.readLine(); } // alias pfx; may include zone exceptions as well buffer_a = tmp; while (!tmp.contains(";")) { tmp = file.readLine(); buffer_a.append(tmp); } buffer = buffer.trimmed(); buffer_a = buffer_a.trimmed(); buffer_e = buffer_e.trimmed(); // now process parts // main line Country* new_country = new Country; new_country->multipleZones = false; new_country->indx = indx; i1 = buffer.indexOf(":", 0); new_country->name = buffer.mid(0, i1); // insert some common abbrieviations (I=Island,...) // to save screen space if (new_country->name.contains("Island")) { new_country->name.replace("Island", "I"); } i2 = buffer.indexOf(":", i1 + 1); int cqzone = buffer.mid(i1 + 1, i2 - i1 - 1).toInt(); i1 = buffer.indexOf(":", i2 + 1); int ituzone = buffer.mid(i2 + 1, i1 - i2 - 1).toInt(); if (ZoneType) { new_country->Zone = ituzone; } else { new_country->Zone = cqzone; } i2 = buffer.indexOf(":", i1 + 1); tmp = buffer.mid(i1 + 1, i2 - i1 - 1); tmp = tmp.trimmed(); if (tmp == "NA") { new_country->Continent = NA; } else if (tmp == "SA") { new_country->Continent = SA; } else if (tmp == "EU") { new_country->Continent = EU; } else if (tmp == "AF") { new_country->Continent = AF; } else if (tmp == "AS") { new_country->Continent = AS; } else if (tmp == "OC") { new_country->Continent = OC; } i1 = buffer.indexOf(":", i2 + 1); double lat = buffer.mid(i2 + 1, i1 - i2 - 1).trimmed().toFloat(); i2 = buffer.indexOf(":", i1 + 1); double lon = buffer.mid(i1 + 1, i2 - i1 - 1).trimmed().toFloat(); double dist; double head; qrb(mylon * -1.0, mylat, lon * -1.0, lat, &dist, &head); new_country->bearing = qRound(head); // round azimuth to nearest degree sunTimes(lat, lon, new_country->sun); i1 = buffer.indexOf(":", i2 + 1); new_country->delta_t = buffer.mid(i2 + 1, i1 - i2 - 1).trimmed().toFloat(); i2 = buffer.indexOf(":", i1 + 1); new_country->MainPfx = buffer.mid(i1 + 1, i2 - i1 - 1); new_country->MainPfx = new_country->MainPfx.trimmed(); if (new_country->MainPfx.contains("*")) { if (ZoneType == 0) { // CQ country new_country->MainPfx.replace("*", ""); nCQCty++; } else { // only keeping ARRL countries, skip this one delete new_country; continue; } } else { nARRLCty++; } // country has multiple zones? if (buffer_e != "") { new_country->multipleZones = true; QList<QByteArray> tmpl = buffer_e.split(';'); tmpl.removeLast(); // for some reason get 1 too many here for (int i = 0; i < tmpl.size(); i++) { i1 = tmpl[i].indexOf("#"); i2 = tmpl[i].indexOf(":"); QByteArray pf = tmpl[i].mid(i1 + 1, i2 - i1 - 1); pf = pf.trimmed(); // remove any final digit in the prefix if (isDigit(pf.at(pf.size() - 1))) { pf.chop(1); } // remove initial pfx and final ; tmpl[i] = tmpl[i].mid(i2 + 1, tmpl[i].size() - 2); QList<QByteArray> tmpl2 = tmpl[i].split(','); // separate for (int j = 0; j < tmpl2.size(); j++) { tmpl2[j] = tmpl2[j].trimmed(); tmpl2[j].replace(pf, ""); // does it have a ITU zone exception? ituz = 0; if (tmpl2[j].contains("[")) { i3 = tmpl2[j].indexOf("["); i4 = tmpl2[j].indexOf("]"); if (i3 != -1 && i4 != -1) { tmp2 = tmpl2[j].mid(i3 + 1, i4 - i3 - 1); ituz = tmp2.toInt(); tmp2 = tmpl2[j].mid(i3, i4 - i3 + 1); tmpl2[j] = tmpl2[j].replace(tmp2, ""); } } cqz = 0; // does it have a CQ zone exception? if (tmpl2[j].contains("(")) { i3 = tmpl2[j].indexOf("("); i4 = tmpl2[j].indexOf(")"); if (i3 != -1 && i4 != -1) { tmp2 = tmpl2[j].mid(i3 + 1, i4 - i3 - 1); cqz = tmp2.toInt(); tmp2 = tmpl2[j].mid(i3, i4 - i3 + 1); tmpl2[j] = tmpl2[j].replace(tmp2, ""); } } new_country->zonePfx.append(tmpl2[j]); if (ZoneType) { if (ituz) { new_country->zones.append(ituz); } else { new_country->zones.append(ituzone); } } else { if (cqz) { new_country->zones.append(cqz); } else { new_country->zones.append(cqzone); } } } } } // alias prefixes, may include zone exceptions i1 = 0; i2 = buffer_a.indexOf(",", i1 + 1); if (i2 == -1) i2 = buffer_a.size() - 1; int nalias = 0; while (i1 < (buffer_a.size() - 1)) { tmp = buffer_a.mid(i1, i2 - i1); tmp = tmp.trimmed(); if (tmp.startsWith("=")) { i0 = 1; // call exception } else { i0 = 0; // alias prefix nalias++; } ituz = -1; // -1 is marker to use regular zone in pfx list cqz = -1; // does it have a ITU zone exception? if (tmp.contains("[")) { i3 = tmp.indexOf("["); i4 = tmp.indexOf("]"); if (i3 != -1 && i4 != -1) { tmp2 = tmp.mid(i3 + 1, i4 - i3 - 1); ituz = tmp2.toInt(); tmp2 = tmp.mid(i3, i4 - i3 + 1); tmp = tmp.replace(tmp2, ""); } } // does it have a CQ zone exception? if (tmp.contains("(")) { i3 = tmp.indexOf("("); i4 = tmp.indexOf(")"); if (i3 != -1 && i4 != -1) { tmp2 = tmp.mid(i3 + 1, i4 - i3 - 1); cqz = tmp2.toInt(); tmp2 = tmp.mid(i3, i4 - i3 + 1); tmp = tmp.replace(tmp2, ""); } } if (!i0) { // new alias prefix Pfx* new_pfx = new Pfx; new_pfx->CtyIndx = indx; new_pfx->zoneOverride = true; if (ZoneType) { new_pfx->Zone = ituz; } else { new_pfx->Zone = cqz; } if (new_pfx->Zone == -1) { new_pfx->Zone = new_country->Zone; new_pfx->zoneOverride = false; } new_pfx->prefix = tmp; pfxList.append(new_pfx); } else { // new exception call CtyCall* new_call = new CtyCall; new_call->call = tmp.right(tmp.size() - 1); if (ZoneType) { if (ituz != -1) { new_call->Zone = ituz; } else { new_call->Zone = new_country->Zone; } } else { if (cqz != -1) { new_call->Zone = cqz; } else { new_call->Zone = new_country->Zone; } } if (cqz == -1 && ituz == -1) { // it NEITHER zone was defined, add call to exception list // (with default zones set above). This is mostly for weird/unexpected calls new_call->CtyIndx = indx; new_call->sun=new_country->sun; CallE.append(new_call); } else if ((!ZoneType && cqz == -1) || (ZoneType && ituz == -1)) { // the exception doesn't have ONE of the zones defined, remove it // (some entries in cty file only have CQ or ITU zones defined, but // not both. In IARU contest for example, do not want CQ zone exceptions // to be kept delete new_call; } else { new_call->CtyIndx = indx; new_call->sun=zoneSun.at(new_call->Zone); CallE.append(new_call); } } i1 = i2 + 1; i2 = buffer_a.indexOf(",", i1 + 1); if (i2 == -1) { i2 = buffer_a.size() - 1; } } countryList.append(new_country); // special case: some countries (4U1U, ...) have no alias prefixes listed, only exception calls. // make sure to add to main pfx list! if (nalias == 0) { Pfx* new_pfx = new Pfx; new_pfx->zoneOverride = false; new_pfx->CtyIndx = indx; if (ZoneType) { new_pfx->Zone = ituz; } else { new_pfx->Zone = cqz; } if (new_pfx->Zone == -1) { new_pfx->Zone = new_country->Zone; } new_pfx->prefix = new_country->MainPfx; pfxList.append(new_pfx); } indx++; } /*! @todo define < operator so qsort can be used sort prefix and call exception lists */ // prefix for (int i = 1; i < pfxList.size(); i++) { QByteArray tmp = pfxList[i]->prefix; int i0 = pfxList[i]->Zone; int i1 = pfxList[i]->CtyIndx; bool i2 = pfxList[i]->zoneOverride; int j = i - 1; while (j >= 0 && pfxList[j]->prefix > tmp) { pfxList[j + 1]->prefix = pfxList[j]->prefix; pfxList[j + 1]->Zone = pfxList[j]->Zone; pfxList[j + 1]->CtyIndx = pfxList[j]->CtyIndx; pfxList[j + 1]->zoneOverride = pfxList[j]->zoneOverride; j--; } pfxList[j + 1]->prefix = tmp; pfxList[j + 1]->Zone = i0; pfxList[j + 1]->CtyIndx = i1; pfxList[j + 1]->zoneOverride = i2; } // exception for (int i = 1; i < CallE.size(); i++) { QByteArray tmp = CallE[i]->call; QString suntmp= CallE[i]->sun; int i0 = CallE[i]->Zone; int i1 = CallE[i]->CtyIndx; int j = i - 1; while (j >= 0 && CallE[j]->call > tmp) { CallE[j + 1]->call = CallE[j]->call; CallE[j + 1]->sun = CallE[j]->sun; CallE[j + 1]->Zone = CallE[j]->Zone; CallE[j + 1]->CtyIndx = CallE[j]->CtyIndx; j--; } CallE[j + 1]->call = tmp; CallE[j + 1]->sun = suntmp; CallE[j + 1]->Zone = i0; CallE[j + 1]->CtyIndx = i1; } // save index for US Qso tmpqso; tmpqso.call = "W1AW"; bool b; usaIndx = idPfx(&tmpqso, b); }