void SshConnection::callRedundant() { QLOG_TRACE() << "Redundant call made"; //sleep(5); QLOG_TRACE() << "Redundant call finished"; }
bool SyncRunner::syncRemoteToLocal(qint32 updateCount) { QLOG_TRACE() << "Entering SyncRunner::SyncRemoteToLocal()"; // The sync is run in several parts. // Part #1: Get all remote tags, notebooks, & saved searches for // a user's account. We do this first because we want // the tag & notebook naems for filling out the note table. // It is just easier this way. // Part #2: Get all changed notes & resources. If it is a full sync // then we get the resources & notes together as one entity // (the resource chunk won't have anything). We also do not // get deleted notes on a full sync. If it is a partial sync // then we get resources & notes separately (i.e. the notes chunk // may reference a resource guid, but it won't have the detail and // the chunk resources will have valid data. We get deleted notes // on a partial sync. // Part #3: Upload anything local to the user's account. // Part #4: Do linked notebook stuff. Basically the same as // this except we do it across multiple accounts. int chunkSize = 5000; bool more = true; bool rc; int startingSequenceNumber = updateSequenceNumber; while(more && keepRunning) { SyncChunk chunk; rc = comm->getSyncChunk(chunk, updateSequenceNumber, chunkSize, SYNC_CHUNK_LINKED_NOTEBOOKS | SYNC_CHUNK_NOTEBOOKS | SYNC_CHUNK_TAGS | SYNC_CHUNK_SEARCHES | SYNC_CHUNK_EXPUNGED, fullSync); if (!rc) { QLOG_ERROR() << "Error retrieving chunk"; error = true; this->communicationErrorHandler(); return false; } QLOG_DEBUG() << "-(Pass 1)->>>> Old USN:" << updateSequenceNumber << " New USN:" << chunk.chunkHighUSN; int pct = (updateSequenceNumber-startingSequenceNumber)*100/(updateCount-startingSequenceNumber); emit setMessage(tr("Download ") +QString::number(pct) + tr("% complete for notebooks, tags, & searches."), defaultMsgTimeout); processSyncChunk(chunk); updateSequenceNumber = chunk.chunkHighUSN; if (!chunk.chunkHighUSN.isSet() || chunk.chunkHighUSN >= chunk.updateCount) more = false; } emit setMessage(tr("Download complete for notebooks, tags, & searches. Downloading notes."), defaultMsgTimeout); comm->loadTagGuidMap(); more = true; chunkSize = 50; updateSequenceNumber = startingSequenceNumber; UserTable userTable(db); while(more && keepRunning) { SyncChunk chunk; rc = comm->getSyncChunk(chunk, updateSequenceNumber, chunkSize, SYNC_CHUNK_NOTES | SYNC_CHUNK_RESOURCES, fullSync); if (!rc) { QLOG_ERROR() << "Error retrieving chunk"; error = true; this->communicationErrorHandler(); return false; } QLOG_DEBUG() << "-(Pass 2) ->>>> Old USN:" << updateSequenceNumber << " New USN:" << chunk.chunkHighUSN; int pct = (updateSequenceNumber-startingSequenceNumber)*100/(updateCount-startingSequenceNumber); emit setMessage(tr("Download ") +QString::number(pct) + tr("% complete."), defaultMsgTimeout); processSyncChunk(chunk); userTable.updateLastSyncNumber(chunk.chunkHighUSN); userTable.updateLastSyncDate(chunk.currentTime); updateSequenceNumber = chunk.chunkHighUSN; if (!chunk.chunkHighUSN.isSet() || chunk.chunkHighUSN >= chunk.updateCount) { more = false; userTable.updateLastSyncNumber(updateCount); } } emit setMessage(tr("Download complete."), defaultMsgTimeout); return true; }
void ChatWidget::leaveChat() { QLOG_TRACE() << __PRETTY_FUNCTION__; d_chat->leaveChat(); }
/** * @brief Save changes in Settings object */ void ConfigDialog::save() { QTime time = ui->optionDelay->time(); int delay = time.hour()*3600 + time.minute()*60 + time.second(); QVariant lang = ui->optionLang->currentData(); if (lang != m_settings->param(UM::CONF::language)) { QMessageBox::warning(this, tr("Language changed"), tr("You must restart %1 to apply the new language.").arg(APP_NAME), QMessageBox::Ok, QMessageBox::Ok); } QString opener = ui->optionOpenProgram->currentData().toString(); if (opener == "default" || opener == "select") { opener = ""; } bool lockEnabled = ui->optionLockEnabled->isChecked(); QString lockPassword = ui->optionLockPassword->text(); m_settings->setParam(UM::CONF::delay, delay); m_settings->setParam(UM::CONF::language, lang); m_settings->setParam(UM::CONF::open_program, opener); m_settings->setParam(UM::CONF::minimize, ui->optionMinimize->isChecked()); m_settings->setParam(UM::CONF::check_updates, ui->optionCheckUpdates->isChecked()); m_settings->setParam(UM::CONF::use_hotkeys, ui->optionUseHotkeys->isChecked()); m_settings->setParam(UM::CONF::show_notifications, ui->optionShowNotifications->isChecked()); m_settings->setParam(UM::CONF::default_set, ui->optionDefaultSet->currentData()); m_settings->setParam(UM::CONF::lock_enabled, lockEnabled); if (!lockEnabled) { m_settings->setParam(UM::CONF::lock_password, ""); } else if (!lockPassword.isEmpty()) { m_settings->setParam(UM::CONF::lock_password, UM::hash(lockPassword, UM::PasswordHash)); } m_settings->setParam(UM::CONF::lock_startup, ui->optionLockStartup->isChecked()); m_settings->setParam(UM::CONF::lock_minimize, ui->optionLockMinimize->isChecked()); m_settings->setParam(UM::CONF::lock_type, ui_lockType->checkedId()); m_settings->setHotkey(UM::CONF::HOTKEY::refresh, ui->hotkeyRefresh->hotkey()); m_settings->setHotkey(UM::CONF::HOTKEY::showhide, ui->hotkeyShowHide->hotkey()); m_settings->setHotkey(UM::CONF::HOTKEY::startpause, ui->hotkeyStartPause->hotkey()); m_settings->setHotkey(UM::CONF::HOTKEY::delay, ui->hotkeyDelay->hotkey()); m_settings->setHotkey(UM::CONF::HOTKEY::lockunlock, ui->hotkeyLockUnlock->hotkey()); if (ui->optionAutostart->isChecked()) { m_enviro->createShortcut(); } else { m_enviro->deleteShortcut(); } m_settings->save(); QLOG_TRACE() << "Configuration updated"; }
void Chat::invite(QSharedPointer<const User> user) { QLOG_TRACE() << __PRETTY_FUNCTION__; QtConcurrent::run(this, &Chat::runInvite, user); }
void MediaManager::init() { QFileInfo root; //Collect filenames of video files for (QString& path : mediaPaths) { path = path.replace("~", QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); root.setFile(path); if(!root.exists()) { QLOG_ERROR() << "Library location \"" + path + "\" does not exists"; continue; } if(!root.isDir()) { QLOG_ERROR() << "Library location \"" + path + "\" is not a directory"; continue; } if(!root.isReadable()) { QLOG_ERROR() << "Library location \"" + path + "\" is not accessible"; continue; } scanDirectory(root.absoluteFilePath()); } //Sleep until all thumbs processed mutexThumbnails.lock(); while(tasksActive > 1) { taskFinished.wait(&mutexThumbnails); } mutexThumbnails.unlock(); //Cleanup thumbnailers qDeleteAll(thumbnailers); thumbnailers.clear(); //Start DB Update DbManager::get()->beginTransaction(); for (QSharedPointer<MediaFile> mediaFile : processedThumbnails) { DbManager::get()->updateThumbnail(mediaFile->mediaId(), true); } processedThumbnails.clear(); DbManager::get()->cleanupDeletedFiles(); DbManager::get()->commitTransaction(); QLOG_TRACE() << "DB update finished"; emit initialized(); }
void MainWidget::doSthElse() { QLOG_TRACE() << "MainWidget::doSthElse()"; // scrollArea->startScrolling(); }
void Pull::run() { QLOG_TRACE() << "Receiving file " << m_sourceFilePath; qDebug() << "SecureConnection::Pull " << m_sourceFilePath << "->" << m_destinationFilePath; // Set blocking, which apparently is required. QByteArray source(m_sourceFilePath.toLocal8Bit()); libssh2_session_set_blocking(m_session, 1); struct stat fileInfo; LIBSSH2_CHANNEL* channel(libssh2_scp_recv(m_session, source.data(), &fileInfo)); if (channel == 0) { QString msg("Could not stat file "); msg += m_sourceFilePath; throw Exception(m_session, msg); } QByteArray destination(m_destinationFilePath.toLocal8Bit()); FILE* localFileHandle(fopen(destination.data(), "wb")); if (!localFileHandle) { QString msg("Could not open file for writing "); msg += m_destinationFilePath; throw Exception(msg); } // If the buffer size changes, anything connected to the copyProgress will // need updating as it assumes kbyte increments. char buffer[1024]; off_t got(0); while (got < fileInfo.st_size && !m_terminate) { int amount(sizeof(buffer)); if ((fileInfo.st_size - got) < amount) { amount = fileInfo.st_size - got; } int bc(libssh2_channel_read(channel, buffer, amount)); if (bc > 0) { fwrite(buffer, 1, bc, localFileHandle); }else if (bc < 0) { m_success = false; m_errorMessage = "Error reading from channel"; break; } got += bc; copyProgress(); //qDebug() << "sleeping 1"; sleep(1); } fclose(localFileHandle); libssh2_channel_send_eof(channel); // This seems to cause a hang sometimes // libssh2_channel_wait_eof(channel); libssh2_channel_wait_closed(channel); libssh2_channel_free(channel); if (!m_errorMessage.isEmpty()) throw Exception(m_errorMessage); if (!m_terminate) m_success = true; }
void MainWidget::setWorkspace(Workspace *wsp) { QLOG_TRACE() << "MainWidget::setWorkspace()"; this->wsp = wsp; playWidget->update(wsp->getButtonlist(),wsp->getPlaylist()); editWidget->update(wsp->getStock()); }
void MainWidget::doSth() { QLOG_TRACE() << "MainWidget::doSth()"; // scrollArea->stopScrolling(); // QTimer::singleShot(5000, this, SLOT(doSthElse())); }
int main(int argc, char ** argv){ QApplication app(argc, argv); app.setApplicationName(QObject::tr("ImproGui")); QsLogging::Logger& logger = QsLogging::Logger::instance(); logger.setLoggingLevel(QsLogging::TraceLevel); const QString sLogPath(QDir(app.applicationDirPath()).filePath("log.txt")); QsLogging::DestinationPtr fileDestination( QsLogging::DestinationFactory::MakeFileDestination(sLogPath) ); QsLogging::DestinationPtr debugDestination( QsLogging::DestinationFactory::MakeDebugOutputDestination() ); logger.addDestination(debugDestination.get()); logger.addDestination(fileDestination.get()); QLOG_TRACE() << "Logging initiated"; // manually set some file paths for scaffolding // load it in the workspace using the workspace API // with the appropriate settings for all the Track properties Workspace * activeWorkspace = new Workspace(0); Track * t; // scaffholding // load file list from ".txt" // this is temporary QFile file("./filestoload.txt"); if(!file.open(QIODevice::ReadOnly)) { QLOG_ERROR() << file.errorString(); return 1; } QLOG_TRACE() << "Loading file " << file.fileName() ; QTextStream in(&file); int index=0; while(!in.atEnd()) { QString line = in.readLine(); QLOG_TRACE() << "Reading line: " << line ; QStringList fields = line.split(","); if(fields.size() < 8 ){ QLOG_TRACE() << "Line unreadable"; }else{ t = new Track( fields[0], // file name ("true" == fields[1].toLower()), // loop fields[2].toInt(), // start fields[3].toInt(), // stop fields[4].toInt(), // fade in fields[5].toInt(), // fade out ("true" == fields[6].toLower()), // showFilename activeWorkspace ); index = activeWorkspace->addTrack(t); if( ("b" == fields[7].toLower()) ){ activeWorkspace->stockToButtons(index); }else{ activeWorkspace->stockToList(index); } }; } // give the workspace to the media player (or use the controller as a broker between them?) // the media player should register to the signals triggered when a track is added or remove from the playlist // ... // create a "Players" object to deal with controlling the players MediaPlayerFactory * mediaPlayerFactory = new GstMediaPlayerFactory(); Players * players = new Players(mediaPlayerFactory); UiController controller(players,activeWorkspace); BasicUi ui(&controller); ui.setWorkspace(activeWorkspace); ui.show(); app.exec(); delete activeWorkspace; //delete player; QLOG_TRACE() << "Workspace deleted"; return 0; }
void UIImageOverview::start(void) { QDir dir; QString savepath; running = true; setStatus("Running"); if (ui->leURI->text() != "") { ui->leURI->setReadOnly(true); if (!ui->leURI->text().startsWith("http")) { QString s; s = ui->leURI->text(); s.prepend("http://"); ui->leURI->setText(s); } // Check if we can parse this URI if (selectParser()) { savepath = getSavepath(); if (savepath.endsWith("\\")) { savepath.chop(1); //ui->leSavepath->setText(savepath); } QLOG_TRACE() << "UIImageOverview :: Setting save path to " << savepath; dir.setPath(savepath); if (!dir.exists()) { QDir d; d.mkpath(savepath); QLOG_INFO() << "UIImageOverview :: Directory" << savepath << " does not exist. Creating..."; } if (dir.exists()) { ui->leSavepath->setEnabled(false); startDownload(); ui->btnStart->setEnabled(false); ui->btnStop->setEnabled(true); ui->cbRescan->setEnabled(false); ui->comboBox->setEnabled(false); // ui->progressBar->setEnabled(true); ui->cbOriginalFilename->setEnabled(false); ui->btnChoosePath->setEnabled(false); ui->cbFolderShortcuts->setEnabled(false); if (ui->cbRescan->isChecked()) { timer->setInterval(timeoutValues.at(ui->comboBox->currentIndex())*1000); timer->start(); } // Hide thread settings if ((ui->btnToggleView->isChecked())) ui->btnToggleView->setChecked(false); } else { stop(); emit errorMessage("Directory does not exist / Could not be created"); setStatus("Directory does not exist / Could not be created"); QLOG_ERROR() << "UIImageOverview :: Directory" << savepath << " does not exist and I couldn't create it."; } } else { stop(); emit errorMessage("Could not find a parser for this URL (" + ui->leURI->text() + ")"); setStatus("No parser available"); QLOG_WARN() << "UIImageOverview :: I couldn't find a parser for uri " << ui->leURI->text(); } } }
void ChatWidget::returnPressed() { QLOG_TRACE() << __PRETTY_FUNCTION__; d_chat->send(ui->leMessage->text()); ui->leMessage->setText(""); }
void SyncRunner::evernoteSync() { QLOG_TRACE() << "Sync thread:" << QThread::currentThreadId(); if (!global.connected) return; User user; UserTable userTable(db); if (!comm->getUserInfo(user)) { this->communicationErrorHandler(); error =true; return; } userTable.updateUser(user); SyncState syncState; if (!comm->getSyncState("", syncState)) { this->communicationErrorHandler(); error = true; return; } fullSync = false; qlonglong lastSyncDate = userTable.getLastSyncDate(); updateSequenceNumber = userTable.getLastSyncNumber(); if ((syncState.fullSyncBefore/1000) > lastSyncDate) { QLOG_DEBUG() << "Full sequence date has expired"; lastSyncDate = 0; fullSync = true; } if (updateSequenceNumber == 0) fullSync = true; emit setMessage(tr("Beginning Sync"), defaultMsgTimeout); // If there are remote changes QLOG_DEBUG() << "--->>> Current Chunk High Sequence Number: " << syncState.updateCount; QLOG_DEBUG() << "--->>> Last User High Sequence Number: " << updateSequenceNumber; if (syncState.updateCount > updateSequenceNumber) { QLOG_DEBUG() << "Remote changes found"; QLOG_DEBUG() << "Downloading changes"; emit setMessage(tr("Downloading changes"), defaultMsgTimeout); bool rc = syncRemoteToLocal(syncState.updateCount); if (!rc) error = true; } if (!comm->getUserInfo(user)) { this->communicationErrorHandler(); error = true; return; } userTable.updateUser(user); if (!global.disableUploads && !error) { qint32 searchUsn = uploadSavedSearches(); if (searchUsn > updateSequenceNumber) updateSequenceNumber = searchUsn; qint32 tagUsn = uploadTags(); if (tagUsn > updateSequenceNumber) updateSequenceNumber = tagUsn; qint32 notebookUsn = uploadNotebooks(); if (notebookUsn > updateSequenceNumber) updateSequenceNumber = notebookUsn; qint32 personalNotesUsn = uploadPersonalNotes(); if (personalNotesUsn > updateSequenceNumber) updateSequenceNumber = personalNotesUsn; } // Synchronize linked notebooks if (!error && !syncRemoteLinkedNotebooksActual()) error = true; if (error || !comm->getSyncState("", syncState)) { error =true; this->communicationErrorHandler(); return; } userTable.updateSyncState(syncState); // Cleanup any missing parent tags QList<qint32> lids; TagTable tagTable(db); tagTable.findMissingParents(lids); for (int i=0; i<lids.size(); i++) { if (!finalSync) emit(tagExpunged(lids[i])); } tagTable.cleanupMissingParents(); if (!error) emit setMessage(tr("Sync Complete Successfully"), defaultMsgTimeout); QLOG_TRACE() << "Leaving SyncRunner::evernoteSync()"; }
/** * @brief Load contents of the settings file * @param string _filename * @return bool */ bool Settings::load(QString _filename) { if (_filename.isEmpty()) { if (!m_enviro->isPortable() && !QFile(Environment::APPDATA_DIR + APP_CONFIG_FILE).exists() && QFile(APP_CONFIG_FILE).exists()) { moveAppData(); } _filename = Environment::APPDATA_DIR + APP_CONFIG_FILE; } // open xml file QFile file(_filename); if (!file.exists() || !file.open(QIODevice::ReadOnly)) { QLOG_ERROR() << "Unable to load config file"; return false; } // initialize domdocument QDomDocument dom; if (!dom.setContent(file.readAll())) { QLOG_ERROR() << "Unable to load config file"; return false; } file.close(); clearSets(); // read settings node QDomElement settingsNode = dom.documentElement().firstChild().toElement(); int newHotkey = 0; UM::MODE newMode = UM::MODE_NONE; bool updated = false; while (!settingsNode.isNull()) { // config node if (settingsNode.tagName() == "config") { QDomElement configNode = settingsNode.firstChild().toElement(); while (!configNode.isNull()) { // migration to 1.3 if (configNode.tagName() == "hotkey") { newHotkey = configNode.text().toInt(); } // migration to 1.9 else if (configNode.tagName() == "mode") { newMode = configNode.text() == "random" ? UM::MODE_RANDOM : UM::MODE_SEQUENTIAL; } else if (m_options.contains(configNode.tagName())) { m_options[ configNode.tagName() ] = configNode.text(); } configNode = configNode.nextSibling().toElement(); } } else if (settingsNode.tagName() == "hotkeys") { QDomElement hotkeyNode = settingsNode.firstChild().toElement(); while (!hotkeyNode.isNull()) { // 1.3 format if (hotkeyNode.hasAttribute("key")) { m_hotkeys[ hotkeyNode.tagName() ] = hotkeyNode.attribute("key").toInt() + hotkeyNode.attribute("mod").toInt(); updated = true; } // 1.4 format else { // stored in string representation since 2.2.1 bool isInt; m_hotkeys[ hotkeyNode.tagName() ] = hotkeyNode.text().toInt(&isInt); if (!isInt) { m_hotkeys[ hotkeyNode.tagName() ] = UM::keySequenceToInt(QKeySequence(hotkeyNode.text())); } } hotkeyNode = hotkeyNode.nextSibling().toElement(); } } // sets node else if (settingsNode.tagName() == "sets") { QDomElement setNode = settingsNode.firstChild().toElement(); while (!setNode.isNull()) { // set node if (setNode.tagName() == "set") { try { m_sets.append(new Set(&setNode)); } catch(const std::exception &e) { QLOG_ERROR()<<e.what(); } } setNode = setNode.nextSibling().toElement(); } } // monitors node else if (settingsNode.tagName() == "monitors") { QDomElement monNode = settingsNode.firstChild().toElement(); m_monitors.clear(); while (!monNode.isNull()) { UM::Monitor mon; mon.enabled = (bool) monNode.attribute("enabled").toInt(); mon.color = QColor(monNode.attribute("color")).rgb(); m_monitors.append(mon); monNode = monNode.nextSibling().toElement(); } } settingsNode = settingsNode.nextSibling().toElement(); } QLOG_TRACE() << "Config loaded from file"; if (newHotkey > 0) { QLOG_INFO() << "Need to update hotkeys"; upgradeHotkeys(newHotkey); updated = true; } if (newMode != UM::MODE_NONE) { QLOG_INFO() << "Need to update modes"; upgradeMode(newMode); updated = true; } if (updated) { QLOG_INFO() << "Settings file format changed"; save(); } foreach (Set* set, m_sets) { set->init(); } if (QsLogging::Logger::instance().loggingLevel() != QsLogging::OffLevel) { log(); } return true; }
void Push::run() { QLOG_TRACE() << "Sending file " << m_sourceFilePath; // Check the local file is there first qDebug() << "SecureConnection::Push " << m_sourceFilePath << "->" << m_destinationFilePath; QByteArray source(m_sourceFilePath.toLocal8Bit()); FILE* localFileHandle(fopen(source.data(), "rb")); if (!localFileHandle) { QString msg("Could not stat file "); msg += m_sourceFilePath; throw Exception(msg); } struct stat fileInfo; stat(source.data(), &fileInfo); // Set blocking, which apparently is required. libssh2_session_set_blocking(m_session, 1); QByteArray destination(m_destinationFilePath.toLocal8Bit()); LIBSSH2_CHANNEL* channel(libssh2_scp_send(m_session, destination.data(), fileInfo.st_mode & 0777, (unsigned long)fileInfo.st_size)); if (channel == 0) { QString msg("Unable to open channel for writing to file "); msg += m_destinationFilePath; throw Exception(msg); } size_t nread; char buffer[1024]; char* ptr; int rc; do { nread = fread(buffer, 1, sizeof(buffer), localFileHandle); if (nread <= 0) break; // end of file ptr = buffer; do { // write the same data over and over, until error or completion // rc indicates how many bytes were written this time rc = libssh2_channel_write(channel, ptr, nread); if (rc < 0) { m_errorMessage = "Error writing to channel " + QString::number(rc); break; }else { ptr += rc; nread -= rc; } } while (nread && !m_terminate); copyProgress(); } while (!m_terminate); fclose(localFileHandle); libssh2_channel_send_eof(channel); libssh2_channel_wait_eof(channel); libssh2_channel_wait_closed(channel); libssh2_channel_free(channel); if (!m_errorMessage.isEmpty()) throw Exception(m_errorMessage); if (!m_terminate) m_success = true; }
void EmsData::ramBlockUpdate(unsigned short locationid, QByteArray header, QByteArray payload) { Q_UNUSED(header) QLOG_TRACE() << "Ram Block retrieved:" << "0x" + QString::number(locationid,16).toUpper(); QList<ConfigBlock> configlist = m_memoryMetaData->getConfigMetaData(QString::number(locationid,16).toUpper()); for (int i=0;i<configlist.size();i++) { //configlist[i].offset() QString valstr = ""; QString bytestr = ""; for (int k=0;k<configlist[i].size();k++) { unsigned int value = 0; for (int j=0;j<configlist[i].elementSize();j++) { //QLOG_DEBUG() << (unsigned char)block[m_fieldConfigList[i].second.offset() + (k * m_fieldConfigList[i].second.elementSize()) + j]; bytestr += QString::number((unsigned char)payload[configlist[i].offset() + (k * configlist[i].elementSize()) + j],16).toUpper() + ","; value += ((unsigned char)payload[configlist[i].offset() + (k * configlist[i].elementSize()) + j]) << (8 * (configlist[i].elementSize() - (j+1))); } //userValue = (ecuValue + translate) * scale valstr += QString::number(calcAxis(value,configlist[i].calc())) + ","; } valstr = valstr.mid(0,valstr.length()-1); QLOG_DEBUG() << "Pre value:" << "0x" + QString::number(locationid,16) << bytestr; //valstr == variable. emit configRecieved(configlist[i],QVariant(valstr)); } if (!hasDeviceRamBlock(locationid)) { //This should not happen /*RawDataBlock *block = new RawDataBlock(); block->locationid = locationid; block->header = header; block->data = payload; //m_flashRawBlockList.append(block); m_deviceRamRawBlockList.append(block);*/ } else { //Check to see if it's supposed to be a table, and if so, check size if (!verifyMemoryBlock(locationid,header,payload)) { //QMessageBox::information(this,"Error","RAM Location ID 0x" + QString::number(locationid,16).toUpper() + " should be 1024 sized, but it is " + QString::number(payload.size()) + ". This should never happen"); QLOG_ERROR() << "RAM Location ID 0x" + QString::number(locationid,16).toUpper() + " should be 1024 sized, but it is " + QString::number(payload.size()) + ". This should never happen"; return; } if (getDeviceRamBlock(locationid).isEmpty()) { //This should not happen QLOG_ERROR() << "Ram block on device while ram block on tuner is empty! This should not happen" << "0x" + QString::number(locationid,16).toUpper(); QLOG_ERROR() << "Current block size:" << getDeviceRamBlock(locationid).size(); setLocalRamBlock(locationid,payload); setDeviceRamBlock(locationid,payload); } else { if (m_interrogationInProgress) { //checkEmsData->setDeviceRamBlock(locationid,payload); for (int i=0;i<m_duplicateRamMemoryList.size();i++) { if (m_duplicateRamMemoryList[i]->locationid == locationid) { m_duplicateRamMemoryList[i]->setData(payload); break; } } m_checkEmsDataInUse = true; } else { if (getDeviceRamBlock(locationid) != payload) { QLOG_ERROR() << "Ram block on device does not match ram block on tuner! This should ONLY happen during a manual update!"; QLOG_ERROR() << "Tuner ram size:" << getDeviceRamBlock(locationid).size(); setDeviceRamBlock(locationid,payload); } if (payload != getLocalRamBlock(locationid)) { QLOG_ERROR() << "Ram block on device does not match ram block on tuner! This means local data is out of date!"; //We need to prompt the user, local ram is out of date. if (isLocalRamDirty(locationid)) { QLOG_ERROR() << "Ram block is marked dirty"; setLocalRamBlock(locationid,payload); markLocalRamLocationClean(locationid); } else { MemoryLocation *ram= getLocalRamBlockInfo(locationid); if (ram) { if (!ram->isReadOnly) { //Don't mark read only as dirty, we don't care. m_dirtyLocalRamMemoryList.append(QPair<unsigned short,QByteArray>(locationid,payload)); //emit localRamLocationDirty(locationid); } } else { //No memory location, don't do anything } } } else { QLOG_ERROR() << "Ram block on device matches ram block on tuner"; } } } //updateDataWindows(locationid); emit updateRequired(locationid); } return; }
void Chat::leaveChat() { QLOG_TRACE() << __PRETTY_FUNCTION__; QtConcurrent::run(this, &Chat::runLeaveChat); }
void EmsData::flashBlockUpdate(unsigned short locationid, QByteArray header, QByteArray payload) { QLOG_TRACE() << "Flash Block retrieved:" << "0x" + QString::number(locationid,16).toUpper(); Q_UNUSED(header) for (int l=0;l<getChildrenOfLocalFlashLocation(locationid).size();l++) { unsigned short childid = getChildrenOfLocalFlashLocation(locationid)[l]; QList<ConfigBlock> configlist = m_memoryMetaData->getConfigMetaData(QString::number(childid,16).toUpper()); QLOG_TRACE() << "Location" << QString::number(childid,16).toUpper() << "Size:" << configlist.size(); for (int i=0;i<configlist.size();i++) { //configlist[i].offset() QString valstr = ""; QString bytestr = ""; for (int k=0;k<configlist[i].size();k++) { unsigned int value = 0; for (int j=0;j<configlist[i].elementSize();j++) { //QLOG_DEBUG() << (unsigned char)block[m_fieldConfigList[i].second.offset() + (k * m_fieldConfigList[i].second.elementSize()) + j]; bytestr += QString::number((unsigned char)payload[configlist[i].offset() + (k * configlist[i].elementSize()) + j],16).toUpper() + ","; value += ((unsigned char)payload[configlist[i].offset() + (k * configlist[i].elementSize()) + j]) << (8 * (configlist[i].elementSize() - (j+1))); } //userValue = (ecuValue + translate) * scale valstr += QString::number(calcAxis(value,configlist[i].calc())) + ","; } valstr = valstr.mid(0,valstr.length()-1); QLOG_DEBUG() << "Pre value:" << "0x" + QString::number(locationid,16) << bytestr; //valstr == variable. emit configRecieved(configlist[i],QVariant(valstr)); } } if (!verifyMemoryBlock(locationid,header,payload)) { //QMessageBox::information(this,"Error","Flash Location ID 0x" + QString::number(locationid,16).toUpper() + " should be 1024 sized, but it is " + QString::number(payload.size()) + ". This should never happen"); QLOG_ERROR() << "Flash Location ID 0x" + QString::number(locationid,16).toUpper() + " should be 1024 sized, but it is " + QString::number(payload.size()) + ". This should never happen"; return; } if (hasDeviceFlashBlock(locationid)) { if (getDeviceFlashBlock(locationid).isEmpty()) { setLocalFlashBlock(locationid,payload); setDeviceFlashBlock(locationid,payload); emit updateRequired(locationid); return; } else { if (m_interrogationInProgress) { //checkEmsData->setDeviceFlashBlock(locationid,payload); for (int i=0;i<m_duplicateFlashMemoryList.size();i++) { if (m_duplicateFlashMemoryList[i]->locationid == locationid) { m_duplicateFlashMemoryList[i]->setData(payload); break; } } m_checkEmsDataInUse = true; } else { if (getDeviceFlashBlock(locationid) != payload) { QLOG_ERROR() << "Flash block in memory does not match flash block on tuner! This should not happen!"; QLOG_ERROR() << "Flash size:" << getDeviceFlashBlock(locationid).size(); QLOG_ERROR() << "Flash ID:" << "0x" + QString::number(locationid,16).toUpper(); setDeviceFlashBlock(locationid,payload); } if (getLocalFlashBlock(locationid) != payload) { if(isLocalFlashDirty(locationid)) { setLocalFlashBlock(locationid,payload); markLocalFlashLocationClean(locationid); } else { //We have incoming memory, when wedidn't know it was dirty. //Emit a signal to let the user know there is a descrepancy that needs //to be accepted, or rejected (in which case, rewritten to the ECU) m_dirtyLocalFlashMemoryList.append(QPair<unsigned short,QByteArray>(locationid,payload)); emit localFlashLocationDirty(locationid); } } } } } emit updateRequired(locationid); //updateDataWindows(locationid); return; }
void Chat::send(const QString &msg) { QLOG_TRACE() << __PRETTY_FUNCTION__; QtConcurrent::run(this, &Chat::runSend, msg); }
/** * @brief ConfigDialog::ConfigDialog * @param QWidget* _parent * @param Controller* _ctrl */ ConfigDialog::ConfigDialog(QWidget* _parent, Controller* _ctrl) : QDialog(_parent), ui(new Ui::ConfigDialog), m_ctrl(_ctrl), m_settings(_ctrl->settings()), m_enviro(_ctrl->enviro()) { ui->setupUi(this); ui_lockType = new QButtonGroupExt(this); connect(ui_lockType, SIGNAL(buttonToggled(int,bool)), this, SLOT(on_lockType_toggled(int,bool))); setFixedSize(size()); setWindowFlags(UM::SimpleDialogFlag); ui->tabs->setCurrentIndex(0); // checkboxes ui->optionMinimize->setChecked( m_settings->param(UM::CONF::minimize).toBool()); ui->optionCheckUpdates->setChecked( m_settings->param(UM::CONF::check_updates).toBool()); ui->optionAutostart->setChecked( m_enviro->isAutostart()); ui->optionUseHotkeys->setChecked( m_settings->param(UM::CONF::use_hotkeys).toBool()); ui->optionShowNotifications->setChecked(m_settings->param(UM::CONF::show_notifications).toBool()); ui->optionAutostart->setDisabled(!m_enviro->canAddShortcut()); // hotkeys bool useHotkeys = m_settings->param(UM::CONF::use_hotkeys).toBool(); on_optionUseHotkeys_toggled(useHotkeys); ui->hotkeyRefresh->setHotkey( m_settings->hotkey(UM::CONF::HOTKEY::refresh)); ui->hotkeyShowHide->setHotkey( m_settings->hotkey(UM::CONF::HOTKEY::showhide)); ui->hotkeyStartPause->setHotkey(m_settings->hotkey(UM::CONF::HOTKEY::startpause)); ui->hotkeyDelay->setHotkey( m_settings->hotkey(UM::CONF::HOTKEY::delay)); ui->hotkeyLockUnlock->setHotkey(m_settings->hotkey(UM::CONF::HOTKEY::lockunlock)); // delay QTime time = QTime(0, 0, 0).addSecs(m_settings->param(UM::CONF::delay).toInt()); ui->optionDelay->setTime(time); // languages foreach (const QString lang, m_enviro->languages()) { ui->optionLang->addItem( QIcon(":/lang/" + lang + "/flag"), QLocale::languageToString(QLocale(lang).language()), lang ); } ui->optionLang->setCurrentData(m_settings->param(UM::CONF::language)); // file opener QString opener = m_settings->param(UM::CONF::open_program).toString(); ui->optionOpenProgram->addItem(tr("Default viewer"), "default"); ui->optionOpenProgram->addItem(tr("Select program..."), "select"); if (!opener.isEmpty()) { ui->optionOpenProgram->addItem(QFileInfo(opener).fileName(), opener); ui->optionOpenProgram->setCurrentData(opener); } else { ui->optionOpenProgram->setCurrentData("default"); } // sets ui->optionDefaultSet->addItem(tr("[do not change]"), ""); for (int i=0, l=m_settings->nbSets(); i<l; i++) { Set* set = m_settings->set(i); ui->optionDefaultSet->addItem(set->name(), set->uuid()); } ui->optionDefaultSet->setCurrentData(m_settings->param(UM::CONF::default_set)); // lock boolean lockEnabled = m_settings->param(UM::CONF::lock_enabled).toBool(); on_optionLockEnabled_toggled(lockEnabled); ui->currentPassword->setDisabled(!lockEnabled); ui->optionLockEnabled->setChecked( lockEnabled); ui->optionLockStartup->setChecked( m_settings->param(UM::CONF::lock_startup).toBool()); ui->optionLockMinimize->setChecked( m_settings->param(UM::CONF::lock_minimize).toBool()); ui_lockType->addButton(ui->optionLockAll, UM::LOCK_ALL); ui_lockType->addButton(ui->optionLockSets, UM::LOCK_SETS); ui_lockType->setCheckedId(m_settings->param(UM::CONF::lock_type).toInt()); on_lockType_toggled(ui_lockType->checkedId(), true); QLOG_TRACE() << "ConfigDialog openned"; }
AstCtiSeat::~AstCtiSeat() { QLOG_TRACE() << "Destroying AstCtiSeat" << this->id << this->description; qDeleteAll(this->extensions); }
/** * Response signal for leaveChat. */ void ChatWidget::leaveChatCompleted(bool, const QString &) { QLOG_TRACE() << __PRETTY_FUNCTION__; emit leftChat(); this->close(); }