summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-23 15:29:20 (UTC)
committer harlekin <harlekin>2002-10-23 15:29:20 (UTC)
commitd3c2817cea75b9b84ea02a102e7048abf109f848 (patch) (unidiff)
treea7ac3e77b5907b7a0e154a8b3bbc770d67459996
parent30f9875a844ff59a51c65d542e2ed1c5a214af9d (diff)
downloadopie-d3c2817cea75b9b84ea02a102e7048abf109f848.zip
opie-d3c2817cea75b9b84ea02a102e7048abf109f848.tar.gz
opie-d3c2817cea75b9b84ea02a102e7048abf109f848.tar.bz2
right widget size when comming back rom fullscreen
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp12
-rw-r--r--noncore/apps/opie-console/function_keyboard.h5
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp7
3 files changed, 12 insertions, 12 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index 977a384..c314949 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -106,25 +106,25 @@ void FunctionKeyboard::paintKey(int row, int col) {
106 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)), 106 QPoint((col + 1) * keyWidth - 1, row * keyHeight + keyHeight- 1)),
107 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255)); 107 (pressedRow != -1 && pressedCol != -1 ) ? QColor(97,119,155) : QColor(255,255,255));
108 p.drawText( 108 p.drawText(
109 col * keyWidth + 1, row * keyHeight + 1, 109 col * keyWidth + 1, row * keyHeight + 1,
110 keyWidth, keyHeight, 110 keyWidth, keyHeight,
111 Qt::AlignHCenter | Qt::AlignVCenter, 111 Qt::AlignHCenter | Qt::AlignVCenter,
112 keys["r" + QString::number(row) + "c" + QString::number(col)].getL() 112 keys["r" + QString::number(row) + "c" + QString::number(col)].getL()
113 ); 113 );
114 114
115 if (row == numRows) { 115 if (row == numRows) {
116 116
117 // sometimes it doesnt draw the last line 117 // sometimes it doesnt draw the last line
118 p.drawLine((col+1) * keyWidth -2, row * keyHeight, 118 p.drawLine((col+1) * keyWidth -2, row * keyHeight,
119 (col+1) * keyWidth -2, (row + 1) * keyHeight 119 (col+1) * keyWidth -2, (row + 1) * keyHeight
120 ); 120 );
121 } 121 }
122 122
123} 123}
124 124
125void FunctionKeyboard::mousePressEvent(QMouseEvent *e) { 125void FunctionKeyboard::mousePressEvent(QMouseEvent *e) {
126 126
127 pressedRow = e->y() / keyHeight; 127 pressedRow = e->y() / keyHeight;
128 pressedCol = (int) (e->x() / keyWidth); 128 pressedCol = (int) (e->x() / keyWidth);
129 129
130 paintKey(pressedRow, pressedCol); 130 paintKey(pressedRow, pressedCol);
@@ -179,26 +179,26 @@ void FunctionKeyboard::loadDefaults() {
179 keys.insert( "r0c9", FKey ("F10", 4152, 0)); 179 keys.insert( "r0c9", FKey ("F10", 4152, 0));
180 keys.insert( "r0c10", FKey ("F11", 4153, 0)); 180 keys.insert( "r0c10", FKey ("F11", 4153, 0));
181 181
182 keys.insert( "r1c7", FKey ("Ho", 4112, 0)); 182 keys.insert( "r1c7", FKey ("Ho", 4112, 0));
183 keys.insert( "r1c8", FKey ("End", 4113, 0)); 183 keys.insert( "r1c8", FKey ("End", 4113, 0));
184 keys.insert( "r1c9", FKey ("PU", 4118, 0)); 184 keys.insert( "r1c9", FKey ("PU", 4118, 0));
185 keys.insert( "r1c10", FKey ("PD", 4119, 0)); 185 keys.insert( "r1c10", FKey ("PD", 4119, 0));
186 186
187} 187}
188 188
189/* FunctionKeyboardConfig {{{1 */ 189/* FunctionKeyboardConfig {{{1 */
190 190
191FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent) : 191FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na )
192 ProfileDialogKeyWidget(name, parent) { 192 : ProfileDialogKeyWidget(name, parent, na) {
193 193
194 194
195 kb = new FunctionKeyboard(this); 195 kb = new FunctionKeyboard(this);
196 196
197 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this); 197 QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimentions"), this);
198 QLabel *l = new QLabel("Rows", dimentions); 198 QLabel *l = new QLabel("Rows", dimentions);
199 QSpinBox *m_rowBox = new QSpinBox(1, 15, 1, dimentions); 199 QSpinBox *m_rowBox = new QSpinBox(1, 15, 1, dimentions);
200 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); 200 connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
201 l = new QLabel("Columns", dimentions); 201 l = new QLabel("Columns", dimentions);
202 m_colBox = new QSpinBox(1, 15, 1, dimentions); 202 m_colBox = new QSpinBox(1, 15, 1, dimentions);
203 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); 203 connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int)));
204 204
@@ -217,30 +217,30 @@ FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* par
217 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int))); 217 connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int)));
218 */ 218 */
219 219
220 QVBoxLayout *root = new QVBoxLayout(this, 2); 220 QVBoxLayout *root = new QVBoxLayout(this, 2);
221 root->addWidget(kb); 221 root->addWidget(kb);
222 root->addWidget(dimentions); 222 root->addWidget(dimentions);
223 root->addWidget(editKey); 223 root->addWidget(editKey);
224} 224}
225FunctionKeyboardConfig::~FunctionKeyboardConfig() { 225FunctionKeyboardConfig::~FunctionKeyboardConfig() {
226 226
227} 227}
228void FunctionKeyboardConfig::load (const Profile& prof) { 228void FunctionKeyboardConfig::load (const Profile& prof) {
229 int i = prof.readNumEntry("keb_rows", 1); 229 //int i = prof.readNumEntry("keb_rows", 1);
230 //m_rowBox->setValue(i); 230 m_rowBox->setValue( 2 );
231} 231}
232void FunctionKeyboardConfig::save (Profile& prof) { 232void FunctionKeyboardConfig::save (Profile& prof) {
233 233
234 //prof.writeEntry("keb_rows", m_rowBox->value()); 234 prof.writeEntry("keb_rows", m_rowBox->value());
235 235
236} 236}
237void FunctionKeyboardConfig::slotChangeRows(int r) { 237void FunctionKeyboardConfig::slotChangeRows(int r) {
238 238
239 kb->changeRows(r); 239 kb->changeRows(r);
240 240
241 // have to do this so the whole thing gets redrawn 241 // have to do this so the whole thing gets redrawn
242 kb->hide(); kb->show(); 242 kb->hide(); kb->show();
243} 243}
244void FunctionKeyboardConfig::slotChangeCols(int c) { 244void FunctionKeyboardConfig::slotChangeCols(int c) {
245 245
246 kb->changeCols(c); 246 kb->changeCols(c);
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index efeff6d..05b991d 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -54,38 +54,41 @@ signals:
54 54
55private: 55private:
56 56
57 void loadDefaults(); 57 void loadDefaults();
58 58
59 59
60private: 60private:
61 61
62 // thie key for the map is the row/col 62 // thie key for the map is the row/col
63 QMap<QString, FKey> keys; 63 QMap<QString, FKey> keys;
64 64
65 uint numRows; 65 uint numRows;
66 int test;
66 uint numCols; 67 uint numCols;
67 uint keyHeight; 68 uint keyHeight;
68 double keyWidth; // decimal point matters! 69 double keyWidth; // decimal point matters!
69 70
70 int pressedRow, pressedCol; 71 int pressedRow, pressedCol;
71 72
72 QObject *parent; 73 QObject *parent;
73 74
74}; 75};
75 76
76class FunctionKeyboardConfig : public ProfileDialogKeyWidget { 77class FunctionKeyboardConfig : public ProfileDialogKeyWidget {
78
77 Q_OBJECT 79 Q_OBJECT
80
78public: 81public:
79 FunctionKeyboardConfig(const QString& name, QWidget *wid); 82 FunctionKeyboardConfig(const QString& name, QWidget *wid, const char* name = 0l );
80 ~FunctionKeyboardConfig(); 83 ~FunctionKeyboardConfig();
81 84
82 void load(const Profile&); 85 void load(const Profile&);
83 void save(Profile&); 86 void save(Profile&);
84 87
85private slots: 88private slots:
86 89
87 void slotKeyPressed(ushort, ushort, bool, bool, bool, ushort, ushort); 90 void slotKeyPressed(ushort, ushort, bool, bool, bool, ushort, ushort);
88 void slotChangeRows(int); 91 void slotChangeRows(int);
89 void slotChangeCols(int); 92 void slotChangeCols(int);
90 void slotChangeIcon(int); 93 void slotChangeIcon(int);
91 94
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 30dd21c..c1020fa 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -488,29 +488,26 @@ void MainWindow::slotSessionChanged( Session* ses ) {
488 } 488 }
489 489
490 QWidget *w = m_curSession->widget(); 490 QWidget *w = m_curSession->widget();
491 if(w) w->setFocus(); 491 if(w) w->setFocus();
492 } 492 }
493} 493}
494 494
495void MainWindow::slotFullscreen() { 495void MainWindow::slotFullscreen() {
496 496
497 497
498 498
499 if ( m_isFullscreen ) { 499 if ( m_isFullscreen ) {
500 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), false ); 500 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
501 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 501 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
502
503 setCentralWidget( m_consoleWindow );
504 ( m_curSession->widgetStack() )->show();
505 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 502 ( m_curSession->emulationHandler() )->cornerButton()->hide();
506 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 503 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
507 504
508 } else { 505 } else {
509 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 506 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
510 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 507 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
511 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 508 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
512 , QPoint(0,0), false ); 509 , QPoint(0,0), false );
513 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 510 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
514 ( m_curSession->widgetStack() )->setFocus(); 511 ( m_curSession->widgetStack() )->setFocus();
515 ( m_curSession->widgetStack() )->show(); 512 ( m_curSession->widgetStack() )->show();
516 513