[vlmc-devel] commit: Adding a button to disable the confirmation query in the dialog box . ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Tue Apr 20 02:26:49 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Apr 20 02:23:59 2010 +0200| [0499f9dcf2dc423c1c097d683013a7674b853b89] | committer: Hugo Beauzée-Luyssen 

Adding a button to disable the confirmation query in the dialog box.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=0499f9dcf2dc423c1c097d683013a7674b853b89
---

 src/Gui/timeline/TracksScene.cpp |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/Gui/timeline/TracksScene.cpp b/src/Gui/timeline/TracksScene.cpp
index 183434a..9d38f6c 100644
--- a/src/Gui/timeline/TracksScene.cpp
+++ b/src/Gui/timeline/TracksScene.cpp
@@ -32,6 +32,7 @@
 #include <QMessageBox>
 #include <QKeyEvent>
 #include <QGraphicsSceneContextMenuEvent>
+#include <QPushButton>
 
 TracksScene::TracksScene( QObject* parent ) : QGraphicsScene( parent )
 {
@@ -78,14 +79,22 @@ TracksScene::askRemoveSelectedItems()
         else
             message = tr("Confirm the deletion of those regions?");
 
-        QMessageBox::StandardButton b =
-        QMessageBox::warning( tv, "Object deletion",
-                              message,
-                              QMessageBox::Yes | QMessageBox::No,
-                              QMessageBox::No );
-
-        // Skip the deletion process
-        if ( b == QMessageBox::No ) return;
+        QMessageBox msgBox;
+        msgBox.setText( message );
+        msgBox.addButton( tr( "Yes" ), QMessageBox::YesRole );
+        QAbstractButton     *always = msgBox.addButton( tr( "Yes, don't ask me again" ),
+                                                        QMessageBox::YesRole );
+        QAbstractButton     *no = msgBox.addButton( tr( "No" ), QMessageBox::NoRole );
+        msgBox.exec();
+        QAbstractButton*    clicked = msgBox.clickedButton();
+
+        if ( clicked == no )
+            return ;
+        if ( clicked == always )
+        {
+            SettingsManager::getInstance()->setImmediateValue( "general/ConfirmDeletion",
+                                                                   false, SettingsManager::Vlmc );
+        }
     }
 
     UndoStack::getInstance()->beginMacro( "Remove clip(s)" );



More information about the Vlmc-devel mailing list