Fix dialog button mismatch (#2908)
* Fix dialog button mismatch * Change order in menu * Make buttons the same role, so we have custom ordering * Hide the exit button, add a close button to the dialog, change ordering * Make the exit button not visible
This commit is contained in:
BIN
data/themes/default/discard.png
Normal file
BIN
data/themes/default/discard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 B |
BIN
data/themes/default/ignore.png
Normal file
BIN
data/themes/default/ignore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 506 B |
BIN
data/themes/default/recover.png
Executable file
BIN
data/themes/default/recover.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 303 B |
@@ -718,10 +718,6 @@ int main( int argc, char * * argv )
|
||||
" <td><b>%6</b></td>"
|
||||
" <td>%7</td>"
|
||||
" </tr>"
|
||||
" <tr>"
|
||||
" <td><b>%8</b></td>"
|
||||
" <td>%9</td>"
|
||||
" </tr>"
|
||||
"</table>"
|
||||
"</html>" ).arg(
|
||||
MainWindow::tr( "There is a recovery file present. "
|
||||
@@ -738,35 +734,49 @@ int main( int argc, char * * argv )
|
||||
"present recover file from being overwritten." ),
|
||||
MainWindow::tr( "Discard" ),
|
||||
MainWindow::tr( "Launch a default session and delete "
|
||||
"the restored files. This is not reversible." ),
|
||||
MainWindow::tr( "Quit" ),
|
||||
MainWindow::tr( "Shut down LMMS with no further action." )
|
||||
"the restored files. This is not reversible." )
|
||||
) );
|
||||
|
||||
mb.setIcon( QMessageBox::Warning );
|
||||
mb.setWindowIcon( embed::getIconPixmap( "icon" ) );
|
||||
mb.setWindowFlags( Qt::WindowCloseButtonHint );
|
||||
|
||||
mb.setStandardButtons( QMessageBox::Ok |
|
||||
QMessageBox::Discard );
|
||||
|
||||
mb.setButtonText( QMessageBox::Ok,
|
||||
MainWindow::tr( "Recover" ) );
|
||||
|
||||
QAbstractButton * recover;
|
||||
QAbstractButton * discard;
|
||||
QPushButton * recover;
|
||||
QPushButton * discard;
|
||||
QPushButton * ignore;
|
||||
QPushButton * exit;
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
// setting all buttons to the same roles allows us
|
||||
// to have a custom layout
|
||||
discard = mb.addButton( MainWindow::tr( "Discard" ),
|
||||
QMessageBox::AcceptRole );
|
||||
ignore = mb.addButton( MainWindow::tr( "Ignore" ),
|
||||
QMessageBox::AcceptRole );
|
||||
recover = mb.addButton( MainWindow::tr( "Recover" ),
|
||||
QMessageBox::AcceptRole );
|
||||
|
||||
recover = mb.QMessageBox::button( QMessageBox::Ok );
|
||||
discard = mb.QMessageBox::button( QMessageBox::Discard );
|
||||
ignore = mb.addButton( MainWindow::tr( "Ignore" ),
|
||||
QMessageBox::NoRole );
|
||||
ignore->setIcon( embed::getIconPixmap( "no_entry" ) );
|
||||
exit = mb.addButton( MainWindow::tr( "Exit" ),
|
||||
QMessageBox::RejectRole );
|
||||
exit->setIcon( embed::getIconPixmap( "exit" ) );
|
||||
# else
|
||||
// in qt4 the button order is reversed
|
||||
recover = mb.addButton( MainWindow::tr( "Recover" ),
|
||||
QMessageBox::AcceptRole );
|
||||
ignore = mb.addButton( MainWindow::tr( "Ignore" ),
|
||||
QMessageBox::AcceptRole );
|
||||
discard = mb.addButton( MainWindow::tr( "Discard" ),
|
||||
QMessageBox::AcceptRole );
|
||||
|
||||
mb.setDefaultButton( QMessageBox::Ok );
|
||||
#endif
|
||||
|
||||
// have a hidden exit button
|
||||
exit = mb.addButton( "", QMessageBox::RejectRole);
|
||||
exit->setVisible(false);
|
||||
|
||||
// set icons
|
||||
recover->setIcon( embed::getIconPixmap( "recover" ) );
|
||||
discard->setIcon( embed::getIconPixmap( "discard" ) );
|
||||
ignore->setIcon( embed::getIconPixmap( "ignore" ) );
|
||||
|
||||
mb.setDefaultButton( recover );
|
||||
mb.setEscapeButton( exit );
|
||||
|
||||
mb.exec();
|
||||
@@ -774,7 +784,7 @@ int main( int argc, char * * argv )
|
||||
{
|
||||
gui->mainWindow()->sessionCleanup();
|
||||
}
|
||||
else if( mb.clickedButton() == recover ) // ::Recover
|
||||
else if( mb.clickedButton() == recover ) // Recover
|
||||
{
|
||||
fileToLoad = recoveryFile;
|
||||
gui->mainWindow()->setSession( MainWindow::SessionState::Recover );
|
||||
|
||||
Reference in New Issue
Block a user