Skip to content

Commit

Permalink
fix merge conflict with feature/deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Feb 3, 2022
2 parents c118e5a + 3b4c105 commit 0c94406
Show file tree
Hide file tree
Showing 31 changed files with 75 additions and 71 deletions.
3 changes: 1 addition & 2 deletions aard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
quint16 volumes = qFromBigEndian( dictHeader.totalVolumes );
if( volumes > 1 )
{
QString ss;
ss.sprintf( " (%i/%i)", qFromBigEndian( dictHeader.volume ), volumes );
QString ss=QString( " (%1/%2)").arg( qFromBigEndian( dictHeader.volume ), volumes );
dictName += ss.toLocal8Bit().data();
}

Expand Down
16 changes: 8 additions & 8 deletions article_netmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using std::string;

connect( baseReply, SIGNAL( metaDataChanged() ), this, SLOT( applyMetaData() ) );

connect( baseReply, SIGNAL( error( QNetworkReply::NetworkError) ),
connect( baseReply, SIGNAL( errorOccurred( QNetworkReply::NetworkError) ),
this, SLOT( applyError( QNetworkReply::NetworkError ) ) );

connect( baseReply, SIGNAL( readyRead() ), this, SLOT( readDataFromBase() ) );
Expand Down Expand Up @@ -113,8 +113,8 @@ using std::string;
baseReply->attribute( QNetworkRequest::HttpPipeliningWasUsedAttribute ) );
setAttribute( QNetworkRequest::BackgroundRequestAttribute,
baseReply->attribute( QNetworkRequest::BackgroundRequestAttribute ) );
setAttribute( QNetworkRequest::SpdyWasUsedAttribute,
baseReply->attribute( QNetworkRequest::SpdyWasUsedAttribute ) );
setAttribute( QNetworkRequest::Http2WasUsedAttribute,
baseReply->attribute( QNetworkRequest::Http2WasUsedAttribute ) );

emit metaDataChanged();
}
Expand All @@ -133,7 +133,7 @@ using std::string;
void AllowFrameReply::applyError( QNetworkReply::NetworkError code )
{
setError( code, baseReply->errorString() );
emit error( code );
emit errorOccurred( code );
}

