本文整理汇总了C++中qCDebug函数的典型用法代码示例。如果您正苦于以下问题:C++ qCDebug函数的具体用法?C++ qCDebug怎么用?C++ qCDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qCDebug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printByteArray
static void printByteArray(const QByteArray &data)
{
qCDebug(sshLog, "%s", data.toHex().constData());
}
示例2: initializeAESKeys
bool Wallet::readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferSize) {
unsigned char ivec[16];
unsigned char ckey[32];
initializeAESKeys(ivec, ckey, _salt);
// read encrypted file
QFile inputFile(inputFilePath);
if (!inputFile.exists()) {
qCDebug(commerce) << "cannot decrypt file" << inputFilePath << "it doesn't exist";
return false;
}
inputFile.open(QIODevice::ReadOnly | QIODevice::Text);
bool foundHeader = false;
bool foundFooter = false;
QByteArray base64EncryptedBuffer;
while (!inputFile.atEnd()) {
QString line(inputFile.readLine());
if (!foundHeader) {
foundHeader = (line == IMAGE_HEADER);
} else {
foundFooter = (line == IMAGE_FOOTER);
if (!foundFooter) {
base64EncryptedBuffer.append(line);
}
}
}
inputFile.close();
if (! (foundHeader && foundFooter)) {
qCDebug(commerce) << "couldn't parse" << inputFilePath << foundHeader << foundFooter;
return false;
}
// convert to bytes
auto encryptedBuffer = QByteArray::fromBase64(base64EncryptedBuffer);
// setup decrypted buffer
unsigned char* outputBuffer = new unsigned char[encryptedBuffer.size()];
int tempSize;
// TODO: add error handling
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
if (!EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, ckey, ivec)) {
qCDebug(commerce) << "decrypt init failure";
delete[] outputBuffer;
return false;
}
if (!EVP_DecryptUpdate(ctx, outputBuffer, &tempSize, (unsigned char*)encryptedBuffer.data(), encryptedBuffer.size())) {
qCDebug(commerce) << "decrypt update failure";
delete[] outputBuffer;
return false;
}
*outputBufferSize = tempSize;
if (!EVP_DecryptFinal_ex(ctx, outputBuffer + tempSize, &tempSize)) {
qCDebug(commerce) << "decrypt final failure";
delete[] outputBuffer;
return false;
}
EVP_CIPHER_CTX_free(ctx);
*outputBufferSize += tempSize;
*outputBufferPtr = outputBuffer;
qCDebug(commerce) << "decrypted buffer size" << *outputBufferSize;
return true;
}
示例3: qCDebug
void HttpDaemon::actionExecuted(const ActionTypeId &actionTypeId)
{
qCDebug(dcMockDevice) << "Log actions executed" << actionTypeId.toString();
m_actionList.append(qMakePair<ActionTypeId, QDateTime>(actionTypeId, QDateTime::currentDateTime()));
}
示例4: buddyViewScrollableContainer
// public slot virtual [base kpView]
void kpUnzoomedThumbnailView::adjustToEnvironment ()
{
if (!buddyView () || !buddyViewScrollableContainer () || !document ())
return;
const int scrollViewContentsX =
buddyViewScrollableContainer()->horizontalScrollBar()->value();
const int scrollViewContentsY =
buddyViewScrollableContainer ()->verticalScrollBar()->value();
#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
qCDebug(kpLogViews) << "kpUnzoomedThumbnailView(" << name ()
<< ")::adjustToEnvironment("
<< scrollViewContentsX
<< ","
<< scrollViewContentsY
<< ") width=" << width ()
<< " height=" << height ()
<< endl;
#endif
#if 1
int x;
if (document ()->width () > width ())
{
x = (int) buddyView ()->transformViewToDocX (scrollViewContentsX);
const int rightMostAllowedX = qMax (0, document ()->width () - width ());
#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
qCDebug(kpLogViews) << "\tdocX=" << x
<< " docWidth=" << document ()->width ()
<< " rightMostAllowedX=" << rightMostAllowedX
<< endl;
#endif
if (x > rightMostAllowedX)
x = rightMostAllowedX;
}
// Thumbnail width <= doc width
else
{
// Center X (rather than flush left to be consistent with
// kpZoomedThumbnailView)
x = -(width () - document ()->width ()) / 2;
}
int y;
if (document ()->height () > height ())
{
y = (int) buddyView ()->transformViewToDocY (scrollViewContentsY);
const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
#if DEBUG_KP_UNZOOMED_THUMBNAIL_VIEW
qCDebug(kpLogViews) << "\tdocY=" << y
<< " docHeight=" << document ()->height ()
<< " bottomMostAllowedY=" << bottomMostAllowedY
<< endl;
#endif
if (y > bottomMostAllowedY)
y = bottomMostAllowedY;
}
// Thumbnail height <= doc height
else
{
// Center Y (rather than flush top to be consistent with
// kpZoomedThumbnailView)
y = -(height () - document ()->height ()) / 2;
}
// Prefer to keep visible area centred in thumbnail instead of flushed left.
// Gives more editing context to the left and top.
// But feels awkward for left-to-right users. So disabled for now.
// Not totally tested.
#else
if (!buddyViewScrollableContainer ())
return;
QRect docRect = buddyView ()->transformViewToDoc (
QRect (buddyViewScrollableContainer ()->horizontalScrollBar()->value(),
buddyViewScrollableContainer ()->verticalScrollBar()->value(),
qMin (buddyView ()->width (), buddyViewScrollableContainer ()->viewport()->width ()),
qMin (buddyView ()->height (), buddyViewScrollableContainer ()->viewport()->height ())));
x = docRect.x () - (width () - docRect.width ()) / 2;
qCDebug(kpLogViews) << "\tnew suggest x=" << x;
const int rightMostAllowedX = qMax (0, document ()->width () - width ());
if (x < 0)
x = 0;
if (x > rightMostAllowedX)
x = rightMostAllowedX;
y = docRect.y () - (height () - docRect.height ()) / 2;
qCDebug(kpLogViews) << "\tnew suggest y=" << y;
const int bottomMostAllowedY = qMax (0, document ()->height () - height ());
if (y < 0)
y = 0;
if (y > bottomMostAllowedY)
y = bottomMostAllowedY;
#endif
//.........这里部分代码省略.........
示例5: qMax
void FilterActionFilter::filterImage()
{
d->appliedActions.clear();
d->errorMessage.clear();
const float progressIncrement = 1.0 / qMax(1, d->actions.size());
float progress = 0;
postProgress(0);
DImg img = m_orgImage;
foreach(const FilterAction& action, d->actions)
{
qCDebug(DIGIKAM_DIMG_LOG) << "Replaying action" << action.identifier();
if (action.isNull())
{
continue;
}
if (DImgBuiltinFilter::isSupported(action.identifier()))
{
DImgBuiltinFilter filter(action);
if (!filter.isValid())
{
d->errorMessage = i18n("Built-in transformation not supported");
if (d->continueOnError)
{
continue;
}
else
{
break;
}
}
filter.apply(img);
d->appliedActions << filter.filterAction();
}
else
{
QScopedPointer<DImgThreadedFilter> filter
(DImgFilterManager::instance()->createFilter(action.identifier(), action.version()));
if (!filter)
{
d->errorMessage = i18n("Filter identifier or version is not supported");
if (d->continueOnError)
{
continue;
}
else
{
break;
}
}
filter->readParameters(action);
if (!filter->parametersSuccessfullyRead())
{
d->errorMessage = filter->readParametersError(action);
if (d->continueOnError)
{
continue;
}
else
{
break;
}
}
// compute
filter->setupAndStartDirectly(img, this, (int)progress, (int)(progress + progressIncrement));
img = filter->getTargetImage();
d->appliedActions << filter->filterAction();
}
progress += progressIncrement;
postProgress((int)progress);
}
m_destImage = img;
}
示例6: qCDebug
void ScriptEngine::errorInLoadingScript(const QUrl& url) {
qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
emit errorLoadingScript(_fileNameString); // ??
}
示例7: qCDebug
QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat)
{
KeycodeAction result = None;
bool first_press = pressed && !autorepeat;
const QEvdevKeyboardMap::Mapping *map_plain = 0;
const QEvdevKeyboardMap::Mapping *map_withmod = 0;
quint8 modifiers = m_modifiers;
// get a specific and plain mapping for the keycode and the current modifiers
for (int i = 0; i < m_keymap_size && !(map_plain && map_withmod); ++i) {
const QEvdevKeyboardMap::Mapping *m = m_keymap + i;
if (m->keycode == keycode) {
if (m->modifiers == 0)
map_plain = m;
quint8 testmods = m_modifiers;
if (m_locks[0] /*CapsLock*/ && (m->flags & QEvdevKeyboardMap::IsLetter))
testmods ^= QEvdevKeyboardMap::ModShift;
if (m->modifiers == testmods)
map_withmod = m;
}
}
if (m_locks[0] /*CapsLock*/ && map_withmod && (map_withmod->flags & QEvdevKeyboardMap::IsLetter))
modifiers ^= QEvdevKeyboardMap::ModShift;
qCDebug(qLcEvdevKeyMap, "Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d",
keycode, modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0,
int(map_plain ? map_plain - m_keymap : -1),
int(map_withmod ? map_withmod - m_keymap : -1),
m_keymap_size);
const QEvdevKeyboardMap::Mapping *it = map_withmod ? map_withmod : map_plain;
if (!it) {
// we couldn't even find a plain mapping
qCDebug(qLcEvdevKeyMap, "Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, modifiers);
return result;
}
bool skip = false;
quint16 unicode = it->unicode;
quint32 qtcode = it->qtcode;
if ((it->flags & QEvdevKeyboardMap::IsModifier) && it->special) {
// this is a modifier, i.e. Shift, Alt, ...
if (pressed)
m_modifiers |= quint8(it->special);
else
m_modifiers &= ~quint8(it->special);
} else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) {
// (Caps|Num|Scroll)Lock
if (first_press) {
quint8 &lock = m_locks[qtcode - Qt::Key_CapsLock];
lock ^= 1;
switch (qtcode) {
case Qt::Key_CapsLock : result = lock ? CapsLockOn : CapsLockOff; break;
case Qt::Key_NumLock : result = lock ? NumLockOn : NumLockOff; break;
case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break;
default : break;
}
}
} else if ((it->flags & QEvdevKeyboardMap::IsSystem) && it->special && first_press) {
switch (it->special) {
case QEvdevKeyboardMap::SystemReboot:
result = Reboot;
break;
case QEvdevKeyboardMap::SystemZap:
if (!m_no_zap)
qApp->quit();
break;
case QEvdevKeyboardMap::SystemConsolePrevious:
result = PreviousConsole;
break;
case QEvdevKeyboardMap::SystemConsoleNext:
result = NextConsole;
break;
default:
if (it->special >= QEvdevKeyboardMap::SystemConsoleFirst &&
it->special <= QEvdevKeyboardMap::SystemConsoleLast) {
result = KeycodeAction(SwitchConsoleFirst + ((it->special & QEvdevKeyboardMap::SystemConsoleMask) & SwitchConsoleMask));
}
break;
}
skip = true; // no need to tell Qt about it
} else if ((qtcode == Qt::Key_Multi_key) && m_do_compose) {
// the Compose key was pressed
if (first_press)
m_composing = 2;
skip = true;
} else if ((it->flags & QEvdevKeyboardMap::IsDead) && m_do_compose) {
// a Dead key was pressed
//.........这里部分代码省略.........
示例8: qCDebug
QString AbstractExtItem::tag(const QString &_type) const
{
qCDebug(LOG_LIB) << "Tag type" << _type;
return QString("%1%2").arg(_type).arg(number());
}
示例9: qDebug
void AudioMixerClientData::processStreamPacket(ReceivedMessage& message, ConcurrentAddedStreams &addedStreams) {
if (!containsValidPosition(message)) {
qDebug() << "Refusing to process audio stream from" << message.getSourceID() << "with invalid position";
return;
}
SharedStreamPointer matchingStream;
auto packetType = message.getType();
bool newStream = false;
if (packetType == PacketType::MicrophoneAudioWithEcho
|| packetType == PacketType::MicrophoneAudioNoEcho
|| packetType == PacketType::SilentAudioFrame) {
auto micStreamIt = std::find_if(_audioStreams.begin(), _audioStreams.end(), [](const SharedStreamPointer& stream){
return stream->getStreamIdentifier().isNull();
});
if (micStreamIt == _audioStreams.end()) {
// we don't have a mic stream yet, so add it
// hop past the sequence number that leads the packet
message.seek(sizeof(StreamSequenceNumber));
// pull the codec string from the packet
auto codecString = message.readString();
// determine if the stream is stereo or not
bool isStereo;
if (packetType == PacketType::SilentAudioFrame || packetType == PacketType::ReplicatedSilentAudioFrame) {
SilentSamplesBytes numSilentSamples;
message.readPrimitive(&numSilentSamples);
isStereo = numSilentSamples == AudioConstants::NETWORK_FRAME_SAMPLES_STEREO;
} else {
ChannelFlag channelFlag;
message.readPrimitive(&channelFlag);
isStereo = channelFlag == 1;
}
auto avatarAudioStream = new AvatarAudioStream(isStereo, AudioMixer::getStaticJitterFrames());
avatarAudioStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
if (_isIgnoreRadiusEnabled) {
avatarAudioStream->enableIgnoreBox();
} else {
avatarAudioStream->disableIgnoreBox();
}
qCDebug(audio) << "creating new AvatarAudioStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;
connect(avatarAudioStream, &InboundAudioStream::mismatchedAudioCodec,
this, &AudioMixerClientData::handleMismatchAudioFormat);
matchingStream = SharedStreamPointer(avatarAudioStream);
_audioStreams.push_back(matchingStream);
newStream = true;
} else {
matchingStream = *micStreamIt;
}
} else if (packetType == PacketType::InjectAudio) {
// this is injected audio
// skip the sequence number and codec string and grab the stream identifier for this injected audio
message.seek(sizeof(StreamSequenceNumber));
message.readString();
QUuid streamIdentifier = QUuid::fromRfc4122(message.readWithoutCopy(NUM_BYTES_RFC4122_UUID));
auto streamIt = std::find_if(_audioStreams.begin(), _audioStreams.end(), [&streamIdentifier](const SharedStreamPointer& stream) {
return stream->getStreamIdentifier() == streamIdentifier;
});
if (streamIt == _audioStreams.end()) {
bool isStereo;
message.readPrimitive(&isStereo);
// we don't have this injected stream yet, so add it
auto injectorStream = new InjectedAudioStream(streamIdentifier, isStereo, AudioMixer::getStaticJitterFrames());
#if INJECTORS_SUPPORT_CODECS
injectorStream->setupCodec(_codec, _selectedCodecName, isStereo ? AudioConstants::STEREO : AudioConstants::MONO);
qCDebug(audio) << "creating new injectorStream... codec:" << _selectedCodecName << "isStereo:" << isStereo;
#endif
matchingStream = SharedStreamPointer(injectorStream);
_audioStreams.push_back(matchingStream);
newStream = true;
} else {
matchingStream = *streamIt;
}
}
// seek to the beginning of the packet so that the next reader is in the right spot
message.seek(0);
// check the overflow count before we parse data
//.........这里部分代码省略.........
示例10: d
// ----------------------- Generic IO -------------------------
KGameIO::KGameIO()
: d(new KGameIOPrivate)
{
QLoggingCategory::setFilterRules(QLatin1Literal("games.private.kgame.debug = true"));
qCDebug(GAMES_PRIVATE_KGAME) << ": this=" << this << ", sizeof(this)" << sizeof(KGameIO);
}
示例11: qCDebug
void StructViewDisplaySettingsWidget::setUnsignedDisplay(int index)
{
qCDebug(LOG_KASTEN_OKTETA_CONTROLLERS_STRUCTURES) << "byteOrder changed to " << index;
handleMapping(index, ui.combo_UnsignedDisplayBase, ui.kcfg_UnsignedDisplayBase);
}
示例12: Q_ASSERT
void CanvasRenderer::paintVectorFrame( QPainter& painter,
int layerId,
int nFrame,
bool colorize,
bool useLastKeyFrame )
{
Layer* layer = mObject->getLayer( layerId );
if ( !layer->visible() )
{
return;
}
LayerVector* vectorLayer = dynamic_cast< LayerVector* >( layer );
if ( vectorLayer == nullptr )
{
Q_ASSERT( vectorLayer );
return;
}
qCDebug( mLog ) << "Paint Onion skin vector, Frame = " << nFrame;
VectorImage* vectorImage;
if (useLastKeyFrame)
{
vectorImage = vectorLayer->getLastVectorImageAtFrame( nFrame, 0 );
}
else
{
vectorImage = vectorLayer->getVectorImageAtFrame( nFrame );
}
if ( vectorImage == nullptr )
{
return;
}
QImage* pImage = new QImage( mCanvas->size(), QImage::Format_ARGB32_Premultiplied );
vectorImage->outputImage( pImage, mViewTransform, mOptions.bOutlines, mOptions.bThinLines, mOptions.bAntiAlias );
//painter.drawImage( QPoint( 0, 0 ), *pImage );
// Go through a Bitmap image to paint the onion skin colour
//
BitmapImage* tempBitmapImage = new BitmapImage();
tempBitmapImage->setImage(pImage);
if ( colorize )
{
QBrush colorBrush = QBrush(Qt::transparent); //no color for the current frame
if (nFrame < mFrameNumber)
{
colorBrush = QBrush(Qt::red);
}
else if (nFrame > mFrameNumber)
{
colorBrush = QBrush(Qt::blue);
}
tempBitmapImage->drawRect( pImage->rect(),
Qt::NoPen,
colorBrush,
QPainter::CompositionMode_SourceIn,
false);
}
painter.setWorldMatrixEnabled( false ); //Don't tranform the image here as we used the viewTransform in the image output
tempBitmapImage->paintImage( painter );
delete tempBitmapImage;
}
示例13: init
//.........这里部分代码省略.........
QByteArray audioPacket = byteArrayWithPopulatedHeader(silentFrame
? PacketTypeSilentAudioFrame
: PacketTypeMicrophoneAudioNoEcho);
QDataStream packetStream(&audioPacket, QIODevice::Append);
// pack a placeholder value for sequence number for now, will be packed when destination node is known
int numPreSequenceNumberBytes = audioPacket.size();
packetStream << (quint16) 0;
if (silentFrame) {
if (!_isListeningToAudioStream) {
// if we have a silent frame and we're not listening then just send nothing and break out of here
break;
}
// write the number of silent samples so the audio-mixer can uphold timing
packetStream.writeRawData(reinterpret_cast<const char*>(&SCRIPT_AUDIO_BUFFER_SAMPLES), sizeof(int16_t));
// use the orientation and position of this avatar for the source of this audio
packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
glm::quat headOrientation = _avatarData->getHeadOrientation();
packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));
} else if (nextSoundOutput) {
// assume scripted avatar audio is mono and set channel flag to zero
packetStream << (quint8)0;
// use the orientation and position of this avatar for the source of this audio
packetStream.writeRawData(reinterpret_cast<const char*>(&_avatarData->getPosition()), sizeof(glm::vec3));
glm::quat headOrientation = _avatarData->getHeadOrientation();
packetStream.writeRawData(reinterpret_cast<const char*>(&headOrientation), sizeof(glm::quat));
// write the raw audio data
packetStream.writeRawData(reinterpret_cast<const char*>(nextSoundOutput), numAvailableSamples * sizeof(int16_t));
}
// write audio packet to AudioMixer nodes
auto nodeList = DependencyManager::get<NodeList>();
nodeList->eachNode([this, &nodeList, &audioPacket, &numPreSequenceNumberBytes](const SharedNodePointer& node){
// only send to nodes of type AudioMixer
if (node->getType() == NodeType::AudioMixer) {
// pack sequence number
quint16 sequence = _outgoingScriptAudioSequenceNumbers[node->getUUID()]++;
memcpy(audioPacket.data() + numPreSequenceNumberBytes, &sequence, sizeof(quint16));
// send audio packet
nodeList->writeDatagram(audioPacket, node);
}
});
}
}
qint64 now = usecTimestampNow();
float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
if (hasUncaughtException()) {
int line = uncaughtExceptionLineNumber();
qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + uncaughtException().toString());
clearExceptions();
}
if (!_isFinished) {
emit update(deltaTime);
}
lastUpdate = now;
}
stopAllTimers(); // make sure all our timers are stopped if the script is ending
emit scriptEnding();
// kill the avatar identity timer
delete _avatarIdentityTimer;
if (entityScriptingInterface->getEntityPacketSender()->serversExist()) {
// release the queue of edit entity messages.
entityScriptingInterface->getEntityPacketSender()->releaseQueuedMessages();
// since we're in non-threaded mode, call process so that the packets are sent
if (!entityScriptingInterface->getEntityPacketSender()->isThreaded()) {
entityScriptingInterface->getEntityPacketSender()->process();
}
}
// If we were on a thread, then wait till it's done
if (thread()) {
thread()->quit();
}
emit finished(_fileNameString);
_isRunning = false;
emit runningStateChanged();
emit doneRunning();
_doneRunningThisScript = true;
}
示例14: connect
QTreeView* OutputWidget::createListView(int id)
{
auto createHelper = [&]() -> QTreeView* {
KDevelop::FocusedTreeView* listview = new KDevelop::FocusedTreeView(this);
listview->setEditTriggers( QAbstractItemView::NoEditTriggers );
listview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); //Always enable the scrollbar, so it doesn't flash around
listview->setHeaderHidden(true);
listview->setUniformRowHeights(true);
listview->setRootIsDecorated(false);
listview->setSelectionMode( QAbstractItemView::ContiguousSelection );
if (data->outputdata.value(id)->behaviour & KDevelop::IOutputView::AutoScroll) {
listview->setAutoScrollAtEnd(true);
}
connect(listview, &QTreeView::activated, this, &OutputWidget::activate);
connect(listview, &QTreeView::clicked, this, &OutputWidget::activate);
return listview;
};
QTreeView* listview = 0;
if( !views.contains(id) )
{
bool newView = true;
if( data->type & KDevelop::IOutputView::MultipleView || data->type & KDevelop::IOutputView::HistoryView )
{
qCDebug(PLUGIN_STANDARDOUTPUTVIEW) << "creating listview";
listview = createHelper();
if( data->type & KDevelop::IOutputView::MultipleView )
{
tabwidget->addTab( listview, data->outputdata.value(id)->title );
} else
{
stackwidget->addWidget( listview );
stackwidget->setCurrentWidget( listview );
}
} else
{
if( views.isEmpty() )
{
listview = createHelper();
layout()->addWidget( listview );
} else
{
listview = views.begin().value();
newView = false;
}
}
views[id] = listview;
changeModel( id );
changeDelegate( id );
if (newView)
listview->scrollToBottom();
} else
{
listview = views.value(id);
}
enableActions();
return listview;
}
示例15: LensFunContainer
LensFunIface::MetadataMatch LensFunIface::findFromMetadata(const DMetadata& meta)
{
MetadataMatch ret = MetadataNoMatch;
d->settings = LensFunContainer();
d->usedCamera = 0;
d->usedLens = 0;
d->lensDescription.clear();
if (meta.isEmpty())
{
qCDebug(DIGIKAM_DIMG_LOG) << "No metadata available";
return LensFunIface::MetadataUnavailable;
}
PhotoInfoContainer photoInfo = meta.getPhotographInformation();
d->makeDescription = photoInfo.make.trimmed();
d->modelDescription = photoInfo.model.trimmed();
bool exactMatch = true;
if (d->makeDescription.isEmpty())
{
qCDebug(DIGIKAM_DIMG_LOG) << "No camera maker info available";
exactMatch = false;
}
else
{
// NOTE: see bug #184156:
// Some rules to wrap unknown camera device from Lensfun database, which have equivalent in fact.
if (d->makeDescription == QLatin1String("Canon"))
{
if (d->modelDescription == QLatin1String("Canon EOS Kiss Digital X"))
{
d->modelDescription = QLatin1String("Canon EOS 400D DIGITAL");
}
if (d->modelDescription == QLatin1String("G1 X"))
{
d->modelDescription = QLatin1String("G1X");
}
}
d->lensDescription = photoInfo.lens.trimmed();
// ------------------------------------------------------------------------------------------------
DevicePtr lfCamera = findCamera(d->makeDescription, d->modelDescription);
if (lfCamera)
{
setUsedCamera(lfCamera);
qCDebug(DIGIKAM_DIMG_LOG) << "Camera maker : " << d->settings.cameraMake;
qCDebug(DIGIKAM_DIMG_LOG) << "Camera model : " << d->settings.cameraModel;
// ------------------------------------------------------------------------------------------------
// -- Performing lens description searches.
if (!d->lensDescription.isEmpty())
{
LensList lensMatches;
QString lensCutted;
LensList lensList;
// STAGE 1, search in LensFun database as well.
lensList = findLenses(d->usedCamera, d->lensDescription);
qCDebug(DIGIKAM_DIMG_LOG) << "* Check for lens by direct query (" << d->lensDescription << " : " << lensList.count() << ")";
lensMatches.append(lensList);
// STAGE 2, Adapt exiv2 strings to lensfun strings for Nikon.
lensCutted = d->lensDescription;
if (lensCutted.contains(QLatin1String("Nikon")))
{
lensCutted.remove(QLatin1String("Nikon "));
lensCutted.remove(QLatin1String("Zoom-"));
lensCutted.replace(QLatin1String("IF-ID"), QLatin1String("ED-IF"));
lensList = findLenses(d->usedCamera, lensCutted);
qCDebug(DIGIKAM_DIMG_LOG) << "* Check for Nikon lens (" << lensCutted << " : " << lensList.count() << ")";
lensMatches.append(lensList);
}
// TODO : Add here more specific lens maker rules.
// LAST STAGE, Adapt exiv2 strings to lensfun strings. Some lens description use something like that :
// "10.0 - 20.0 mm". This must be adapted like this : "10-20mm"
lensCutted = d->lensDescription;
lensCutted.replace(QRegExp(QLatin1String("\\.[0-9]")), QLatin1String("")); //krazy:exclude=doublequote_chars
lensCutted.replace(QLatin1String(" - "), QLatin1String("-"));
lensCutted.replace(QLatin1String(" mm"), QLatin1String("mn"));
lensList = findLenses(d->usedCamera, lensCutted);
qCDebug(DIGIKAM_DIMG_LOG) << "* Check for no maker lens (" << lensCutted << " : " << lensList.count() << ")";
lensMatches.append(lensList);
// Remove all duplicate lenses in the list by using QSet.
lensMatches = lensMatches.toSet().toList();
// Display the results.
if (lensMatches.isEmpty())
{
//.........这里部分代码省略.........