mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Replace printf in code by a macro DPRINTF
This commit is contained in:
parent
97a6d49221
commit
36e509a2ab
|
@ -11,6 +11,7 @@
|
|||
#include <QUrl>
|
||||
#include "folding.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
@ -308,7 +309,7 @@ void ArticleRequest::altSearchFinished()
|
|||
|
||||
if ( altSearches.empty() )
|
||||
{
|
||||
printf( "alts finished\n" );
|
||||
DPRINTF( "alts finished\n" );
|
||||
|
||||
// They all've finished! Now we can look up bodies
|
||||
|
||||
|
@ -318,7 +319,7 @@ void ArticleRequest::altSearchFinished()
|
|||
|
||||
for( unsigned x = 0; x < altsVector.size(); ++x )
|
||||
{
|
||||
printf( "Alt: %ls\n", altsVector[ x ].c_str() );
|
||||
DPRINTF( "Alt: %ls\n", altsVector[ x ].c_str() );
|
||||
}
|
||||
|
||||
wstring wordStd = gd::toWString( word );
|
||||
|
@ -344,7 +345,7 @@ void ArticleRequest::bodyFinished()
|
|||
if ( bodyDone )
|
||||
return;
|
||||
|
||||
printf( "some body finished\n" );
|
||||
DPRINTF( "some body finished\n" );
|
||||
|
||||
bool wasUpdated = false;
|
||||
|
||||
|
@ -355,7 +356,7 @@ void ArticleRequest::bodyFinished()
|
|||
{
|
||||
// Good
|
||||
|
||||
printf( "one finished.\n" );
|
||||
DPRINTF( "one finished.\n" );
|
||||
|
||||
Dictionary::DataRequest & req = *bodyRequests.front();
|
||||
|
||||
|
@ -431,13 +432,13 @@ void ArticleRequest::bodyFinished()
|
|||
|
||||
foundAnyDefinitions = true;
|
||||
}
|
||||
printf( "erasing..\n" );
|
||||
DPRINTF( "erasing..\n" );
|
||||
bodyRequests.pop_front();
|
||||
printf( "erase done..\n" );
|
||||
DPRINTF( "erase done..\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "one not finished.\n" );
|
||||
DPRINTF( "one not finished.\n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -575,7 +576,7 @@ void ArticleRequest::compoundSearchNextStep( bool lastSearchSucceeded )
|
|||
|
||||
if ( lastGoodCompoundResult.size() ) // We have something to append
|
||||
{
|
||||
// printf( "Appending\n" );
|
||||
// DPRINTF( "Appending\n" );
|
||||
|
||||
if ( !firstCompoundWasFound )
|
||||
{
|
||||
|
@ -670,7 +671,7 @@ void ArticleRequest::compoundSearchNextStep( bool lastSearchSucceeded )
|
|||
|
||||
// Look it up
|
||||
|
||||
// printf( "Looking up %s\n", qPrintable( currentSplittedWordCompound ) );
|
||||
// DPRINTF( "Looking up %s\n", qPrintable( currentSplittedWordCompound ) );
|
||||
|
||||
stemmedWordFinder->prefixMatch( currentSplittedWordCompound, activeDicts, 40, // Would one be enough? Leave 40 to be safe.
|
||||
Dictionary::SuitableForCompoundSearching );
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "article_netmgr.hh"
|
||||
#include "wstring_qt.hh"
|
||||
|
||||
#include "dprintf.hh"
|
||||
using std::string;
|
||||
|
||||
namespace
|
||||
|
@ -80,17 +80,17 @@ QNetworkReply * ArticleNetworkAccessManager::createRequest( Operation op,
|
|||
{
|
||||
QByteArray referer = req.rawHeader( "Referer" );
|
||||
|
||||
//printf( "Referer: %s\n", referer.data() );
|
||||
//DPRINTF( "Referer: %s\n", referer.data() );
|
||||
|
||||
QUrl refererUrl = QUrl::fromEncoded( referer );
|
||||
|
||||
//printf( "Considering %s vs %s\n", getHostBase( req.url() ).toUtf8().data(),
|
||||
//DPRINTF( "Considering %s vs %s\n", getHostBase( req.url() ).toUtf8().data(),
|
||||
// getHostBase( refererUrl ).toUtf8().data() );
|
||||
|
||||
if ( !req.url().host().endsWith( refererUrl.host() ) &&
|
||||
getHostBase( req.url() ) != getHostBase( refererUrl ) && !req.url().scheme().startsWith("data") )
|
||||
{
|
||||
printf( "Blocking element %s\n", req.url().toEncoded().data() );
|
||||
DPRINTF( "Blocking element %s\n", req.url().toEncoded().data() );
|
||||
|
||||
return new BlockedNetworkReply( this );
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ QNetworkReply * ArticleNetworkAccessManager::createRequest( Operation op,
|
|||
sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
|
||||
QUrl const & url, QString & contentType )
|
||||
{
|
||||
printf( "getResource: %ls\n", url.toString().toStdWString().c_str() );
|
||||
printf( "scheme: %ls\n", url.scheme().toStdWString().c_str() );
|
||||
printf( "host: %ls\n", url.host().toStdWString().c_str() );
|
||||
DPRINTF( "getResource: %ls\n", url.toString().toStdWString().c_str() );
|
||||
DPRINTF( "scheme: %ls\n", url.scheme().toStdWString().c_str() );
|
||||
DPRINTF( "host: %ls\n", url.host().toStdWString().c_str() );
|
||||
|
||||
if ( url.scheme() == "gdlookup" )
|
||||
{
|
||||
|
@ -149,8 +149,8 @@ sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
|
|||
if ( ( url.scheme() == "bres" || url.scheme() == "gdau" ) &&
|
||||
url.path().size() )
|
||||
{
|
||||
//printf( "Get %s\n", req.url().host().toLocal8Bit().data() );
|
||||
//printf( "Get %s\n", req.url().path().toLocal8Bit().data() );
|
||||
//DPRINTF( "Get %s\n", req.url().host().toLocal8Bit().data() );
|
||||
//DPRINTF( "Get %s\n", req.url().path().toLocal8Bit().data() );
|
||||
|
||||
string id = url.host().toStdString();
|
||||
|
||||
|
@ -222,7 +222,7 @@ ArticleResourceReply::ArticleResourceReply( QObject * parent,
|
|||
if ( req->isFinished() )
|
||||
{
|
||||
emit finishedSignal();
|
||||
printf( "In-place finish.\n" );
|
||||
DPRINTF( "In-place finish.\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ qint64 ArticleResourceReply::bytesAvailable() const
|
|||
|
||||
qint64 ArticleResourceReply::readData( char * out, qint64 maxSize )
|
||||
{
|
||||
printf( "====reading %d bytes\n", (int)maxSize );
|
||||
DPRINTF( "====reading %d bytes\n", (int)maxSize );
|
||||
|
||||
bool finished = req->isFinished();
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "wstring_qt.hh"
|
||||
#include "webmultimediadownload.hh"
|
||||
#include "programs.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <windows.h>
|
||||
|
@ -240,9 +241,9 @@ void ArticleView::loadFinished( bool )
|
|||
{
|
||||
if ( (*i)->frameName().startsWith( "gdexpandframe-" ) )
|
||||
{
|
||||
//printf( "Name: %s\n", (*i)->frameName().toUtf8().data() );
|
||||
//printf( "Size: %d\n", (*i)->contentsSize().height() );
|
||||
//printf( ">>>>>>>>Height = %s\n", (*i)->evaluateJavaScript( "document.body.offsetHeight;" ).toString().toUtf8().data() );
|
||||
//DPRINTF( "Name: %s\n", (*i)->frameName().toUtf8().data() );
|
||||
//DPRINTF( "Size: %d\n", (*i)->contentsSize().height() );
|
||||
//DPRINTF( ">>>>>>>>Height = %s\n", (*i)->evaluateJavaScript( "document.body.offsetHeight;" ).toString().toUtf8().data() );
|
||||
|
||||
// Set the height
|
||||
ui.definition->page()->mainFrame()->evaluateJavaScript( QString( "document.getElementById('%1').height = %2;" ).
|
||||
|
@ -589,7 +590,7 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref,
|
|||
QString const & scrollTo,
|
||||
Contexts const & contexts )
|
||||
{
|
||||
printf( "clicked %s\n", url.toString().toLocal8Bit().data() );
|
||||
DPRINTF( "clicked %s\n", url.toString().toLocal8Bit().data() );
|
||||
|
||||
if ( url.scheme().compare( "bword" ) == 0 )
|
||||
{
|
||||
|
@ -1042,10 +1043,10 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
}
|
||||
}
|
||||
#if 0
|
||||
printf( "%s\n", r.linkUrl().isEmpty() ? "null" : "not null" );
|
||||
DPRINTF( "%s\n", r.linkUrl().isEmpty() ? "null" : "not null" );
|
||||
|
||||
printf( "url = %s\n", r.linkUrl().toString().toLocal8Bit().data() );
|
||||
printf( "title = %s\n", r.title().toLocal8Bit().data() );
|
||||
DPRINTF( "url = %s\n", r.linkUrl().toString().toLocal8Bit().data() );
|
||||
DPRINTF( "title = %s\n", r.title().toLocal8Bit().data() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
11
bgl.cc
11
bgl.cc
|
@ -10,6 +10,7 @@
|
|||
#include "chunkedstorage.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "language.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
@ -873,7 +874,7 @@ void BglResourceRequest::run()
|
|||
compressedData.size() ) != Z_OK ||
|
||||
decompressedLength != data.size() )
|
||||
{
|
||||
printf( "Failed to decompress resource %s, ignoring it.\n",
|
||||
DPRINTF( "Failed to decompress resource %s, ignoring it.\n",
|
||||
name.c_str() );
|
||||
}
|
||||
else
|
||||
|
@ -907,13 +908,13 @@ sptr< Dictionary::DataRequest > BglDictionary::getResource( string const & name
|
|||
|
||||
for( int pos = 0; ( pos = charsetExp.indexIn( str, pos ) ) != -1; )
|
||||
{
|
||||
//printf( "Match: %s\n", str.mid( pos, charsetExp.matchedLength() ).toUtf8().data() );
|
||||
//DPRINTF( "Match: %s\n", str.mid( pos, charsetExp.matchedLength() ).toUtf8().data() );
|
||||
|
||||
QString out;
|
||||
|
||||
for( int p = 0; ( p = oneValueExp.indexIn( charsetExp.cap( 1 ), p ) ) != -1; )
|
||||
{
|
||||
//printf( "Cap: %s\n", oneValueExp.cap( 1 ).toUtf8().data() );
|
||||
//DPRINTF( "Cap: %s\n", oneValueExp.cap( 1 ).toUtf8().data() );
|
||||
out += "&#x" + oneValueExp.cap( 1 ) + ";";
|
||||
|
||||
p += oneValueExp.matchedLength();
|
||||
|
@ -946,7 +947,7 @@ sptr< Dictionary::DataRequest > BglDictionary::getResource( string const & name
|
|||
void ResourceHandler::handleBabylonResource( string const & filename,
|
||||
char const * data, size_t size )
|
||||
{
|
||||
//printf( "Handling resource file %s (%u bytes)\n", filename.c_str(), size );
|
||||
//DPRINTF( "Handling resource file %s (%u bytes)\n", filename.c_str(), size );
|
||||
|
||||
vector< unsigned char > compressedData( compressBound( size ) );
|
||||
|
||||
|
@ -1085,7 +1086,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
idxHeader.chunksOffset = chunks.finish();
|
||||
|
||||
printf( "Writing index...\n" );
|
||||
DPRINTF( "Writing index...\n" );
|
||||
|
||||
// Good. Now build the index
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include<stdio.h>
|
||||
#include<iconv.h>
|
||||
#include <QTextDocument>
|
||||
#include "dprintf.hh"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
|
@ -283,7 +284,7 @@ bool Babylon::read(std::string &source_charset, std::string &target_charset)
|
|||
convertToUtf8( m_email, TARGET_CHARSET );
|
||||
convertToUtf8( m_copyright, TARGET_CHARSET );
|
||||
convertToUtf8( m_description, TARGET_CHARSET );
|
||||
printf("Default charset: %s\nSource Charset: %s\nTargetCharset: %s\n", m_defaultCharset.c_str(), m_sourceCharset.c_str(), m_targetCharset.c_str());
|
||||
DPRINTF("Default charset: %s\nSource Charset: %s\nTargetCharset: %s\n", m_defaultCharset.c_str(), m_sourceCharset.c_str(), m_targetCharset.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -639,7 +640,7 @@ void Babylon::convertToUtf8( std::string &s, unsigned int type )
|
|||
iconv_t cd = iconv_open( "UTF-8", charset.c_str() );
|
||||
if( cd == (iconv_t)(-1) )
|
||||
{
|
||||
printf( "Error openning iconv library\n" );
|
||||
DPRINTF( "Error openning iconv library\n" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -660,8 +661,8 @@ void Babylon::convertToUtf8( std::string &s, unsigned int type )
|
|||
defbuf = outbuf;
|
||||
while (inbufbytes) {
|
||||
if (iconv(cd, &inbuf, &inbufbytes, &outbuf, &outbufbytes) == (size_t)-1) {
|
||||
printf( "\n%s\n", inbuf );
|
||||
printf( "Error in iconv conversion\n" );
|
||||
DPRINTF( "\n%s\n", inbuf );
|
||||
DPRINTF( "Error in iconv conversion\n" );
|
||||
inbuf++;
|
||||
inbufbytes--;
|
||||
}
|
||||
|
|
35
btreeidx.cc
35
btreeidx.cc
|
@ -10,6 +10,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "dprintf.hh"
|
||||
|
||||
//#define __BTREE_USE_LZO
|
||||
// LZO mode is experimental and unsupported. Tests didn't show any substantial
|
||||
|
@ -223,7 +224,7 @@ void BtreeWordSearchRequest::run()
|
|||
if ( isCancelled )
|
||||
break;
|
||||
|
||||
//printf( "offset = %u, size = %u\n", chainOffset - &leaf.front(), leaf.size() );
|
||||
//DPRINTF( "offset = %u, size = %u\n", chainOffset - &leaf.front(), leaf.size() );
|
||||
|
||||
vector< WordArticleLink > chain = dict.readChain( chainOffset );
|
||||
|
||||
|
@ -264,7 +265,7 @@ void BtreeWordSearchRequest::run()
|
|||
{
|
||||
// We're past the current leaf, fetch the next one
|
||||
|
||||
//printf( "advancing\n" );
|
||||
//DPRINTF( "advancing\n" );
|
||||
|
||||
if ( nextLeaf )
|
||||
{
|
||||
|
@ -280,7 +281,7 @@ void BtreeWordSearchRequest::run()
|
|||
|
||||
if ( leafEntries == 0xffffFFFF )
|
||||
{
|
||||
//printf( "bah!\n" );
|
||||
//DPRINTF( "bah!\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +325,7 @@ void BtreeIndex::readNode( uint32_t offset, vector< char > & out )
|
|||
uint32_t uncompressedSize = idxFile->read< uint32_t >();
|
||||
uint32_t compressedSize = idxFile->read< uint32_t >();
|
||||
|
||||
//printf( "%x,%x\n", uncompressedSize, compressedSize );
|
||||
//DPRINTF( "%x,%x\n", uncompressedSize, compressedSize );
|
||||
|
||||
out.resize( uncompressedSize );
|
||||
|
||||
|
@ -397,7 +398,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
{
|
||||
// A node
|
||||
|
||||
//printf( "=>a node\n" );
|
||||
//DPRINTF( "=>a node\n" );
|
||||
|
||||
uint32_t const * offsets = (uint32_t *)leaf + 1;
|
||||
|
||||
|
@ -437,7 +438,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
|
||||
wcharBuffer[ result ] = 0;
|
||||
|
||||
//printf( "Checking against %s\n", closestString );
|
||||
//DPRINTF( "Checking against %s\n", closestString );
|
||||
|
||||
compareResult = target.compare( &wcharBuffer.front() );
|
||||
|
||||
|
@ -468,7 +469,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
}
|
||||
|
||||
#if 0
|
||||
printf( "The winner is %s, compareResult = %d\n", closestString, compareResult );
|
||||
DPRINTF( "The winner is %s, compareResult = %d\n", closestString, compareResult );
|
||||
|
||||
if ( closestString != ptr )
|
||||
{
|
||||
|
@ -477,19 +478,19 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
while( left != ptr && left[ -1 ] )
|
||||
--left;
|
||||
|
||||
printf( "To the left: %s\n", left );
|
||||
DPRINTF( "To the left: %s\n", left );
|
||||
}
|
||||
else
|
||||
printf( "To the lest -- nothing\n" );
|
||||
DPRINTF( "To the lest -- nothing\n" );
|
||||
|
||||
char const * right = closestString + strlen( closestString ) + 1;
|
||||
|
||||
if ( right != leafEnd )
|
||||
{
|
||||
printf( "To the right: %s\n", right );
|
||||
DPRINTF( "To the right: %s\n", right );
|
||||
}
|
||||
else
|
||||
printf( "To the right -- nothing\n" );
|
||||
DPRINTF( "To the right -- nothing\n" );
|
||||
#endif
|
||||
|
||||
// Now, whatever the outcome (compareResult) is, we need to find
|
||||
|
@ -521,14 +522,14 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
currentNodeOffset = offsets[ entry + 1 ];
|
||||
}
|
||||
|
||||
//printf( "reading node at %x\n", currentNodeOffset );
|
||||
//DPRINTF( "reading node at %x\n", currentNodeOffset );
|
||||
readNode( currentNodeOffset, extLeaf );
|
||||
leaf = &extLeaf.front();
|
||||
leafEnd = leaf + extLeaf.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf( "=>a leaf\n" );
|
||||
//DPRINTF( "=>a leaf\n" );
|
||||
// A leaf
|
||||
|
||||
// If this leaf is the root, there's no next leaf, it just can't be.
|
||||
|
@ -561,7 +562,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
|
||||
memcpy( &chainSize, ptr, sizeof( uint32_t ) );
|
||||
|
||||
//printf( "%s + %s\n", ptr + sizeof( uint32_t ), ptr + sizeof( uint32_t ) + strlen( ptr + sizeof( uint32_t ) ) + 1 );
|
||||
//DPRINTF( "%s + %s\n", ptr + sizeof( uint32_t ), ptr + sizeof( uint32_t ) + strlen( ptr + sizeof( uint32_t ) ) + 1 );
|
||||
|
||||
ptr += sizeof( uint32_t ) + chainSize;
|
||||
}
|
||||
|
@ -575,7 +576,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
|
||||
for( ; ; )
|
||||
{
|
||||
//printf( "window = %u, ws = %u\n", window - &chainOffsets.front(), windowSize );
|
||||
//DPRINTF( "window = %u, ws = %u\n", window - &chainOffsets.front(), windowSize );
|
||||
|
||||
char const ** chainToCheck = window + windowSize/2;
|
||||
ptr = *chainToCheck;
|
||||
|
@ -588,7 +589,7 @@ char const * BtreeIndex::findChainOffsetExactOrPrefix( wstring const & target,
|
|||
if ( wcharBuffer.size() <= wordSize )
|
||||
wcharBuffer.resize( wordSize + 1 );
|
||||
|
||||
//printf( "checking agaist word %s, left = %u\n", ptr, leafEntries );
|
||||
//DPRINTF( "checking agaist word %s, left = %u\n", ptr, leafEntries );
|
||||
|
||||
long result = Utf8::decode( ptr, wordSize, &wcharBuffer.front() );
|
||||
|
||||
|
@ -995,7 +996,7 @@ IndexInfo buildIndex( IndexedWords const & indexedWords, File::Class & file )
|
|||
if ( btreeMaxElements > BtreeMaxElements )
|
||||
btreeMaxElements = BtreeMaxElements;
|
||||
|
||||
printf( "Building a tree of %u elements\n", btreeMaxElements );
|
||||
DPRINTF( "Building a tree of %u elements\n", btreeMaxElements );
|
||||
|
||||
|
||||
uint32_t lastLeafOffset = 0;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QtXml>
|
||||
#include "dprintf.hh"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stdint_msvc.h>
|
||||
|
@ -346,7 +347,7 @@ Class load() throw( exError )
|
|||
// Load the config as usual
|
||||
if ( !dd.setContent( &configFile, false, &errorStr, &errorLine, &errorColumn ) )
|
||||
{
|
||||
printf( "Error: %s at %d,%d\n", errorStr.toLocal8Bit().constData(), errorLine, errorColumn );
|
||||
DPRINTF( "Error: %s at %d,%d\n", errorStr.toLocal8Bit().constData(), errorLine, errorColumn );
|
||||
throw exMalformedConfigFile();
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +362,7 @@ Class load() throw( exError )
|
|||
|
||||
if ( !dd.setContent( &bufferedData, false, &errorStr, &errorLine, &errorColumn ) )
|
||||
{
|
||||
printf( "Error: %s at %d,%d\n", errorStr.toLocal8Bit().constData(), errorLine, errorColumn );
|
||||
DPRINTF( "Error: %s at %d,%d\n", errorStr.toLocal8Bit().constData(), errorLine, errorColumn );
|
||||
throw exMalformedConfigFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <list>
|
||||
#include <wctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "dprintf.hh"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stub_msvc.h>
|
||||
|
@ -388,7 +389,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
if ( !tab || ! ( tab = strchr( tab + 1, '\t' ) ) || strchr( tab + 1, '\t' ) )
|
||||
{
|
||||
printf( "Warning: incorrect amount of tabs in a line, skipping: %s\n", buf );
|
||||
DPRINTF( "Warning: incorrect amount of tabs in a line, skipping: %s\n", buf );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QApplication>
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
@ -118,7 +119,7 @@ void DictionaryBar::contextMenuEvent( QContextMenuEvent * event )
|
|||
|
||||
void DictionaryBar::mutedDictionariesChanged()
|
||||
{
|
||||
//printf( "Muted dictionaries changed\n" );
|
||||
//DPRINTF( "Muted dictionaries changed\n" );
|
||||
|
||||
// Update actions
|
||||
|
||||
|
|
10
dprintf.hh
Normal file
10
dprintf.hh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef __DPRINTF_HH_INCLUDED__
|
||||
#define __DPRINTF_HH_INCLUDED__
|
||||
|
||||
#ifdef NO_CONSOLE
|
||||
#define DPRINTF(...)
|
||||
#else
|
||||
#define DPRINTF(...) { printf(__VA_ARGS__); }
|
||||
#endif
|
||||
|
||||
#endif // __DPRINTF_HH_INCLUDED__
|
19
dsl.cc
19
dsl.cc
|
@ -17,6 +17,7 @@
|
|||
#include "wstring_qt.hh"
|
||||
#include "zipfile.hh"
|
||||
#include "indexedzip.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <map>
|
||||
|
@ -335,7 +336,7 @@ void DslDictionary::doDeferredInit()
|
|||
memcpy( &total, abrvBlock, sizeof( uint32_t ) );
|
||||
abrvBlock += sizeof( uint32_t );
|
||||
|
||||
printf( "Loading %u abbrv\n", total );
|
||||
DPRINTF( "Loading %u abbrv\n", total );
|
||||
|
||||
while( total-- )
|
||||
{
|
||||
|
@ -520,7 +521,7 @@ void DslDictionary::loadArticle( uint32_t address,
|
|||
memcpy( &articleSize, articleProps + sizeof( articleOffset ),
|
||||
sizeof( articleSize ) );
|
||||
|
||||
printf( "offset = %x\n", articleOffset );
|
||||
DPRINTF( "offset = %x\n", articleOffset );
|
||||
|
||||
|
||||
char * articleBody;
|
||||
|
@ -1182,7 +1183,7 @@ void DslResourceRequest::run()
|
|||
FsEncoding::separator() +
|
||||
FsEncoding::encode( resourceName );
|
||||
|
||||
printf( "n is %s\n", n.c_str() );
|
||||
DPRINTF( "n is %s\n", n.c_str() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1400,7 +1401,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
// Building the index
|
||||
initializing.indexingDictionary( Utf8::encode( scanner.getDictionaryName() ) );
|
||||
|
||||
printf( "Dictionary name: %ls\n", scanner.getDictionaryName().c_str() );
|
||||
DPRINTF( "Dictionary name: %ls\n", scanner.getDictionaryName().c_str() );
|
||||
|
||||
File::Class idx( indexFile, "wb" );
|
||||
|
||||
|
@ -1501,7 +1502,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
for( map< string, string >::const_iterator i = abrv.begin();
|
||||
i != abrv.end(); ++i )
|
||||
{
|
||||
// printf( "%s:%s\n", i->first.c_str(), i->second.c_str() );
|
||||
// DPRINTF( "%s:%s\n", i->first.c_str(), i->second.c_str() );
|
||||
|
||||
sz = i->first.size();
|
||||
chunks.addToBlock( &sz, sizeof( uint32_t ) );
|
||||
|
@ -1563,7 +1564,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
uint32_t articleOffset = curOffset;
|
||||
|
||||
//printf( "Headword: %ls\n", curString.c_str() );
|
||||
//DPRINTF( "Headword: %ls\n", curString.c_str() );
|
||||
|
||||
// More headwords may follow
|
||||
|
||||
|
@ -1578,7 +1579,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
if ( curString.empty() || isDslWs( curString[ 0 ] ) )
|
||||
break; // No more headwords
|
||||
|
||||
printf( "Alt headword: %ls\n", curString.c_str() );
|
||||
DPRINTF( "Alt headword: %ls\n", curString.c_str() );
|
||||
|
||||
processUnsortedParts( curString, true );
|
||||
expandTildes( curString, allEntryWords.front() );
|
||||
|
@ -1644,7 +1645,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
if ( zipFileName.size() )
|
||||
{
|
||||
printf( "Indexing zip file\n" );
|
||||
DPRINTF( "Indexing zip file\n" );
|
||||
|
||||
idxHeader.hasZipFile = 1;
|
||||
|
||||
|
@ -1666,7 +1667,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
{
|
||||
if ( entry.compressionMethod == ZipFile::Unsupported )
|
||||
{
|
||||
printf( "Warning: compression method unsupported -- skipping file %s\n",
|
||||
DPRINTF( "Warning: compression method unsupported -- skipping file %s\n",
|
||||
entry.fileName.data() );
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QDir>
|
||||
#include "externalviewer.hh"
|
||||
#include "parsecmdline.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::vector;
|
||||
|
||||
|
@ -23,7 +24,7 @@ ExternalViewer::ExternalViewer( QObject * parent, vector< char > const & data,
|
|||
|
||||
tempFile.close();
|
||||
|
||||
printf( "%s\n", tempFile.fileName().toLocal8Bit().data() );
|
||||
DPRINTF( "%s\n", tempFile.fileName().toLocal8Bit().data() );
|
||||
}
|
||||
|
||||
void ExternalViewer::start() throw( exCantRunViewer )
|
||||
|
|
11
forvo.cc
11
forvo.cc
|
@ -14,6 +14,7 @@
|
|||
#include "language.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "utf8.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
namespace Forvo {
|
||||
|
||||
|
@ -145,7 +146,7 @@ ForvoArticleRequest::ForvoArticleRequest( wstring const & str,
|
|||
void ForvoArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
||||
wstring const & str )
|
||||
{
|
||||
printf( "Requesting article %ls\n", str.c_str() );
|
||||
DPRINTF( "Requesting article %ls\n", str.c_str() );
|
||||
|
||||
QString key;
|
||||
|
||||
|
@ -164,7 +165,7 @@ void ForvoArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
QString::fromAscii( QUrl::toPercentEncoding( gd::toQString( str ) ) ) + "/language/" + languageCode
|
||||
).toUtf8() );
|
||||
|
||||
// printf( "req: %s\n", reqUrl.toEncoded().data() );
|
||||
// DPRINTF( "req: %s\n", reqUrl.toEncoded().data() );
|
||||
|
||||
sptr< QNetworkReply > netReply = mgr.get( QNetworkRequest( reqUrl ) );
|
||||
|
||||
|
@ -173,7 +174,7 @@ void ForvoArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
|
||||
void ForvoArticleRequest::requestFinished( QNetworkReply * r )
|
||||
{
|
||||
printf( "Finished.\n" );
|
||||
DPRINTF( "Finished.\n" );
|
||||
|
||||
if ( isFinished() ) // Was cancelled
|
||||
return;
|
||||
|
@ -218,7 +219,7 @@ void ForvoArticleRequest::requestFinished( QNetworkReply * r )
|
|||
}
|
||||
else
|
||||
{
|
||||
// printf( "%s\n", dd.toByteArray().data() );
|
||||
// DPRINTF( "%s\n", dd.toByteArray().data() );
|
||||
|
||||
QDomNode items = dd.namedItem( "items" );
|
||||
|
||||
|
@ -342,7 +343,7 @@ void ForvoArticleRequest::requestFinished( QNetworkReply * r )
|
|||
setErrorString( text );
|
||||
}
|
||||
}
|
||||
printf( "done.\n" );
|
||||
DPRINTF( "done.\n" );
|
||||
}
|
||||
else
|
||||
setErrorString( netReply->errorString() );
|
||||
|
|
|
@ -48,6 +48,8 @@ win32 {
|
|||
|
||||
# Enable console in Debug mode on Windows, with useful logging messages
|
||||
Debug:CONFIG += console
|
||||
|
||||
Release:DEFINES += NO_CONSOLE
|
||||
}
|
||||
|
||||
unix {
|
||||
|
@ -162,7 +164,8 @@ HEADERS += folding.hh \
|
|||
about.hh \
|
||||
programs.hh \
|
||||
parsecmdline.hh \
|
||||
dictspanewidget.hh
|
||||
dictspanewidget.hh \
|
||||
dprintf.hh
|
||||
FORMS += groups.ui \
|
||||
dictgroupwidget.ui \
|
||||
mainwindow.ui \
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#endif
|
||||
|
||||
#include "hotkeywrapper.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <X11/Xlibint.h>
|
||||
|
@ -384,7 +385,7 @@ void HotkeyWrapper::run() // Runs in a separate thread
|
|||
if ( !XRecordEnableContext( dataDisplay, recordContext,
|
||||
recordEventCallback,
|
||||
(XPointer) this ) )
|
||||
printf( "Failed to enable record context\n" );
|
||||
DPRINTF( "Failed to enable record context\n" );
|
||||
}
|
||||
|
||||
|
||||
|
|
11
hunspell.cc
11
hunspell.cc
|
@ -17,6 +17,7 @@
|
|||
#include <QCoreApplication>
|
||||
#include <set>
|
||||
#include <hunspell/hunspell.hxx>
|
||||
#include "dprintf.hh"
|
||||
|
||||
namespace HunspellMorpho {
|
||||
|
||||
|
@ -254,7 +255,7 @@ void HunspellArticleRequest::run()
|
|||
}
|
||||
catch( Iconv::Ex & e )
|
||||
{
|
||||
printf( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
DPRINTF( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
}
|
||||
|
||||
if ( suggestions )
|
||||
|
@ -460,7 +461,7 @@ QVector< wstring > HunspellHeadwordsRequest::suggest( wstring & word )
|
|||
{
|
||||
QString suggestion = gd::toQString( decodeFromHunspell( hunspell, suggestions[ x ] ) );
|
||||
|
||||
printf( ">>>Sugg: %s\n", suggestion.toLocal8Bit().data() );
|
||||
DPRINTF( ">>>Sugg: %s\n", suggestion.toLocal8Bit().data() );
|
||||
|
||||
if ( cutStem.indexIn( suggestion ) != -1 )
|
||||
{
|
||||
|
@ -468,7 +469,7 @@ QVector< wstring > HunspellHeadwordsRequest::suggest( wstring & word )
|
|||
|
||||
if ( Folding::applySimpleCaseOnly( alt ) != lowercasedWord ) // No point in providing same word
|
||||
{
|
||||
printf( ">>>>>Alt: %ls\n", alt.c_str() );
|
||||
DPRINTF( ">>>>>Alt: %ls\n", alt.c_str() );
|
||||
result.append( alt );
|
||||
}
|
||||
}
|
||||
|
@ -477,7 +478,7 @@ QVector< wstring > HunspellHeadwordsRequest::suggest( wstring & word )
|
|||
}
|
||||
catch( Iconv::Ex & e )
|
||||
{
|
||||
printf( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
DPRINTF( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
}
|
||||
|
||||
if ( suggestions )
|
||||
|
@ -599,7 +600,7 @@ void HunspellPrefixMatchRequest::run()
|
|||
}
|
||||
catch( Iconv::Ex & e )
|
||||
{
|
||||
printf( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
DPRINTF( "Hunspell: charset convertion error, no processing's done: %s\n", e.what() );
|
||||
}
|
||||
|
||||
finish();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "indexedzip.hh"
|
||||
#include "zipfile.hh"
|
||||
#include <zlib.h>
|
||||
#include "dprintf.hh"
|
||||
|
||||
using namespace BtreeIndexing;
|
||||
using std::vector;
|
||||
|
@ -46,7 +47,7 @@ bool IndexedZip::loadFile( gd::wstring const & name, vector< char > & data )
|
|||
|
||||
if ( !ZipFile::readLocalHeader( zip, header ) )
|
||||
{
|
||||
printf( "Failed to load header\n" );
|
||||
DPRINTF( "Failed to load header\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -55,13 +56,13 @@ bool IndexedZip::loadFile( gd::wstring const & name, vector< char > & data )
|
|||
switch( header.compressionMethod )
|
||||
{
|
||||
case ZipFile::Uncompressed:
|
||||
printf( "Uncompressed\n" );
|
||||
DPRINTF( "Uncompressed\n" );
|
||||
data.resize( header.uncompressedSize );
|
||||
return zip.read( &data.front(), data.size() ) == data.size();
|
||||
|
||||
case ZipFile::Deflated:
|
||||
{
|
||||
printf( "Deflated\n" );
|
||||
DPRINTF( "Deflated\n" );
|
||||
|
||||
// Now do the deflation
|
||||
|
||||
|
@ -89,7 +90,7 @@ bool IndexedZip::loadFile( gd::wstring const & name, vector< char > & data )
|
|||
|
||||
if ( inflate( &stream, Z_FINISH ) != Z_STREAM_END )
|
||||
{
|
||||
printf( "Not zstream end!" );
|
||||
DPRINTF( "Not zstream end!" );
|
||||
|
||||
data.clear();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "website.hh"
|
||||
#include "forvo.hh"
|
||||
#include "programs.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
@ -239,7 +240,7 @@ void loadDictionaries( QWidget * parent, bool showInitially,
|
|||
dictionaries.insert( dictionaries.end(), dicts.begin(), dicts.end() );
|
||||
}
|
||||
|
||||
printf( "Load done\n" );
|
||||
DPRINTF( "Load done\n" );
|
||||
|
||||
// Remove any stale index files
|
||||
|
||||
|
|
5
lsa.cc
5
lsa.cc
|
@ -9,6 +9,7 @@
|
|||
#include "btreeidx.hh"
|
||||
#include "fsencoding.hh"
|
||||
#include "audiolink.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -541,7 +542,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
/// XXX handle big-endian machines here!
|
||||
uint32_t entriesCount = f.read< uint32_t >();
|
||||
|
||||
printf( "%s: %u entries\n", i->c_str(), entriesCount );
|
||||
DPRINTF( "%s: %u entries\n", i->c_str(), entriesCount );
|
||||
|
||||
idxHeader.soundsCount = entriesCount;
|
||||
|
||||
|
@ -557,7 +558,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
// Remove the extension, no need for that in the index
|
||||
e.name = stripExtension( e.name );
|
||||
|
||||
printf( "Read filename %s (%u at %u)<\n", e.name.c_str(), e.samplesLength, e.samplesOffset );
|
||||
DPRINTF( "Read filename %s (%u at %u)<\n", e.name.c_str(), e.samplesLength, e.samplesOffset );
|
||||
|
||||
// Insert new entry into an index
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QDesktopServices>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::set;
|
||||
using std::wstring;
|
||||
|
@ -951,7 +952,7 @@ void MainWindow::switchToPrevTab()
|
|||
|
||||
void MainWindow::backClicked()
|
||||
{
|
||||
printf( "Back\n" );
|
||||
DPRINTF( "Back\n" );
|
||||
|
||||
ArticleView & view =
|
||||
dynamic_cast< ArticleView & >( *( ui.tabWidget->currentWidget() ) );
|
||||
|
@ -961,7 +962,7 @@ void MainWindow::backClicked()
|
|||
|
||||
void MainWindow::forwardClicked()
|
||||
{
|
||||
printf( "Forward\n" );
|
||||
DPRINTF( "Forward\n" );
|
||||
|
||||
ArticleView & view =
|
||||
dynamic_cast< ArticleView & >( *( ui.tabWidget->currentWidget() ) );
|
||||
|
@ -1652,7 +1653,7 @@ void MainWindow::showTranslationFor( QString const & inWord,
|
|||
|
||||
for( unsigned x = 0; x < alts.size(); ++x )
|
||||
{
|
||||
printf( "Alt: %ls\n", alts[ x ].c_str() );
|
||||
DPRINTF( "Alt: %ls\n", alts[ x ].c_str() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1677,7 +1678,7 @@ void MainWindow::showTranslationFor( QString const & inWord,
|
|||
{
|
||||
string body = activeDicts[ x ]->getArticle( word, alts );
|
||||
|
||||
printf( "From %s: %s\n", activeDicts[ x ]->getName().c_str(), body.c_str() );
|
||||
DPRINTF( "From %s: %s\n", activeDicts[ x ]->getName().c_str(), body.c_str() );
|
||||
|
||||
result += "<div class=\"gddictname\">From " + activeDicts[ x ]->getName() + "</div>" + body;
|
||||
}
|
||||
|
@ -1864,7 +1865,7 @@ void MainWindow::latestReleaseReplyReady()
|
|||
// Failed -- reschedule to check in two hours
|
||||
newReleaseCheckTimer.start( 2 * 60 * 60 * 1000 );
|
||||
|
||||
printf( "Failed to check program version, retry in two hours\n" );
|
||||
DPRINTF( "Failed to check program version, retry in two hours\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1875,7 +1876,7 @@ void MainWindow::latestReleaseReplyReady()
|
|||
|
||||
Config::save( cfg );
|
||||
|
||||
printf( "Program version's check successful, current version is %ls\n",
|
||||
DPRINTF( "Program version's check successful, current version is %ls\n",
|
||||
latestVersion.toStdWString().c_str() );
|
||||
}
|
||||
|
||||
|
|
17
mediawiki.cc
17
mediawiki.cc
|
@ -8,6 +8,7 @@
|
|||
#include <QUrl>
|
||||
#include <QtXml>
|
||||
#include <list>
|
||||
#include "dprintf.hh"
|
||||
|
||||
namespace MediaWiki {
|
||||
|
||||
|
@ -87,7 +88,7 @@ MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
|
|||
QNetworkAccessManager & mgr ):
|
||||
livedLongEnough( false ), isCancelling( false )
|
||||
{
|
||||
printf( "request begin\n" );
|
||||
DPRINTF( "request begin\n" );
|
||||
QUrl reqUrl( url + "/api.php?action=query&list=allpages&aplimit=40&format=xml" );
|
||||
|
||||
reqUrl.addQueryItem( "apfrom", gd::toQString( str ) );
|
||||
|
@ -113,7 +114,7 @@ void MediaWikiWordSearchRequest::timerEvent( QTimerEvent * ev )
|
|||
|
||||
MediaWikiWordSearchRequest::~MediaWikiWordSearchRequest()
|
||||
{
|
||||
printf( "request end\n" );
|
||||
DPRINTF( "request end\n" );
|
||||
}
|
||||
|
||||
void MediaWikiWordSearchRequest::cancel()
|
||||
|
@ -129,7 +130,7 @@ void MediaWikiWordSearchRequest::cancel()
|
|||
finish();
|
||||
}
|
||||
else
|
||||
printf("not long enough\n" );
|
||||
DPRINTF("not long enough\n" );
|
||||
}
|
||||
|
||||
void MediaWikiWordSearchRequest::downloadFinished()
|
||||
|
@ -163,7 +164,7 @@ void MediaWikiWordSearchRequest::downloadFinished()
|
|||
matches.push_back( gd::toWString( nl.item( x ).toElement().attribute( "title" ) ) );
|
||||
}
|
||||
}
|
||||
printf( "done.\n" );
|
||||
DPRINTF( "done.\n" );
|
||||
}
|
||||
else
|
||||
setErrorString( netReply->errorString() );
|
||||
|
@ -215,7 +216,7 @@ MediaWikiArticleRequest::MediaWikiArticleRequest( wstring const & str,
|
|||
void MediaWikiArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
||||
wstring const & str )
|
||||
{
|
||||
printf( "Requesting article %ls\n", str.c_str() );
|
||||
DPRINTF( "Requesting article %ls\n", str.c_str() );
|
||||
|
||||
QUrl reqUrl( url + "/api.php?action=parse&prop=text|revid&format=xml&redirects" );
|
||||
|
||||
|
@ -228,7 +229,7 @@ void MediaWikiArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
|
||||
void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
|
||||
{
|
||||
printf( "Finished.\n" );
|
||||
DPRINTF( "Finished.\n" );
|
||||
|
||||
if ( isFinished() ) // Was cancelled
|
||||
return;
|
||||
|
@ -304,7 +305,7 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
|
|||
|
||||
QByteArray articleBody = articleString.toUtf8();
|
||||
|
||||
printf( "Article body after: %s\n", articleBody.data() );
|
||||
DPRINTF( "Article body after: %s\n", articleBody.data() );
|
||||
|
||||
articleBody.prepend( "<div class=\"mwiki\">" );
|
||||
articleBody.append( "</div>" );
|
||||
|
@ -323,7 +324,7 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
|
|||
}
|
||||
}
|
||||
}
|
||||
printf( "done.\n" );
|
||||
DPRINTF( "done.\n" );
|
||||
}
|
||||
else
|
||||
setErrorString( netReply->errorString() );
|
||||
|
|
11
scanpopup.cc
11
scanpopup.cc
|
@ -12,6 +12,7 @@
|
|||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QDesktopWidget>
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::wstring;
|
||||
|
||||
|
@ -206,7 +207,7 @@ void ScanPopup::editGroupRequested()
|
|||
|
||||
void ScanPopup::translateWordFromClipboard(QClipboard::Mode m)
|
||||
{
|
||||
printf( "translating from clipboard or selection\n" );
|
||||
DPRINTF( "translating from clipboard or selection\n" );
|
||||
|
||||
QString subtype = "plain";
|
||||
|
||||
|
@ -235,7 +236,7 @@ void ScanPopup::clipboardChanged( QClipboard::Mode m )
|
|||
if ( !isScanningEnabled )
|
||||
return;
|
||||
|
||||
printf( "clipboard changed\n" );
|
||||
DPRINTF( "clipboard changed\n" );
|
||||
|
||||
QString subtype = "plain";
|
||||
|
||||
|
@ -435,7 +436,7 @@ bool ScanPopup::eventFilter( QObject * watched, QEvent * event )
|
|||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
// printf( "Object: %s\n", watched->objectName().toUtf8().data() );
|
||||
// DPRINTF( "Object: %s\n", watched->objectName().toUtf8().data() );
|
||||
QMouseEvent * mouseEvent = ( QMouseEvent * ) event;
|
||||
reactOnMouseMove( mouseEvent->globalPos() );
|
||||
}
|
||||
|
@ -448,7 +449,7 @@ void ScanPopup::reactOnMouseMove( QPoint const & p )
|
|||
{
|
||||
if ( geometry().contains( p ) )
|
||||
{
|
||||
// printf( "got inside\n" );
|
||||
// DPRINTF( "got inside\n" );
|
||||
|
||||
hideTimer.stop();
|
||||
mouseEnteredOnce = true;
|
||||
|
@ -456,7 +457,7 @@ void ScanPopup::reactOnMouseMove( QPoint const & p )
|
|||
}
|
||||
else
|
||||
{
|
||||
// printf( "outside\n" );
|
||||
// DPRINTF( "outside\n" );
|
||||
// We're in grab mode and outside the window - calculate the
|
||||
// distance from it. We might want to hide it.
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QStandardItemModel>
|
||||
#include "dprintf.hh"
|
||||
|
||||
Sources::Sources( QWidget * parent, Config::Paths const & paths,
|
||||
Config::SoundDirs const & soundDirs,
|
||||
|
@ -430,8 +431,8 @@ bool MediaWikisModel::setData( QModelIndex const & index, const QVariant & value
|
|||
|
||||
if ( role == Qt::CheckStateRole && !index.column() )
|
||||
{
|
||||
//printf( "type = %d\n", (int)value.type() );
|
||||
//printf( "value = %d\n", (int)value.toInt() );
|
||||
//DPRINTF( "type = %d\n", (int)value.type() );
|
||||
//DPRINTF( "value = %d\n", (int)value.toInt() );
|
||||
|
||||
// XXX it seems to be always passing Int( 2 ) as a value, so we just toggle
|
||||
mediawikis[ index.row() ].enabled = !mediawikis[ index.row() ].enabled;
|
||||
|
@ -579,8 +580,8 @@ bool WebSitesModel::setData( QModelIndex const & index, const QVariant & value,
|
|||
|
||||
if ( role == Qt::CheckStateRole && !index.column() )
|
||||
{
|
||||
//printf( "type = %d\n", (int)value.type() );
|
||||
//printf( "value = %d\n", (int)value.toInt() );
|
||||
//DPRINTF( "type = %d\n", (int)value.type() );
|
||||
//DPRINTF( "value = %d\n", (int)value.toInt() );
|
||||
|
||||
// XXX it seems to be always passing Int( 2 ) as a value, so we just toggle
|
||||
webSites[ index.row() ].enabled = !webSites[ index.row() ].enabled;
|
||||
|
|
15
stardict.cc
15
stardict.cc
|
@ -10,6 +10,7 @@
|
|||
#include "xdxf2html.hh"
|
||||
#include "htmlescape.hh"
|
||||
#include "langcoder.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <zlib.h>
|
||||
#include <map>
|
||||
|
@ -773,8 +774,8 @@ Ifo::Ifo( File::Class & f ):
|
|||
|
||||
static string const booknameEq( "bookname=" );
|
||||
|
||||
//printf( "%s<\n", f.gets().c_str() );
|
||||
//printf( "%s<\n", f.gets().c_str() );
|
||||
//DPRINTF( "%s<\n", f.gets().c_str() );
|
||||
//DPRINTF( "%s<\n", f.gets().c_str() );
|
||||
|
||||
if ( f.gets() != "StarDict's dict ifo file" ||
|
||||
f.gets().compare( 0, versionEq.size(), versionEq ) )
|
||||
|
@ -1001,7 +1002,7 @@ static void handleIdxSynFile( string const & fileName,
|
|||
indexedWords.addWord( Utf8::decode( word ), offset );
|
||||
}
|
||||
|
||||
printf( "%u entires made\n", indexedWords.size() );
|
||||
DPRINTF( "%u entires made\n", indexedWords.size() );
|
||||
}
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||
|
@ -1056,7 +1057,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
{
|
||||
if ( ifo.synwordcount )
|
||||
{
|
||||
printf( "Warning: dictionary has synwordcount specified, but no "
|
||||
DPRINTF( "Warning: dictionary has synwordcount specified, but no "
|
||||
"corresponding .syn file was found\n" );
|
||||
ifo.synwordcount = 0; // Pretend it wasn't there
|
||||
}
|
||||
|
@ -1064,13 +1065,13 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
else
|
||||
if ( !ifo.synwordcount )
|
||||
{
|
||||
printf( "Warning: ignoring .syn file %s, since there's no synwordcount in .ifo specified\n",
|
||||
DPRINTF( "Warning: ignoring .syn file %s, since there's no synwordcount in .ifo specified\n",
|
||||
synFileName.c_str() );
|
||||
}
|
||||
|
||||
|
||||
printf( "bookname = %s\n", ifo.bookname.c_str() );
|
||||
printf( "wordcount = %u\n", ifo.wordcount );
|
||||
DPRINTF( "bookname = %s\n", ifo.bookname.c_str() );
|
||||
DPRINTF( "wordcount = %u\n", ifo.wordcount );
|
||||
|
||||
initializing.indexingDictionary( ifo.bookname );
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "transliteration.hh"
|
||||
#include "utf8.hh"
|
||||
#include "folding.hh"
|
||||
#include "dprintf.hh"
|
||||
|
||||
namespace Transliteration {
|
||||
|
||||
|
@ -118,7 +119,7 @@ sptr< Dictionary::WordSearchRequest > TransliterationDictionary::findHeadwordsFo
|
|||
|
||||
vector< wstring > alts = getAlternateWritings( str );
|
||||
|
||||
printf( "alts = %u\n", alts.size() );
|
||||
DPRINTF( "alts = %u\n", alts.size() );
|
||||
|
||||
for( unsigned x = 0; x < alts.size(); ++x )
|
||||
result->getMatches().push_back( alts[ x ] );
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "wstring_qt.hh"
|
||||
#include <QThreadPool>
|
||||
#include <map>
|
||||
#include "dprintf.hh"
|
||||
|
||||
using std::vector;
|
||||
using std::list;
|
||||
|
@ -433,7 +434,7 @@ void WordFinder::updateResults()
|
|||
for( ResultsArray::const_iterator i = resultsArray.begin(), j = resultsArray.end();
|
||||
i != j; ++i )
|
||||
{
|
||||
//printf( "%d: %ls\n", i->second, i->first.c_str() );
|
||||
//DPRINTF( "%d: %ls\n", i->second, i->first.c_str() );
|
||||
|
||||
if ( searchResults.size() < maxSearchResults )
|
||||
searchResults.push_back( std::pair< QString, bool >( gd::toQString( i->word ), i->wasSuggested ) );
|
||||
|
|
11
xdxf.cc
11
xdxf.cc
|
@ -17,6 +17,7 @@
|
|||
#include <zlib.h>
|
||||
#include <wctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "dprintf.hh"
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QXmlStreamReader>
|
||||
|
@ -567,7 +568,7 @@ void indexArticle( GzippedFile & gzFile,
|
|||
if ( words.empty() )
|
||||
{
|
||||
// Nothing to index, this article didn't have any tags
|
||||
printf( "Warning: no <k> tags found in an article at offset 0x%x, article skipped.\n",
|
||||
DPRINTF( "Warning: no <k> tags found in an article at offset 0x%x, article skipped.\n",
|
||||
(unsigned) articleOffset );
|
||||
}
|
||||
else
|
||||
|
@ -584,7 +585,7 @@ void indexArticle( GzippedFile & gzFile,
|
|||
value = gzFile.pos() - 1 - articleOffset;
|
||||
chunks.addToBlock( &value, sizeof( value ) );
|
||||
|
||||
printf( "%x: %s\n", articleOffset, words.begin()->toUtf8().data() );
|
||||
DPRINTF( "%x: %s\n", articleOffset, words.begin()->toUtf8().data() );
|
||||
|
||||
// Add words to index
|
||||
|
||||
|
@ -729,7 +730,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
chunks.addToBlock( n.data(), n.size() );
|
||||
}
|
||||
else
|
||||
printf( "Warning: duplicate full_name in %s\n", dictFiles[ 0 ].c_str() );
|
||||
DPRINTF( "Warning: duplicate full_name in %s\n", dictFiles[ 0 ].c_str() );
|
||||
}
|
||||
else
|
||||
if ( stream.name() == "description" )
|
||||
|
@ -748,7 +749,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
chunks.addToBlock( n.data(), n.size() );
|
||||
}
|
||||
else
|
||||
printf( "Warning: duplicate description in %s\n", dictFiles[ 0 ].c_str() );
|
||||
DPRINTF( "Warning: duplicate description in %s\n", dictFiles[ 0 ].c_str() );
|
||||
}
|
||||
else
|
||||
if ( stream.name() == "ar" )
|
||||
|
@ -790,7 +791,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
|
||||
if ( stream.hasError() )
|
||||
{
|
||||
printf( "Warning: %s had a parse error %ls, and therefore was indexed only up to the point of error.\n",
|
||||
DPRINTF( "Warning: %s had a parse error %ls, and therefore was indexed only up to the point of error.\n",
|
||||
dictFiles[ 0 ].c_str(), stream.errorString().toStdWString().c_str() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
|
||||
#include "xdxf2html.hh"
|
||||
#include <QtXml>
|
||||
#include "dprintf.hh"
|
||||
|
||||
namespace Xdxf2Html {
|
||||
|
||||
string convert( string const & in )
|
||||
{
|
||||
printf( "Source>>>>>>>>>>: %s\n\n\n", in.c_str() );
|
||||
DPRINTF( "Source>>>>>>>>>>: %s\n\n\n", in.c_str() );
|
||||
|
||||
// Convert spaces after each end of line to s, and then each end of
|
||||
// line to a <br>
|
||||
|
|
Loading…
Reference in a new issue