Пример #1
0
ConfigLists::ConfigLists()
{
	fileTypeNames << "wav" << "aiff" << "au" << "avr" << "caf" << "flac"
				  << "htk" << "ircam" << "mat4" << "mat5" << "nis" << "paf" << "pvf"
				  << "raw" << "sd2" << "sds" << "svx" << "voc" << "w64" << "wavex";
	fileTypeExtensions << "*.wav" << "*.aif;*.aiff" << "*.au" << "*.avr" << "*.caf"
					   << "*.flac" << "*.htk;*.*" << "*.ircam;*.*" << "*.mat4;*.*" << "*.mat5;*.*"
					   << "*.nis;*.*" << "*.paf;*.*" << "*.pvf" << "*.raw;*.*" << "*.sd2;*.*" << "*.sds;*.*"
					   << "*.svx;*.*" << "*.voc;*.*" << "*.w64;*.wav" << "*.wavex;*.wav";
	fileTypeLongNames << "WAVE" << "AIFF" << "au" << "avr" << "CAF" << "FLAC"
					  << "htk" << "ircam" << "mat4" << "mat5" << "nis" << "paf" << "pvf"
					  << "Raw (Headerless)" << "Sound Designer II" << "sds" << "svx" << "voc"
					  << "WAVE (w64)" << "WAVE (wavex)";

	fileFormatFlags << "24bit" << "short"<< "uchar"
					<< "schar"<< "float"<< "long";
	fileFormatNames << "24 Bit" << "16 Bit (short)" << "unsigned 8-bit"
					<< "signed 8-bit" << "32 bit float"<< "long (32-bit)";

	refreshModules();
	languages << "English" << "Spanish" << "German" << "French" << "Portuguese" << "Italian"  << "Turkish"  << "Finnish" << "Russian";
	languageCodes << "en" << "es" << "de" << "fr" << "pt" << "it" << "tr" << "fi" << "ru";
}
Пример #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    kwp(this),
    appSettings(new QSettings("vagblocks.ini", QSettings::IniFormat, this)),
    serialConfigured(false),
    storedRow(-1), storedCol(-1),
    currentlyLogging(false)
{
    /*
    QFile roboto(":/resources/Roboto-Regular.ttf");
    roboto.open(QIODevice::ReadOnly);
    if (QFontDatabase::addApplicationFontFromData(roboto.readAll()) < 0) {
        // error
    }
    roboto.close();
    */

    ui->setupUi(this);

    QString svnRev = APP_SVN_REV;
    int colonAt = svnRev.indexOf(":");
    if (colonAt > 0) {
        svnRev = svnRev.mid(colonAt+1);
    }
    QString appVer = APP_VERSION;
    aboutDialog = new about(appVer, svnRev, this);
    serSettings = new serialSettingsDialog(this);
    settingsDialog = new settings(appSettings, this);

    connect(ui->action_About, SIGNAL(triggered()), aboutDialog, SLOT(show()));
    connect(ui->actionApplication_settings, SIGNAL(triggered()), settingsDialog, SLOT(show()));

    setupBlockArray(ui->blocksLayout);

    connect(&kwp, SIGNAL(log(QString, int)), this, SLOT(log(QString, int)));
    connect(&kwp, SIGNAL(newBlockData(int)), this, SLOT(newBlockData(int)));
    connect(&kwp, SIGNAL(blockOpen(int)), this, SLOT(blockOpen(int)));
    connect(&kwp, SIGNAL(blockClosed(int)), this, SLOT(blockClosed(int)));
    connect(&kwp, SIGNAL(channelOpen(bool)), this, SLOT(channelOpen(bool)));
    connect(&kwp, SIGNAL(elmInitialised(bool)), this, SLOT(elmInitialised(bool)));
    connect(&kwp, SIGNAL(portOpened(bool)), this, SLOT(portOpened(bool)));
    connect(&kwp, SIGNAL(portClosed()), this, SLOT(portClosed()));
    connect(&kwp, SIGNAL(newModuleInfo(QStringList)), this, SLOT(moduleInfoReceived(QStringList)));
    connect(&kwp, SIGNAL(newEcuInfo(QStringList)), this, SLOT(ecuInfoReceived(QStringList)));
    connect(ui->pushButton_log, SIGNAL(clicked(bool)), this, SLOT(startLogging(bool)));
    connect(&kwp, SIGNAL(labelsLoaded(bool)), this, SLOT(labelsLoaded(bool)));
    connect(ui->lineEdit_moduleNum, SIGNAL(textChanged(QString)), this, SLOT(clearUI()));
    connect(ui->comboBox_modules, SIGNAL(activated(int)), this, SLOT(selectNewModule(int)));
    connect(&kwp, SIGNAL(moduleListRefreshed()), this, SLOT(refreshModules()));
    connect(ui->pushButton_refresh, SIGNAL(clicked()), &kwp, SLOT(openGW_refresh()));
    connect(&kwp, SIGNAL(sampleFormatChanged()), this, SLOT(sampleFormatChanged()));
    connect(&kwp, SIGNAL(loggingStarted()), this, SLOT(loggingStarted()));
    connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(updateSettings()));

    for (int i = 0; i < 16; i++) { // setup running average for sample rate
        avgList.append(0);
    }

    restoreSettings();

    if (serialConfigured) {
        kwp.setSerialParams(serSettings->getSettings());
        QMetaObject::invokeMethod(&kwp, "openPort", Qt::QueuedConnection);
    }

    connect(serSettings, SIGNAL(settingsApplied()), this, SLOT(connectToSerial()));
    refreshModules(true);
}