void FormatSettingsPopup::showEvent(QShowEvent *se) { #ifdef WIN32 if (m_format == "avi") { assert(m_codecComboBox); m_codecComboBox->blockSignals(true); m_codecComboBox->clear(); ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); TEnumProperty *eProps = dynamic_cast<TEnumProperty *>(m_props->getProperty(0)); assert(eProps); TDimension res(0, 0); if (m_levelPath.isEmpty()) res = scene->getCurrentCamera()->getRes(); else { TLevelReaderP lr(m_levelPath); TLevelP level = lr->loadInfo(); const TImageInfo *info = lr->getImageInfo(level->begin()->first); res.lx = info->m_lx; res.ly = info->m_ly; } TEnumProperty::Range range = eProps->getRange(); int currIndex = -1; wstring defaultVal = eProps->getValue(); QMap<wstring, bool> usableCodecs = AviCodecRestrictions::getUsableCodecs(res); for (int i = 0; i < (int)range.size(); i++) { wstring nameProp = range[i]; if (nameProp == L"Uncompressed" || (usableCodecs.contains(nameProp) && usableCodecs[nameProp])) { if (nameProp == defaultVal) currIndex = m_codecComboBox->count(); m_codecComboBox->addItem(QString::fromStdWString(nameProp)); } } m_codecComboBox->blockSignals(false); if (currIndex >= 0) m_codecComboBox->setCurrentIndex(currIndex); } #endif Dialog::showEvent(se); }
void FormatSettingsPopup::buildPropertyComboBox(int index, TPropertyGroup *props) { TEnumProperty *prop = (TEnumProperty *)(props->getProperty(index)); assert(prop); DVGui::PropertyComboBox *comboBox = new DVGui::PropertyComboBox(this, prop); m_widgets[prop->getName()] = comboBox; #ifdef _WIN32 connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(onComboBoxIndexChanged(const QString &))); #endif TEnumProperty::Range range = prop->getRange(); TEnumProperty::Items items = prop->getItems(); int currIndex = -1; std::wstring defaultVal = prop->getValue(); for (int i = 0; i < (int)range.size(); i++) { std::wstring nameProp = range[i]; if (nameProp.find(L"16(GREYTONES)") != -1) // pezza per il tif: il 16 lo scrive male, e il 48 lo legge male... continue; /* if (nameProp.find(L"ThunderScan")!=-1) //pezza epr il tif, molte compressioni non vanno..scive male il file break;*/ if (nameProp == defaultVal) currIndex = comboBox->count(); comboBox->addItem(items[i].UIName, QString::fromStdWString(nameProp)); } if (currIndex >= 0) comboBox->setCurrentIndex(currIndex); int row = m_mainLayout->rowCount(); m_mainLayout->addWidget(new QLabel(prop->getQStringName() + ":", this), row, 0, Qt::AlignRight | Qt::AlignVCenter); m_mainLayout->addWidget(comboBox, row, 1); #ifdef _WIN32 if (m_format == "avi") m_codecComboBox = comboBox; #endif }