-rw-r--r-- | core/settings/button/buttonsettings.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index 779f6ef..a90b4a1 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp | |||
@@ -22,23 +22,25 @@ | |||
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "buttonsettings.h" | ||
29 | #include "buttonutils.h" | ||
30 | #include "remapdlg.h" | ||
31 | |||
28 | #include <opie2/odevice.h> | 32 | #include <opie2/odevice.h> |
29 | 33 | ||
30 | #include <qpe/applnk.h> | 34 | #include <qpe/applnk.h> |
31 | 35 | ||
32 | #include <qlayout.h> | 36 | #include <qlayout.h> |
33 | #include <qlabel.h> | 37 | #include <qlabel.h> |
34 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qscrollview.h> | ||
35 | 40 | ||
36 | #include "buttonsettings.h" | ||
37 | #include "buttonutils.h" | ||
38 | #include "remapdlg.h" | ||
39 | 41 | ||
40 | using namespace Opie::Core; | 42 | using namespace Opie::Core; |
41 | 43 | ||
42 | struct buttoninfo { | 44 | struct buttoninfo { |
43 | const ODeviceButton *m_button; | 45 | const ODeviceButton *m_button; |
44 | int m_index; | 46 | int m_index; |
@@ -62,14 +64,22 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *, bool, WFlags | |||
62 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); | 64 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); |
63 | (void) ButtonUtils::inst ( ); // initialise | 65 | (void) ButtonUtils::inst ( ); // initialise |
64 | 66 | ||
65 | setCaption ( tr( "Button Settings" )); | 67 | setCaption ( tr( "Button Settings" )); |
66 | 68 | ||
67 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); | 69 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); |
70 | QScrollView*mainview = new QScrollView(this); | ||
71 | mainview->setResizePolicy( QScrollView::AutoOneFit ); | ||
72 | |||
73 | toplay->addWidget(mainview); | ||
74 | QFrame*framehold=new QFrame(mainview->viewport()); | ||
75 | framehold->setFrameStyle(QFrame::NoFrame|QFrame::Plain); | ||
76 | mainview->addChild(framehold); | ||
77 | toplay = new QVBoxLayout (framehold, 3, 3 ); | ||
68 | 78 | ||
69 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); | 79 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), framehold ); |
70 | toplay-> addWidget ( l ); | 80 | toplay-> addWidget ( l ); |
71 | 81 | ||
72 | QGridLayout *lay = new QGridLayout ( toplay ); | 82 | QGridLayout *lay = new QGridLayout ( toplay ); |
73 | lay-> setMargin ( 0 ); | 83 | lay-> setMargin ( 0 ); |
74 | lay-> setColStretch ( 0, 0 ); | 84 | lay-> setColStretch ( 0, 0 ); |
75 | lay-> setColStretch ( 1, 0 ); | 85 | lay-> setColStretch ( 1, 0 ); |
@@ -79,13 +89,13 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *, bool, WFlags | |||
79 | m_infos. setAutoDelete ( true ); | 89 | m_infos. setAutoDelete ( true ); |
80 | 90 | ||
81 | int i = 1; | 91 | int i = 1; |
82 | int index = 0; | 92 | int index = 0; |
83 | for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) { | 93 | for ( QValueList<ODeviceButton>::ConstIterator it = buttons. begin ( ); it != buttons. end ( ); it++ ) { |
84 | if ( it != buttons. begin ( )) { | 94 | if ( it != buttons. begin ( )) { |
85 | QFrame *f = new QFrame ( this ); | 95 | QFrame *f = new QFrame ( framehold ); |
86 | f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine ); | 96 | f-> setFrameStyle ( QFrame::Sunken | QFrame::VLine ); |
87 | lay-> addMultiCellWidget ( f, i, i, 0, 3 ); | 97 | lay-> addMultiCellWidget ( f, i, i, 0, 3 ); |
88 | i++; | 98 | i++; |
89 | } | 99 | } |
90 | 100 | ||
91 | buttoninfo *bi = new buttoninfo ( ); | 101 | buttoninfo *bi = new buttoninfo ( ); |
@@ -93,38 +103,38 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *, bool, WFlags | |||
93 | bi-> m_index = index++; | 103 | bi-> m_index = index++; |
94 | bi-> m_pmsg = (*it). pressedAction ( ); | 104 | bi-> m_pmsg = (*it). pressedAction ( ); |
95 | bi-> m_hmsg = (*it). heldAction ( ); | 105 | bi-> m_hmsg = (*it). heldAction ( ); |
96 | bi-> m_pdirty = false; | 106 | bi-> m_pdirty = false; |
97 | bi-> m_hdirty = false; | 107 | bi-> m_hdirty = false; |
98 | 108 | ||
99 | l = new QLabel ( this ); | 109 | l = new QLabel ( framehold ); |
100 | l-> setPixmap (( *it ). pixmap ( )); | 110 | l-> setPixmap (( *it ). pixmap ( )); |
101 | 111 | ||
102 | lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); | 112 | lay-> addMultiCellWidget ( l, i, i + 1, 0, 0 ); |
103 | 113 | ||
104 | l = new QLabel ( tr( "Press:" ), this ); | 114 | l = new QLabel ( tr( "Press:" ), framehold ); |
105 | lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); | 115 | lay-> addWidget ( l, i, 1, AlignLeft | AlignBottom ); |
106 | l = new QLabel ( tr( "Hold:" ), this ); | 116 | l = new QLabel ( tr( "Hold:" ), framehold ); |
107 | lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); | 117 | lay-> addWidget ( l, i + 1, 1, AlignLeft | AlignTop ); |
108 | 118 | ||
109 | l = new QLabel ( this ); | 119 | l = new QLabel ( framehold ); |
110 | l-> setFixedSize ( 16, 16 ); | 120 | l-> setFixedSize ( 16, 16 ); |
111 | lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); | 121 | lay-> addWidget ( l, i, 2, AlignLeft | AlignBottom ); |
112 | bi-> m_picon = l; | 122 | bi-> m_picon = l; |
113 | 123 | ||
114 | l = new QLabel ( this ); | 124 | l = new QLabel ( framehold ); |
115 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); | 125 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); |
116 | lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); | 126 | lay-> addWidget ( l, i, 3, AlignLeft | AlignBottom ); |
117 | bi-> m_plabel = l; | 127 | bi-> m_plabel = l; |
118 | 128 | ||
119 | l = new QLabel ( this ); | 129 | l = new QLabel ( framehold ); |
120 | l-> setFixedSize ( 16, 16 ); | 130 | l-> setFixedSize ( 16, 16 ); |
121 | lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); | 131 | lay-> addWidget ( l, i + 1, 2, AlignLeft | AlignTop ); |
122 | bi-> m_hicon = l; | 132 | bi-> m_hicon = l; |
123 | 133 | ||
124 | l = new QLabel ( this ); | 134 | l = new QLabel ( framehold ); |
125 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); | 135 | l-> setAlignment ( AlignLeft | AlignVCenter | SingleLine ); |
126 | lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); | 136 | lay-> addWidget ( l, i + 1, 3, AlignLeft | AlignTop ); |
127 | bi-> m_hlabel = l; | 137 | bi-> m_hlabel = l; |
128 | 138 | ||
129 | i += 2; | 139 | i += 2; |
130 | 140 | ||