void AllowFrameReply::readDataFromBase()
Expand Down Expand Up @@ -283,7 +283,7 @@ QNetworkReply * ArticleNetworkAccessManager::createRequest( Operation op,
QNetworkRequest newReq(req);
if ( hideGoldenDictHeader && req.url().scheme().startsWith("http", Qt::CaseInsensitive))
{
newReq.setRawHeader("User-Agent", req.rawHeader("User-Agent").replace(qApp->applicationName(), ""));
newReq.setRawHeader("User-Agent", req.rawHeader("User-Agent").replace(qApp->applicationName().toUtf8(), ""));
}

QNetworkReply * reply = QNetworkAccessManager::createRequest( op, newReq, outgoingData );
Expand Down Expand Up @@ -336,8 +336,8 @@ sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(

// See if we have some dictionaries muted

QSet< QString > mutedDicts =
QSet< QString >::fromList( Utils::Url::queryItemValue( url, "muted" ).split( ',' ) );
QStringList mutedDictLists=Utils::Url::queryItemValue( url, "muted" ).split( ',' );
QSet< QString > mutedDicts ( mutedDictLists.begin(),mutedDictLists.end());

// Unpack contexts

Expand Down Expand Up @@ -525,7 +525,7 @@ void ArticleResourceReply::readyReadSlot()
void ArticleResourceReply::finishedSlot()
{
if (req->dataSize() < 0) {
emit error(ContentNotFoundError);
emit errorOccurred(ContentNotFoundError);
setError(ContentNotFoundError, "content not found");
}

Expand Down
6 changes: 4 additions & 2 deletions articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,17 @@ bool ArticleView::eventFilter( QObject * obj, QEvent * ev )
int delta = result == Gestures::SWIPE_UP ? -120 : 120;
QWidget *widget = static_cast< QWidget * >( obj );

QPoint angleDelta(0, delta);
QPoint pixelDetal;
QWidget *child = widget->childAt( widget->mapFromGlobal( pt ) );
if( child )
{
QWheelEvent whev( child->mapFromGlobal( pt ), pt, delta, Qt::NoButton, Qt::NoModifier );
QWheelEvent whev( child->mapFromGlobal( pt ), pt, pixelDetal,angleDelta, Qt::NoButton, Qt::NoModifier,Qt::NoScrollPhase,false);
qApp->sendEvent( child, &whev );
}
else
{
QWheelEvent whev( widget->mapFromGlobal( pt ), pt, delta, Qt::NoButton, Qt::NoModifier );
QWheelEvent whev( widget->mapFromGlobal( pt ), pt,pixelDetal, angleDelta,Qt::NoButton, Qt::NoModifier,Qt::NoScrollPhase,false );
qApp->sendEvent( widget, &whev );
}
}
Expand Down
6 changes: 3 additions & 3 deletions articlewebview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ bool ArticleWebView::eventFilter(QObject *obj, QEvent *ev) {

void ArticleWebView::mousePressEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::MidButton)
if (event->buttons() & Qt::MiddleButton)
midButtonPressed = true;
}

Expand Down Expand Up @@ -127,7 +127,7 @@ void ArticleWebView::sendCustomMouseEvent( QEvent::Type type) {
}

void ArticleWebView::mouseReleaseEvent(QMouseEvent *event) {
bool noMidButton = !( event->buttons() & Qt::MidButton );
bool noMidButton = !( event->buttons() & Qt::MiddleButton );

if ( midButtonPressed & noMidButton )
midButtonPressed = false;
Expand Down Expand Up @@ -169,7 +169,7 @@ void ArticleWebView::wheelEvent( QWheelEvent *ev )
SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nLines, 0 );
if( nLines == WHEEL_PAGESCROLL )
{
QKeyEvent kev( QEvent::KeyPress, ev->delta() > 0 ? Qt::Key_PageUp : Qt::Key_PageDown,
QKeyEvent kev( QEvent::KeyPress, ev->angleDelta ().y () > 0 ? Qt::Key_PageUp : Qt::Key_PageDown,
Qt::NoModifier );
auto childrens = this->children();
for (auto child : childrens) {
Expand Down
9 changes: 5 additions & 4 deletions btreeidx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1437,16 +1437,17 @@ void BtreeIndex::getHeadwordsFromOffsets( QList<uint32_t> & offsets,

for( unsigned i = 0; i < result.size(); i++ )
{
QList< uint32_t >::Iterator it = qBinaryFind( begOffsets, endOffsets,
result.at( i ).articleOffset );
uint32_t articleOffset = result.at(i).articleOffset;
QList<uint32_t>::Iterator it = std::lower_bound( begOffsets, endOffsets,
articleOffset );

if( it != offsets.end() )
if( it!=offsets.end())
{
if( isCancelled && Utils::AtomicInt::loadAcquire( *isCancelled ) )
return;

headwords.append( QString::fromUtf8( ( result[ i ].prefix + result[ i ].word ).c_str() ) );
offsets.erase( it );
offsets.erase( it);
begOffsets = offsets.begin();
endOffsets = offsets.end();
}
Expand Down
6 changes: 3 additions & 3 deletions dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ bool needToRebuildIndex( vector< string > const & dictionaryFiles,
ZipFile::SplitZipFile zf( name );
if( !zf.exists() )
return true;
ts = zf.lastModified().toTime_t();
ts = zf.lastModified().toSecsSinceEpoch();
}
else
{
if ( !fileInfo.exists() )
return true;
ts = fileInfo.lastModified().toTime_t();
ts = fileInfo.lastModified().toSecsSinceEpoch();
}

if ( ts > lastModified )
Expand All @@ -505,7 +505,7 @@ bool needToRebuildIndex( vector< string > const & dictionaryFiles,
if ( !fileInfo.exists() )
return true;

return fileInfo.lastModified().toTime_t() < lastModified;
return fileInfo.lastModified().toSecsSinceEpoch() < lastModified;
}

QString generateRandomDictionaryId()
Expand Down
2 changes: 1 addition & 1 deletion dictionarybar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void DictionaryBar::showContextMenu( QContextMenuEvent * event, bool extended )
{
QString command( editDictionaryCommand );
command.replace( "%GDDICT%", "\"" + dictFilename + "\"" );
if( !QProcess::startDetached( command ) )
if( !QProcess::startDetached( command ,QStringList()) )
QApplication::beep();
}

Expand Down
4 changes: 1 addition & 3 deletions epwing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -957,9 +957,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< sptr< Dictionary::Class > > dictionaries;

vector< string > dictFiles;
QByteArray catName;
catName += QDir::separator();
catName += "catalogs";
QByteArray catName = QString("%1catalogs").arg(QDir::separator()).toUtf8();

for( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end();
++i )
Expand Down
5 changes: 2 additions & 3 deletions epwing_book.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,7 @@ QByteArray EpwingBook::handleReference( EB_Hook_Code code, const unsigned int *
if( refOpenCount > refCloseCount )
return QByteArray();

QString str;
str.sprintf( "<R%i>", refOpenCount );
QString str=QString( "<R%1>").arg( refOpenCount );
refOpenCount += 1;
return str.toUtf8();
}
Expand All @@ -1747,7 +1746,7 @@ QByteArray EpwingBook::handleReference( EB_Hook_Code code, const unsigned int *
refOffsets.append( argv[ 2 ] );

QString str;
str.sprintf( "</R%i>", refCloseCount );
str.asprintf( "</R%i>", refCloseCount );
refCloseCount += 1;

return str.toUtf8();
Expand Down
10 changes: 4 additions & 6 deletions extlineedit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,12 @@ void ExtLineEdit::updateButtonPositions()
iconPos = (iconPos == Left ? Right : Left);

if (iconPos == ExtLineEdit::Right) {
int right;
getTextMargins(0, 0, &right, 0);
const int iconoffset = right + 4;
QMargins qm=textMargins();
const int iconoffset = qm.right() + 4;
iconButtons[i]->setGeometry(contentRect.adjusted(width() - iconoffset, 0, 0, 0));
} else {
int left;
getTextMargins(&left, 0, 0, 0);
const int iconoffset = left + 4;
QMargins qm=textMargins();
const int iconoffset = qm.left() + 4;
iconButtons[i]->setGeometry(contentRect.adjusted(0, 0, -width() + iconoffset, 0));
}
}
Expand Down
4 changes: 3 additions & 1 deletion favoritespanewidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,9 @@ void FavoritesModel::removeItemsForIndexes( const QModelIndexList & idxList )
for( int i = lowestLevel; i >= 0; i-- )
{
QModelIndexList idxSublist = itemsToDelete[ i ];
std::sort( idxSublist.begin(), idxSublist.end(), qGreater< QModelIndex >() );
//std::greater does not work ,operator < not implemented ,use std:less first ,then std::reverse.
std::sort(idxSublist.begin(), idxSublist.end(), std::less<QModelIndex>());
std::reverse(idxSublist.begin(), idxSublist.end());

it = idxSublist.begin();
for( ; it != idxSublist.end(); ++it )
Expand Down
6 changes: 3 additions & 3 deletions fulltextsearch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "initializing.hh"
#include <qt_windows.h>
#include <uxtheme.h>
#include <QOperatingSystemVersion>

#endif

Expand Down Expand Up @@ -248,8 +249,7 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,

oldBarStyle = 0;

if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA
&& ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based )
if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7
&& !IsThemeActive() )
{
QStyle * barStyle = WindowsStyle::instance().getStyle();
Expand Down Expand Up @@ -649,7 +649,7 @@ Q_UNUSED( parent );

for( int x = 0; x < hws.length(); x++ )
{
QList< FtsHeadword >::iterator it = qBinaryFind( headwords.begin(), headwords.end(), hws.at( x ) );
QList< FtsHeadword >::iterator it = std::lower_bound( headwords.begin(), headwords.end(), hws.at( x ) );
if( it != headwords.end() )
{
it->dictIDs.push_back( hws.at( x ).dictIDs.front() );
Expand Down
4 changes: 2 additions & 2 deletions gddebug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ QTextCodec *localeCodec = 0;
QTextCodec::setCodecForLocale( utf8Codec );
}

qWarning( "%s", QString().vsprintf( msg, ap ).toUtf8().data() );
qWarning( "%s", QString().vasprintf( msg, ap ).toUtf8().data() );

if( logFilePtr && logFilePtr->isOpen() )
{
Expand All @@ -48,7 +48,7 @@ QTextCodec *localeCodec = 0;
QTextCodec::setCodecForLocale( utf8Codec );
}

qDebug( "%s", QString().vsprintf( msg, ap ).toUtf8().data() );
qDebug( "%s", QString().vasprintf( msg, ap ).toUtf8().data() );

if( logFilePtr && logFilePtr->isOpen() )
{
Expand Down
2 changes: 2 additions & 0 deletions goldendict.pro
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ QT += widgets \
printsupport \
help

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00

# QMediaPlayer is not available in Qt4.
!CONFIG( no_qtmultimedia_player ) {
QT += multimedia
Expand Down
4 changes: 2 additions & 2 deletions groups_widgets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,8 @@ void DictGroupsWidget::addAutoGroups()
dictMap[ name ] = vd;
}

QStringList groupList = dictMap.uniqueKeys();
QStringList morphoList = morphoMap.uniqueKeys();
QStringList groupList = dictMap.keys();
QStringList morphoList = morphoMap.keys();

// Insert morphology dictionaries into corresponding lists

Expand Down
9 changes: 6 additions & 3 deletions helpwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "helpwindow.hh"
#include "gddebug.hh"
#include <QHelpLink>

namespace Help {

Expand All @@ -25,9 +26,11 @@ void HelpBrowser::showHelpForKeyword( QString const & id )
{
if ( helpEngine )
{
QMap< QString, QUrl > links = helpEngine->linksForIdentifier( id );
if( !links.isEmpty() )
setSource( links.constBegin().value() );
QList<QHelpLink> links = helpEngine->documentsForIdentifier(id);
if (!links.isEmpty()) {
QHelpLink link=links.constFirst();
setSource(link.url);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion hotkeyedit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void HotKeyEdit::keyPressEvent( QKeyEvent * event )
// Delete current combo
currentKey1 = 0;
currentKey2 = 0;
currentModifiers = 0;
currentModifiers = Qt::NoModifier;
continuingCombo = false;
}
else
Expand Down
4 changes: 2 additions & 2 deletions initializing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#if defined( Q_OS_WIN32 )
#include <qt_windows.h>
#include <uxtheme.h>
#include <QOperatingSystemVersion>

WindowsStyle::WindowsStyle()
{
Expand Down Expand Up @@ -41,8 +42,7 @@ Initializing::Initializing( QWidget * parent, bool showOnStartup ): QDialog( par

oldBarStyle = 0;

if( QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA
&& ( QSysInfo::windowsVersion() & QSysInfo::WV_NT_based )
if( QOperatingSystemVersion::current () >= QOperatingSystemVersion::Windows7
&& !IsThemeActive() )
{
QStyle * barStyle = WindowsStyle::instance().getStyle();
Expand Down
4 changes: 2 additions & 2 deletions mainstatusbar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MainStatusBar::MainStatusBar( QWidget *parent ) : QWidget( parent )

bool MainStatusBar::hasImage() const
{
return !picWidget->pixmap()->isNull();
return !picWidget->pixmap().isNull();
}

void MainStatusBar::clearMessage()
Expand Down Expand Up @@ -92,7 +92,7 @@ void MainStatusBar::refresh()
{
adjustSize();

if ( !picWidget->pixmap()->isNull() )
if ( !picWidget->pixmap().isNull() )
{
picWidget->setFixedSize( textWidget->height(), textWidget->height() );
}
Expand Down
2 changes: 1 addition & 1 deletion maintabwidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ bool MainTabWidget::eventFilter( QObject * obj, QEvent * ev )
if( obj == tabBar() && ev->type() == QEvent::MouseButtonPress )
{
QMouseEvent * mev = static_cast< QMouseEvent *>( ev );
if( mev->button() == Qt::MidButton )
if( mev->button() == Qt::MiddleButton )
{
emit tabCloseRequested( tabBar()->tabAt( mev->pos() ) );
return true;
Expand Down
Loading

0 comments on commit 0c94406

Please sign in to comment.