]> git.sesse.net Git - vlc/commitdiff
Qt4 - Update Preferences buttons to please any OS/DE.
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 5 Apr 2007 21:45:51 +0000 (21:45 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 5 Apr 2007 21:45:51 +0000 (21:45 +0000)
modules/gui/qt4/dialogs/preferences.cpp
modules/gui/qt4/dialogs/preferences.hpp
modules/gui/qt4/util/qvlcframe.hpp

index 1b9a9968bde02ad53a03498b6203da9cfbc02be0..13a0f076ba4c000402734ea4a32e62a9a1f99a38 100644 (file)
@@ -38,7 +38,7 @@
 #include <QCheckBox>
 #include <QScrollArea>
 #include <QMessageBox>
-
+#include <QDialogButtonBox>
 
 PrefsDialog *PrefsDialog::instance = NULL;
 
@@ -85,14 +85,17 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 
      setSmall();
 
-     QPushButton *save, *cancel, *reset;
-     QHBoxLayout *buttonsLayout = QVLCFrame::doButtons( this, NULL,
-                                      &save, _("Save"),
-                                      &cancel, _("Cancel"),
-                                      &reset, _( "Reset Preferences" ) );
-     main_layout->addLayout( buttonsLayout, 4, 0, 1 ,3 );
-     setLayout( main_layout );
+     QDialogButtonBox *buttonsBox = new QDialogButtonBox();
+     QPushButton *save = new QPushButton( qtr( "&Save" ) );
+     QPushButton *cancel = new QPushButton( qtr( "&Cancel" ) );
+     QPushButton *reset = new QPushButton( qtr( "&Reset Preferences" ) );
 
+     buttonsBox->addButton( save, QDialogButtonBox::AcceptRole );
+     buttonsBox->addButton( cancel, QDialogButtonBox::RejectRole );
+     buttonsBox->addButton( reset, QDialogButtonBox::ActionRole );
+
+     main_layout->addWidget( buttonsBox, 4, 0, 1 ,3 );
+     setLayout( main_layout );
 
      BUTTONACT( save, save() );
      BUTTONACT( cancel, cancel() );
index e43256dfcb73324398d1f7cc932e31d7160331a6..dd3cc22581e0688a68c88f20f825e192f4bf8836 100644 (file)
@@ -75,8 +75,6 @@ private:
 
     QGridLayout *main_layout;
 
-//    QLabel *panel_label;
-
     static PrefsDialog *instance;
 private slots:
      void changePanel( QTreeWidgetItem * );
@@ -86,6 +84,7 @@ private slots:
      void save();
      void cancel();
      void reset();
+     void close(){ save(); };
 };
 
 #endif
index de2cc6ea92f1fe2c8489740677a76962aeb279c8..1bf5ee844502621f6b399976cecc9a64693b2f6c 100644 (file)
@@ -110,12 +110,20 @@ protected:
     {
         hide();
     }
+    void close()
+    {
+        hide();
+    }
     void keyPressEvent( QKeyEvent *keyEvent )
     {
         if( keyEvent->key() == Qt::Key_Escape )
         {
             cancel();
         }
+        else if( keyEvent->key() == Qt::Key_Enter )
+        {
+            close();
+        }
     }
 };