void JobWidget::setJob(const JobPtr &job) { if(_job && !_job->objectKey().isEmpty()) disconnect(_job.data(), SIGNAL(changed()), this, SLOT(updateDetails())); _job = job; if(_job->objectKey().isEmpty()) { _ui->newJobTreeWidget->reset(); _ui->stackedWidget->setCurrentWidget(_ui->jobNewPage); _ui->jobNameLineEdit->setFocus(); QSettings settings; _ui->preservePathsCheckBox->setChecked(settings.value("tarsnap/preserve_pathnames", true).toBool()); _ui->traverseMountCheckBox->setChecked(settings.value("tarsnap/traverse_mount", true).toBool()); _ui->followSymLinksCheckBox->setChecked(settings.value("tarsnap/follow_symlinks", false).toBool()); _ui->skipFilesSpinBox->setValue(settings.value("app/skip_files_value", 0).toLongLong()); } else { _ui->stackedWidget->setCurrentWidget(_ui->jobDetailPage); updateDetails(); connect(_job.data(), SIGNAL(changed()), this, SLOT(updateDetails())); } }
IosBuildStepConfigWidget::IosBuildStepConfigWidget(IosBuildStep *buildStep) : m_buildStep(buildStep) { m_ui = new Ui::IosBuildStep; m_ui->setupUi(this); Project *pro = m_buildStep->target()->project(); m_ui->buildArgumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs( m_buildStep->baseArguments())); m_ui->extraArgumentsLineEdit->setText(Utils::QtcProcess::joinArgs( m_buildStep->m_extraArguments)); m_ui->resetDefaultsButton->setEnabled(!m_buildStep->m_useDefaultArguments); updateDetails(); connect(m_ui->buildArgumentsTextEdit, SIGNAL(textChanged()), this, SLOT(buildArgumentsChanged())); connect(m_ui->resetDefaultsButton, SIGNAL(clicked()), this, SLOT(resetDefaultArguments())); connect(m_ui->extraArgumentsLineEdit, SIGNAL(editingFinished()), this, SLOT(extraArgumentsChanged())); connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()), this, SLOT(updateDetails())); connect(m_buildStep->target(), SIGNAL(kitChanged()), this, SLOT(updateDetails())); connect(pro, SIGNAL(environmentChanged()), this, SLOT(updateDetails())); }
Themes::Themes(FacilityInterface * facilityEngine) : ui(new Ui::interface()) { ui->setupUi(this); remainingSeconds= 0; speed = 0; progression_current=0; progression_total=0; modeIsForced = false; haveStarted = false; this->facilityEngine = facilityEngine; transferModel.setFacilityEngine(facilityEngine); menu=new QMenu(this); ui->toolButton->setMenu(menu); updateModeAndType(); connect(ui->actionAddFile,&QAction::triggered,this,&Themes::forcedModeAddFile); connect(ui->actionAddFileToCopy,&QAction::triggered,this,&Themes::forcedModeAddFileToCopy); connect(ui->actionAddFileToMove,&QAction::triggered,this,&Themes::forcedModeAddFileToMove); connect(ui->actionAddFolderToCopy,&QAction::triggered,this,&Themes::forcedModeAddFolderToCopy); connect(ui->actionAddFolderToMove,&QAction::triggered,this,&Themes::forcedModeAddFolderToMove); connect(ui->actionAddFolder,&QAction::triggered,this,&Themes::forcedModeAddFolder); updateDetails(); #ifdef ULTRACOPIER_PLUGIN_DEBUG connect(&transferModel,&TransferModel::debugInformation,this,&Themes::debugInformation); #endif #ifndef Q_OS_WIN32 ui->widget_bottom->setStyleSheet("background-color: rgb(237, 237, 237);"); #endif show(); }
void IosBuildStepConfigWidget::buildArgumentsChanged() { m_buildStep->setBaseArguments(Utils::QtcProcess::splitArgs( m_ui->buildArgumentsTextEdit->toPlainText())); m_ui->resetDefaultsButton->setEnabled(!m_buildStep->m_useDefaultArguments); updateDetails(); }
void LevelMenu::selectNextItem() { if(_currentItemIndex < _items.size() - 1) { _itemsPat->setPosition(_itemsPat->getPosition() + osg::Vec3(0, MENU_ITEM_HEIGHT, 0)); _currentItemIndex++; updateDetails(); } }
void LevelMenu::selectPreviousItem() { if(_currentItemIndex > 0) { _itemsPat->setPosition(_itemsPat->getPosition() - osg::Vec3(0, MENU_ITEM_HEIGHT, 0)); _currentItemIndex--; updateDetails(); } }
void QIArrowSplitter::sltSwitchDetailsPageNext() { /* Make sure details-page index feats the bounds: */ AssertReturnVoid(m_iDetailsIndex < m_details.size() - 1); /* Increase details-list index: */ ++m_iDetailsIndex; /* Update details: */ updateDetails(); }
void QIArrowSplitter::sltSwitchDetailsPageBack() { /* Make sure details-page index feats the bounds: */ AssertReturnVoid(m_iDetailsIndex > 0); /* Decrease details-list index: */ --m_iDetailsIndex; /* Update details: */ updateDetails(); }
void JobWidget::setJob(const JobPtr &job) { if(_job && !_job->objectKey().isEmpty()) { disconnect(_ui->detailTreeWidget, SIGNAL(selectionChanged()), this, SLOT(save())); disconnect(_ui->preservePathsCheckBox, SIGNAL(toggled(bool)), this, SLOT(save())); disconnect(_ui->traverseMountCheckBox, SIGNAL(toggled(bool)), this, SLOT(save())); disconnect(_ui->followSymLinksCheckBox, SIGNAL(toggled(bool)), this, SLOT(save())); disconnect(_ui->skipFilesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(save())); disconnect(_job.data(), SIGNAL(changed()), this, SLOT(updateDetails())); }
void AuthorGroupPage::setData(const ModXData *data) { model->setList(data->authorGroup); if (data->authorGroup.isEmpty()) { updateDetails(QItemSelection(), QItemSelection()); } else { ui.authorList->selectionModel()->select(model->index(0, 0), QItemSelectionModel::SelectCurrent); } }
void QIArrowSplitter::setDetails(const QStringPairList &details) { /* Assign new details: */ m_details = details; /* Reset the details-list index: */ m_iDetailsIndex = m_details.isEmpty() ? -1 : 0; /* Update navigation-buttons visibility: */ sltUpdateNavigationButtonsVisibility(); /* Update details-browser visibility: */ sltUpdateDetailsBrowserVisibility(); /* Update details: */ updateDetails(); }
ServiceItem::ServiceItem( Service *service, bool isPalringoService, QWidget *parent ) : ListItem( parent ) { this->service = service; this->isPalringoService = isPalringoService; setFirstLine( this->service->getNickname() + " - " + this->service->getStatus() ); setSecondLine( qpOnlineStatus::OnlineStatusText[ this->service->getOnlineStatus() ] ); setIcon( QPTools::getServiceIcon( this->service ) ); connect( service, SIGNAL( serviceUpdated() ), this, SLOT( updateDetails() ) ); this->setMenu(); }
void DataExplorer::updateEnvironment() { ui->selectEnvironment->clearPlottables(); int idx = 0; QVector<double> ticks; QVector<QString> labels; for (QCPAbstractPlottable *p : ui->selectMetric->selectedPlottables()) { int unit = p->property("UID").toInt(); int eid = 0; for (const Environment* e : exp->runs.keys()) { StatisticalSet vals = e->aggregate(unit,exp); QCPStatisticalBox* b = new QCPStatisticalBox(ui->selectEnvironment->xAxis,ui->selectEnvironment->yAxis); b->setData(idx,vals.min(),vals.quantile(0.25),vals.median(),vals.quantile(0.75),vals.max()); b->setProperty("UID",unit); b->setProperty("EID",eid++); ui->selectEnvironment->addPlottable(b); b->setSelected(true); labels.append(QString("%1 @ %2").arg(exp->data.at(unit)->descriptor->name(),e->label)); ticks.append(idx++); } } ui->selectEnvironment->xAxis->setAutoTicks(false); ui->selectEnvironment->xAxis->setAutoTickLabels(false); ui->selectEnvironment->xAxis->setSubTickCount(0); ui->selectEnvironment->xAxis->setTickLength(0, 4); ui->selectEnvironment->xAxis->setTickLabelRotation(90); ui->selectEnvironment->xAxis->setTickVector(ticks); ui->selectEnvironment->xAxis->setTickVectorLabels(labels); ui->selectEnvironment->setInteractions(QCP::iMultiSelect | QCP::iSelectPlottables); ui->selectEnvironment->setSelectionTolerance(10); ui->selectEnvironment->rescaleAxes(); ui->selectEnvironment->xAxis->scaleRange(1.1, ui->selectEnvironment->xAxis->range().center()); connect(ui->selectEnvironment,SIGNAL(selectionChangedByUser()), this, SLOT(updateDetails())); if (ui->axisFromZero->isChecked()) ui->selectEnvironment->yAxis->setRangeLower(0); ui->selectEnvironment->replot(); updateDetails(); }
void LevelMenu::returnFromLevel() { if(_currentLevel->playerReachedFinish()) { // update completions { std::stringstream ss; ss << atoi(_items[_currentItemIndex]["completions"].c_str()) + 1; _items[_currentItemIndex]["completions"] = ss.str(); } // update best time { time_t t = _currentLevel->getTime(); if(_items[_currentItemIndex]["besttime"] == "" | t < atol(_items[_currentItemIndex]["besttime"].c_str())) { std::stringstream ss; ss << t; _items[_currentItemIndex]["besttime"] = ss.str(); } } } // update number of deaths { std::stringstream ss; ss << atoi(_items[_currentItemIndex]["deaths"].c_str()) + _currentLevel->getNumDeaths(); _items[_currentItemIndex]["deaths"] = ss.str(); } viewer.setCameraManipulator(NULL); viewer.getCamera()->setViewMatrixAsLookAt(MENU_CAMERA_HOME_EYE, MENU_CAMERA_HOME_CENTER, MENU_CAMERA_HOME_UP); _currentLevel->resetScene(); viewer.setSceneData(this); _currentLevel = NULL; Player::getInstance()->reset(); updateDetails(); Sound::getInstance()->stop(LEVEL_MUSIC_FILE); Sound::getInstance()->playInLoop(MENU_MUSIC_FILE); }
LevelMenu::LevelMenu() : _currentLevel(NULL), _currentItemIndex(0) { _menuPat = new osg::PositionAttitudeTransform(); _menuPat->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); _keyboardHandler = new MenuKeyboardHandler(this); viewer.addEventHandler(_keyboardHandler); initializeCamera(); initializeHeader(); initializeBackgroundAnimation(); initializeSelector(); loadLevels(); updateDetails(); viewer.getCamera()->setUpdateCallback(new LevelMenuUpdater(this)); Sound::getInstance()->playInLoop(MENU_MUSIC_FILE); }
void DataExplorer::on_runNo_valueChanged(int) { std::vector<int> selectedM; QVector<int> selectedE; for (int i = 0; i < ui->selectMetric->plottableCount(); i++) { if (ui->selectMetric->plottable(i)->selected()) { selectedM.push_back(i); } } for (int i = 0; i < ui->selectEnvironment->plottableCount(); i++) { if (ui->selectEnvironment->plottable(i)->selected()) selectedE.push_back(i); } on_dispUnit_currentIndexChanged(ui->dispUnit->currentIndex()); for (int i : selectedM) ui->selectMetric->plottable(i)->setSelected(true); updateEnvironment(); for (int i : selectedE) ui->selectEnvironment->plottable(i)->setSelected(true); updateDetails(); ui->selectMetric->replot(); }
bool OdinPatcher::Impl::processContents() { archive_entry *entry; int laRet; int mzRet; zipFile zf = MinizipUtils::ctxGetZipFile(zOutput); while ((laRet = archive_read_next_header(aInput, &entry)) == ARCHIVE_OK) { if (cancelled) return false; const char *name = archive_entry_pathname(entry); if (!name) { continue; } updateDetails(name); if (strcmp(name, "boot.img") == 0) { LOGD("Handling boot.img"); // Boot images should never be over about 30 MiB. This check is here // so the patcher won't try to read a multi-gigabyte system image // into RAM la_int64_t size = archive_entry_size(entry); if (size > 30 * 1024 * 1024) { LOGE("Boot image exceeds 30 MiB: %" PRId64, size); error = ErrorCode::BootImageTooLargeError; return false; } std::vector<unsigned char> data; if (size > 0) { data.reserve(size); } char buf[10240]; la_ssize_t n; while ((n = archive_read_data(aInput, buf, sizeof(buf))) > 0) { data.insert(data.end(), buf, buf + n); } if (n != 0) { LOGE("libarchive: Failed to read data: %s", archive_error_string(aInput)); error = ErrorCode::ArchiveReadDataError; return false; } if (!MultiBootPatcher::patchBootImage(pc, info, &data, &error)) { return false; } auto errorRet = MinizipUtils::addFile(zf, name, data); if (errorRet != ErrorCode::NoError) { error = errorRet; return false; } continue; } else if (!StringUtils::starts_with(name, "cache.img") && !StringUtils::starts_with(name, "system.img")) { LOGD("Skipping %s", name); if (archive_read_data_skip(aInput) != ARCHIVE_OK) { LOGE("libarchive: Failed to skip data: %s", archive_error_string(aInput)); error = ErrorCode::ArchiveReadDataError; return false; } continue; } LOGD("Handling %s", name); std::string zipName(name); if (StringUtils::ends_with(name, ".ext4")) { zipName.erase(zipName.size() - 5); } zipName += ".sparse"; // Ha! I'll be impressed if a Samsung firmware image does NOT need zip64 int zip64 = archive_entry_size(entry) > ((1ll << 32) - 1); zip_fileinfo zi; memset(&zi, 0, sizeof(zi)); // Open file in output zip mzRet = zipOpenNewFileInZip2_64( zf, // file zipName.c_str(), // filename &zi, // zip_fileinfo nullptr, // extrafield_local 0, // size_extrafield_local nullptr, // extrafield_global 0, // size_extrafield_global nullptr, // comment Z_DEFLATED, // method Z_DEFAULT_COMPRESSION, // level 0, // raw zip64 // zip64 ); if (mzRet != ZIP_OK) { LOGE("minizip: Failed to open new file in output zip: %s", MinizipUtils::zipErrorString(mzRet).c_str()); error = ErrorCode::ArchiveWriteHeaderError; return false; } la_ssize_t nRead; char buf[10240]; while ((nRead = archive_read_data(aInput, buf, sizeof(buf))) > 0) { if (cancelled) return false; mzRet = zipWriteInFileInZip(zf, buf, nRead); if (mzRet != ZIP_OK) { LOGE("minizip: Failed to write %s in output zip: %s", zipName.c_str(), MinizipUtils::zipErrorString(mzRet).c_str()); error = ErrorCode::ArchiveWriteDataError; zipCloseFileInZip(zf); return false; } } if (nRead != 0) { LOGE("libarchive: Failed to read %s: %s", name, archive_error_string(aInput)); error = ErrorCode::ArchiveReadDataError; zipCloseFileInZip(zf); return false; } // Close file in output zip mzRet = zipCloseFileInZip(zf); if (mzRet != ZIP_OK) { LOGE("minizip: Failed to close file in output zip: %s", MinizipUtils::zipErrorString(mzRet).c_str()); error = ErrorCode::ArchiveWriteDataError; return false; } } if (laRet != ARCHIVE_EOF) { LOGE("libarchive: Failed to read header: %s", archive_error_string(aInput)); error = ErrorCode::ArchiveReadHeaderError; return false; } if (cancelled) return false; return true; }
bool OdinPatcher::Impl::patchTar() { #ifdef __ANDROID__ static const char *prefix = "/proc/self/fd/"; fd = -1; if (StringUtils::starts_with(info->inputPath(), prefix)) { std::string fdStr = info->inputPath().substr(strlen(prefix)); if (!convertToInt(fdStr.c_str(), &fd)) { LOGE("Invalid fd: %s", fdStr.c_str()); error = ErrorCode::FileOpenError; return false; } LOGD("Input path '%s' is a file descriptor: %d", info->inputPath().c_str(), fd); } #endif // Get file size for progress information #ifdef __ANDROID__ if (fd > 0) { off64_t offset = lseek64(fd, 0, SEEK_END); if (offset < 0 || lseek64(fd, 0, SEEK_SET) < 0) { LOGE("%s: Failed to seek fd: %s", info->inputPath().c_str(), strerror(errno)); error = ErrorCode::FileSeekError; return false; } maxBytes = offset; } else { #endif io::File file; if (!file.open(info->inputPath(), io::File::OpenRead)) { LOGE("%s: Failed to open: %s", info->inputPath().c_str(), file.errorString().c_str()); error = ErrorCode::FileOpenError; return false; } if (!file.seek(0, io::File::SeekEnd)) { LOGE("%s: Failed to seek: %s", info->inputPath().c_str(), file.errorString().c_str()); error = ErrorCode::FileReadError; return false; } if (!file.tell(&maxBytes)) { LOGE("%s: Failed to get position: %s", info->inputPath().c_str(), file.errorString().c_str()); error = ErrorCode::FileReadError; return false; } file.close(); #ifdef __ANDROID__ } #endif updateProgress(bytes, maxBytes); if (!openInputArchive()) { return false; } if (!openOutputArchive()) { return false; } if (cancelled) return false; if (!processContents()) { return false; } std::vector<CopySpec> toCopy{ { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/odinupdater", "META-INF/com/google/android/update-binary.orig" }, { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/odinupdater.sig", "META-INF/com/google/android/update-binary.orig.sig" }, { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/fuse-sparse", "fuse-sparse" }, { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/fuse-sparse.sig", "fuse-sparse.sig" }, { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/mbtool_recovery", "META-INF/com/google/android/update-binary" }, { pc->dataDirectory() + "/binaries/android/" + mb_device_architecture(info->device()) + "/mbtool_recovery.sig", "META-INF/com/google/android/update-binary.sig" }, { pc->dataDirectory() + "/scripts/bb-wrapper.sh", "multiboot/bb-wrapper.sh" }, { pc->dataDirectory() + "/scripts/bb-wrapper.sh.sig", "multiboot/bb-wrapper.sh.sig" } }; zipFile zf = MinizipUtils::ctxGetZipFile(zOutput); ErrorCode result; for (const CopySpec &spec : toCopy) { if (cancelled) return false; updateDetails(spec.target); result = MinizipUtils::addFile(zf, spec.target, spec.source); if (result != ErrorCode::NoError) { error = result; return false; } } if (cancelled) return false; updateDetails("multiboot/info.prop"); const std::string infoProp = MultiBootPatcher::createInfoProp(pc, info->romId()); result = MinizipUtils::addFile( zf, "multiboot/info.prop", std::vector<unsigned char>(infoProp.begin(), infoProp.end())); if (result != ErrorCode::NoError) { error = result; return false; } if (cancelled) return false; updateDetails("block_devs.prop"); std::string blockDevsProp; blockDevsProp += "system="; blockDevsProp += mb_device_system_block_devs(info->device())[0]; blockDevsProp += "\n"; blockDevsProp += "boot="; blockDevsProp += mb_device_boot_block_devs(info->device())[0]; blockDevsProp += "\n"; result = MinizipUtils::addFile( zf, "block_devs.prop", std::vector<unsigned char>( blockDevsProp.begin(), blockDevsProp.end())); if (result != ErrorCode::NoError) { error = result; return false; } if (cancelled) return false; updateDetails("multiboot/device.json"); char *json = mb_device_to_json(info->device()); if (!json) { error = ErrorCode::MemoryAllocationError; return false; } result = MinizipUtils::addFile( zf, "multiboot/device.json", std::vector<unsigned char>(json, json + strlen(json))); free(json); if (result != ErrorCode::NoError) { error = result; return false; } if (cancelled) return false; return true; }
/*! * \brief First pass of patching operation * * This performs the following operations: * * - If the PatchInfo has the `hasBootImage` parameter set to true for the * current file, then patch the boot images and copy them to the output file. * - Files needed by an AutoPatcher are extracted to the temporary directory. * - Otherwise, the file is copied directly to the output zip. */ bool MultiBootPatcher::Impl::pass1(zipFile const zOutput, const std::string &temporaryDir, const std::unordered_set<std::string> &exclude) { // Boot image params bool hasBootImage = info->patchInfo()->hasBootImage(); auto piBootImages = info->patchInfo()->bootImages(); int ret = unzGoToFirstFile(zInput); if (ret != UNZ_OK) { error = PatcherError::createArchiveError( ErrorCode::ArchiveReadHeaderError, std::string()); return false; } do { if (cancelled) return false; unz_file_info64 fi; std::string curFile; if (!FileUtils::mzGetInfo(zInput, &fi, &curFile)) { error = PatcherError::createArchiveError( ErrorCode::ArchiveReadHeaderError, curFile); return false; } updateFiles(++files, maxFiles); updateDetails(curFile); // Skip files that should be patched and added in pass 2 if (exclude.find(curFile) != exclude.end()) { if (!FileUtils::mzExtractFile(zInput, temporaryDir)) { error = PatcherError::createArchiveError( ErrorCode::ArchiveReadDataError, curFile); return false; } continue; } // Try to patch the patchinfo-defined boot images as well as // files that end in a common boot image extension bool inList = std::find(piBootImages.begin(), piBootImages.end(), curFile) != piBootImages.end(); bool isExtImg = boost::ends_with(curFile, ".img"); bool isExtLok = boost::ends_with(curFile, ".lok"); // Boot images should be over about 30 MiB. This check is here so the // patcher won't try to read a multi-gigabyte system image into RAM bool isSizeOK = fi.uncompressed_size <= 30 * 1024 * 1024; if (hasBootImage && (inList || isExtImg || isExtLok) && isSizeOK) { // Load the file into memory std::vector<unsigned char> data; if (!FileUtils::mzReadToMemory(zInput, &data, &laProgressCb, this)) { error = PatcherError::createArchiveError( ErrorCode::ArchiveReadDataError, curFile); return false; } // If the file contains the boot image magic string, then // assume it really is a boot image and patch it if (data.size() >= 512) { const char *magic = BootImage::BootMagic; unsigned int size = BootImage::BootMagicSize; auto end = data.begin() + 512; auto it = std::search(data.begin(), end, magic, magic + size); if (it != end) { if (!patchBootImage(&data)) { return false; } // Update total size maxBytes += (data.size() - fi.uncompressed_size); } } auto ret2 = FileUtils::mzAddFile(zOutput, curFile, data); if (!ret2) { error = ret2; return false; } bytes += data.size(); } else { // Directly copy other files to the output zip // Rename the installer for mbtool if (curFile == "META-INF/com/google/android/update-binary") { curFile = "META-INF/com/google/android/update-binary.orig"; } if (!FileUtils::mzCopyFileRaw(zInput, zOutput, curFile, &laProgressCb, this)) { FLOGW("minizip: Failed to copy raw data: {}", curFile); error = PatcherError::createArchiveError( ErrorCode::ArchiveWriteDataError, curFile); return false; } bytes += fi.uncompressed_size; } } while ((ret = unzGoToNextFile(zInput)) == UNZ_OK); if (ret != UNZ_END_OF_LIST_OF_FILE) { error = PatcherError::createArchiveError( ErrorCode::ArchiveReadHeaderError, std::string()); return false; } if (cancelled) return false; return true; }
bool MultiBootPatcher::Impl::patchZip() { std::unordered_set<std::string> excludeFromPass1; for (auto const &item : info->patchInfo()->autoPatchers()) { auto args = info->patchInfo()->autoPatcherArgs(item); auto *ap = pc->createAutoPatcher(item, info, args); if (!ap) { error = PatcherError::createPatcherCreationError( ErrorCode::AutoPatcherCreateError, item); return false; } // TODO: AutoPatcher::newFiles() is not supported yet std::vector<std::string> existingFiles = ap->existingFiles(); if (existingFiles.empty()) { pc->destroyAutoPatcher(ap); continue; } autoPatchers.push_back(ap); // AutoPatcher files should be excluded from the first pass for (auto const &file : existingFiles) { excludeFromPass1.insert(file); } } // Unlike the old patcher, we'll write directly to the new file if (!openOutputArchive()) { return false; } if (cancelled) return false; FileUtils::ArchiveStats stats; auto result = FileUtils::mzArchiveStats(info->filename(), &stats, std::vector<std::string>()); if (!result) { error = result; return false; } maxBytes = stats.totalSize; if (cancelled) return false; // +1 for mbtool_recovery (update-binary) // +1 for bb-wrapper.sh // +1 for info.prop maxFiles = stats.files + 3; updateFiles(files, maxFiles); if (!openInputArchive()) { return false; } // Create temporary dir for extracted files for autopatchers std::string tempDir = FileUtils::createTemporaryDir(pc->tempDirectory()); if (!pass1(zOutput, tempDir, excludeFromPass1)) { boost::filesystem::remove_all(tempDir); return false; } if (cancelled) return false; // On the second pass, run the autopatchers on the rest of the files if (!pass2(zOutput, tempDir, excludeFromPass1)) { boost::filesystem::remove_all(tempDir); return false; } boost::filesystem::remove_all(tempDir); if (cancelled) return false; updateFiles(++files, maxFiles); updateDetails("META-INF/com/google/android/update-binary"); // Add mbtool_recovery result = FileUtils::mzAddFile( zOutput, "META-INF/com/google/android/update-binary", pc->dataDirectory() + "/binaries/android/" + info->device()->architecture() + "/mbtool_recovery"); if (!result) { error = result; return false; } if (cancelled) return false; updateFiles(++files, maxFiles); updateDetails("multiboot/bb-wrapper.sh"); // Add bb-wrapper.sh result = FileUtils::mzAddFile( zOutput, "multiboot/bb-wrapper.sh", pc->dataDirectory() + "/scripts/bb-wrapper.sh"); if (!result) { error = result; return false; } if (cancelled) return false; updateFiles(++files, maxFiles); updateDetails("multiboot/info.prop"); const std::string infoProp = createInfoProp(); result = FileUtils::mzAddFile( zOutput, "multiboot/info.prop", std::vector<unsigned char>(infoProp.begin(), infoProp.end())); if (!result) { error = result; return false; } if (cancelled) return false; return true; }
void QIArrowSplitter::prepare() { /* Create main-layout: */ m_pMainLayout = new QVBoxLayout(this); AssertPtrReturnVoid(m_pMainLayout); { /* Configure main-layout: */ m_pMainLayout->setContentsMargins(0, 0, 0, 0); m_pMainLayout->setSpacing(3); /* Create button-layout: */ QHBoxLayout *pButtonLayout = new QHBoxLayout; AssertPtrReturnVoid(pButtonLayout); { /* Configure button-layout: */ pButtonLayout->setContentsMargins(0, 0, 0, 0); pButtonLayout->setSpacing(0); /* Create switch-button: */ m_pSwitchButton = new QIArrowButtonSwitch; AssertPtrReturnVoid(m_pSwitchButton); { /* Configure switch-button: */ m_pSwitchButton->setIconSize(QSize(10, 10)); m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Collapsed, UIIconPool::iconSet(":/arrow_right_10px.png")); m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Expanded, UIIconPool::iconSet(":/arrow_down_10px.png")); connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateNavigationButtonsVisibility())); connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateDetailsBrowserVisibility())); /* Add switch-button into button-layout: */ pButtonLayout->addWidget(m_pSwitchButton); } /* Add stretch: */ pButtonLayout->addStretch(); /* Create back-button: */ m_pBackButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Back); AssertPtrReturnVoid(m_pBackButton); { /* Configure back-button: */ m_pBackButton->setIconSize(QSize(10, 10)); m_pBackButton->setIcon(UIIconPool::iconSet(":/arrow_left_10px.png")); connect(m_pBackButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageBack())); /* Add back-button into button-layout: */ pButtonLayout->addWidget(m_pBackButton); } /* Create next-button: */ m_pNextButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Next); AssertPtrReturnVoid(m_pNextButton); { /* Configure next-button: */ m_pNextButton->setIconSize(QSize(10, 10)); m_pNextButton->setIcon(UIIconPool::iconSet(":/arrow_right_10px.png")); connect(m_pNextButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageNext())); /* Add next-button into button-layout: */ pButtonLayout->addWidget(m_pNextButton); } /* Add button layout into main-layout: */ m_pMainLayout->addLayout(pButtonLayout); /* Update navigation-buttons visibility: */ sltUpdateNavigationButtonsVisibility(); } /* Create details-browser: */ m_pDetailsBrowser = new QIDetailsBrowser; AssertPtrReturnVoid(m_pDetailsBrowser); { /* Add details-browser into main-layout: */ m_pMainLayout->addWidget(m_pDetailsBrowser); /* Update details-browser visibility: */ sltUpdateDetailsBrowserVisibility(); /* Update details: */ updateDetails(); } } /* Apply size-policy finally: */ setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); }
void QIArrowSplitter::retranslateUi() { /* Update details: */ updateDetails(); }
void DataExplorer::on_detailType_currentIndexChanged(int) { updateDetails(); }
void AuthorGroupPage::getData(ModXData *data) { QItemSelection selection = ui.authorList->selectionModel()->selection(); updateDetails(selection, selection); data->authorGroup = model->list(); }
void LogExplorerDialog::updateTable(bool WithFiltering) { while (ui->LogTableWidget->rowCount() > 0) ui->LogTableWidget->removeRow(0); ui->LogTableWidget->setRowCount(0); updateDetails(-1); QStringList FilteredTypes; QStringList FilteredSimulators; QStringList FilteredObservers; if (WithFiltering) { for (int i=0; i<ui->TypeFilterListWidget->count(); i++) if (ui->TypeFilterListWidget->item(i)->checkState() == Qt::Checked) FilteredTypes.append(ui->TypeFilterListWidget->item(i)->text()); for (int i=0; i<ui->SimulatorFilterListWidget->count(); i++) if (ui->SimulatorFilterListWidget->item(i)->checkState() == Qt::Checked) FilteredSimulators.append(ui->SimulatorFilterListWidget->item(i)->text()); for (int i=0; i<ui->ObserverFilterListWidget->count(); i++) if (ui->ObserverFilterListWidget->item(i)->checkState() == Qt::Checked) FilteredObservers.append(ui->ObserverFilterListWidget->item(i)->text()); } int RowCount = 0; for (int i=0; i< m_LogInfos.count(); i++) { LogItemInfos Item = m_LogInfos[i]; QString TypeStr = Item["type"]; QString ContextSrcStr = Item["context.source"]; if (!(TypeStr.isEmpty() || ContextSrcStr.isEmpty())) { bool OKToDisplay = true; if (WithFiltering) { if (!FilteredTypes.contains(TypeStr)) OKToDisplay = false; else if (Item.contains("context.source")) { if (ContextSrcStr == "app" && ui->AppFilterCheckBox->checkState() == Qt::Unchecked) OKToDisplay = false; else if (ContextSrcStr == "framework" && ui->FrameworkFilterCheckBox->checkState() == Qt::Unchecked) OKToDisplay = false; else if (ContextSrcStr == "ware") { QString WareTypeStr = Item["context.waretype"]; QString WareIDStr = Item["context.wareid"]; if (WareTypeStr == "simulator" && (FilteredSimulators.empty() || !FilteredSimulators.contains(WareIDStr))) OKToDisplay = false; else if (WareTypeStr == "observer" && (FilteredObservers.empty() || !FilteredObservers.contains(WareIDStr))) OKToDisplay = false; } } } if (OKToDisplay) { RowCount++; ui->LogTableWidget->setRowCount(RowCount); QTableWidgetItem *TableItem = new QTableWidgetItem(TypeStr); TableItem->setTextAlignment(Qt::AlignCenter); TableItem->setData(Qt::UserRole,i); if (TypeStr.toLower() == "warning") TableItem->setBackground(QBrush(QColor("#FFCF5A"))); else if (TypeStr.toLower() == "info") TableItem->setBackground(QBrush(QColor("#6CC2FF"))); else if (TypeStr.toLower() == "debug") TableItem->setBackground(QBrush(QColor("#D0D0D0"))); else if (TypeStr.toLower() == "error") TableItem->setBackground(QBrush(QColor("#FF625A"))); ui->LogTableWidget->setItem(RowCount-1, 0, TableItem); TableItem = new QTableWidgetItem(Item["order"]); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 1, TableItem); if (ContextSrcStr == "ware" && Item.contains("context.waretype") && Item.contains("context.wareid")) { TableItem = new QTableWidgetItem(Item["context.waretype"]+": "+Item["context.wareid"]); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 2, TableItem); } else if (ContextSrcStr == "framework") { TableItem = new QTableWidgetItem("framework"); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 2, TableItem); } else if (ContextSrcStr == "app") { TableItem = new QTableWidgetItem("application"); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 2, TableItem); } if (Item.contains("context.stage")) { TableItem = new QTableWidgetItem(Item["context.stage"]); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 3, TableItem); } if (Item.contains("context.timeindex")) { TableItem = new QTableWidgetItem(Item["context.timeindex"]); TableItem->setTextAlignment(Qt::AlignCenter); ui->LogTableWidget->setItem(RowCount-1, 4, TableItem); } TableItem = new QTableWidgetItem(Item["msg"]); ui->LogTableWidget->setItem(RowCount-1, 5, TableItem); } } } #if QT_VERSION < QT_VERSION_CHECK(5,0,0) ui->LogTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); #else ui->LogTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif if (ui->LogTableWidget->rowCount()) ui->MessagesCountLabel->setText(tr("%1 message(s)").arg(ui->LogTableWidget->rowCount())); else ui->MessagesCountLabel->setText(tr("no message")); }