mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 21:34:07 +00:00
+ Possibility to skip the latest release when checking for new releases.
This commit is contained in:
parent
7118c23d93
commit
f065a1c592
|
@ -460,6 +460,8 @@ Class load() throw( exError )
|
||||||
c.timeForNewReleaseCheck = QDateTime::fromString( timeForNewReleaseCheck.toElement().text(),
|
c.timeForNewReleaseCheck = QDateTime::fromString( timeForNewReleaseCheck.toElement().text(),
|
||||||
Qt::ISODate );
|
Qt::ISODate );
|
||||||
|
|
||||||
|
c.skippedRelease = root.namedItem( "skippedRelease" ).toElement().text();
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,6 +815,10 @@ void save( Class const & c ) throw( exError )
|
||||||
opt = dd.createElement( "timeForNewReleaseCheck" );
|
opt = dd.createElement( "timeForNewReleaseCheck" );
|
||||||
opt.appendChild( dd.createTextNode( c.timeForNewReleaseCheck.toString( Qt::ISODate ) ) );
|
opt.appendChild( dd.createTextNode( c.timeForNewReleaseCheck.toString( Qt::ISODate ) ) );
|
||||||
root.appendChild( opt );
|
root.appendChild( opt );
|
||||||
|
|
||||||
|
opt = dd.createElement( "skippedRelease" );
|
||||||
|
opt.appendChild( dd.createTextNode( c.skippedRelease ) );
|
||||||
|
root.appendChild( opt );
|
||||||
}
|
}
|
||||||
|
|
||||||
configFile.write( dd.toByteArray() );
|
configFile.write( dd.toByteArray() );
|
||||||
|
|
|
@ -266,6 +266,7 @@ struct Class
|
||||||
|
|
||||||
QDateTime timeForNewReleaseCheck; // Only effective if
|
QDateTime timeForNewReleaseCheck; // Only effective if
|
||||||
// preferences.checkForNewReleases is set
|
// preferences.checkForNewReleases is set
|
||||||
|
QString skippedRelease; // Empty by default
|
||||||
|
|
||||||
Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 )
|
Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 )
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ void MainWindow::latestReleaseReplyReady()
|
||||||
latestVersion.toStdWString().c_str() );
|
latestVersion.toStdWString().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( success && latestVersion > PROGRAM_VERSION )
|
if ( success && latestVersion > PROGRAM_VERSION && latestVersion != cfg.skippedRelease )
|
||||||
{
|
{
|
||||||
QMessageBox msg( QMessageBox::Information,
|
QMessageBox msg( QMessageBox::Information,
|
||||||
tr( "New Release Available" ),
|
tr( "New Release Available" ),
|
||||||
|
@ -1213,12 +1213,19 @@ void MainWindow::latestReleaseReplyReady()
|
||||||
this );
|
this );
|
||||||
|
|
||||||
QPushButton * dload = msg.addButton( tr( "Download" ), QMessageBox::AcceptRole );
|
QPushButton * dload = msg.addButton( tr( "Download" ), QMessageBox::AcceptRole );
|
||||||
|
QPushButton * skip = msg.addButton( tr( "Skip This Release" ), QMessageBox::DestructiveRole );
|
||||||
msg.addButton( QMessageBox::Cancel );
|
msg.addButton( QMessageBox::Cancel );
|
||||||
|
|
||||||
msg.exec();
|
msg.exec();
|
||||||
|
|
||||||
if ( msg.clickedButton() == dload )
|
if ( msg.clickedButton() == dload )
|
||||||
QDesktopServices::openUrl( QUrl( downloadUrl ) );
|
QDesktopServices::openUrl( QUrl( downloadUrl ) );
|
||||||
|
else
|
||||||
|
if ( msg.clickedButton() == skip )
|
||||||
|
{
|
||||||
|
cfg.skippedRelease = latestVersion;
|
||||||
|
Config::save( cfg );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue