29 files changed, 51 insertions, 48 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 3dd9f54..93bc97a 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -107,175 +107,175 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { | |||
107 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); | 107 | QPoint p = mapToGlobal ( QPoint ( 0, 0 )); |
108 | QSize s = menu->sizeHint ( ); | 108 | QSize s = menu->sizeHint ( ); |
109 | int opt = menu->exec( QPoint ( | 109 | int opt = menu->exec( QPoint ( |
110 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), | 110 | p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), |
111 | p. y ( ) - s. height ( ) ), 0); | 111 | p. y ( ) - s. height ( ) ), 0); |
112 | 112 | ||
113 | if ( opt == 1 ) { | 113 | if ( opt == 1 ) { |
114 | 114 | ||
115 | cmd = "/sbin/cardctl eject 0"; | 115 | cmd = "/sbin/cardctl eject 0"; |
116 | err = system( (const char *) cmd ); | 116 | err = system( (const char *) cmd ); |
117 | if ( ( err == 127 ) || ( err < 0 ) ) { | 117 | if ( ( err == 127 ) || ( err < 0 ) ) { |
118 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", err); | 118 | qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", err); |
119 | popUp( tr("CF/PCMCIA card eject failed!")); | 119 | popUp( tr("CF/PCMCIA card eject failed!")); |
120 | } | 120 | } |
121 | } else if ( opt == 0 ) { | 121 | } else if ( opt == 0 ) { |
122 | cmd = "/etc/sdcontrol compeject"; | 122 | cmd = "/etc/sdcontrol compeject"; |
123 | err = system( (const char *) cmd ); | 123 | err = system( (const char *) cmd ); |
124 | if ( ( err != 0 ) ) { | 124 | if ( ( err != 0 ) ) { |
125 | qDebug("Could not execute `/etc/sdcontrol comeject'! err=%d", err); | 125 | qDebug("Could not execute `/etc/sdcontrol comeject'! err=%d", err); |
126 | popUp( tr("SD/MMC card eject failed!")); | 126 | popUp( tr("SD/MMC card eject failed!")); |
127 | } | 127 | } |
128 | } else if ( opt == 2 ) { | 128 | } else if ( opt == 2 ) { |
129 | cmd = "/sbin/cardctl eject 1"; | 129 | cmd = "/sbin/cardctl eject 1"; |
130 | err = system( (const char *) cmd ); | 130 | err = system( (const char *) cmd ); |
131 | if ( ( err == 127 ) || ( err < 0 ) ) { | 131 | if ( ( err == 127 ) || ( err < 0 ) ) { |
132 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", err); | 132 | qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", err); |
133 | popUp( tr("CF/PCMCIA card eject failed!")); | 133 | popUp( tr("CF/PCMCIA card eject failed!")); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | delete menu; | 137 | delete menu; |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | void CardMonitor::cardMessage( const QCString &msg, const QByteArray & ) { | 141 | void CardMonitor::cardMessage( const QCString &msg, const QByteArray & ) { |
142 | if ( msg == "stabChanged()" ) { | 142 | if ( msg == "stabChanged()" ) { |
143 | // qDebug("Pcmcia: stabchanged"); | 143 | // qDebug("Pcmcia: stabchanged"); |
144 | if ( getStatusPcmcia() ) { | 144 | if ( getStatusPcmcia() ) { |
145 | repaint(FALSE); | 145 | repaint(FALSE); |
146 | } | 146 | } |
147 | } else if ( msg == "mtabChanged()" ) { | 147 | } else if ( msg == "mtabChanged()" ) { |
148 | // qDebug("Pcmcia: mtabchanged"); | 148 | // qDebug("Pcmcia: mtabchanged"); |
149 | if ( getStatusSd() ) { | 149 | if ( getStatusSd() ) { |
150 | repaint(FALSE); | 150 | repaint(FALSE); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | bool CardMonitor::getStatusPcmcia( int showPopUp = FALSE ) { | 155 | bool CardMonitor::getStatusPcmcia( int showPopUp ) { |
156 | 156 | ||
157 | bool cardWas0 = cardInPcmcia0; // remember last state | 157 | bool cardWas0 = cardInPcmcia0; // remember last state |
158 | bool cardWas1 = cardInPcmcia1; | 158 | bool cardWas1 = cardInPcmcia1; |
159 | 159 | ||
160 | QString fileName; | 160 | QString fileName; |
161 | 161 | ||
162 | // one of these 3 files should exist | 162 | // one of these 3 files should exist |
163 | if (QFile::exists("/var/run/stab")) { | 163 | if (QFile::exists("/var/run/stab")) { |
164 | fileName = "/var/run/stab"; | 164 | fileName = "/var/run/stab"; |
165 | } else if (QFile::exists("/var/state/pcmcia/stab")) { | 165 | } else if (QFile::exists("/var/state/pcmcia/stab")) { |
166 | fileName="/var/state/pcmcia/stab"; | 166 | fileName="/var/state/pcmcia/stab"; |
167 | } else { | 167 | } else { |
168 | fileName="/var/lib/pcmcia/stab"; | 168 | fileName="/var/lib/pcmcia/stab"; |
169 | } | 169 | } |
170 | 170 | ||
171 | QFile f(fileName); | 171 | QFile f(fileName); |
172 | 172 | ||
173 | if ( f.open(IO_ReadOnly) ) { | 173 | if ( f.open(IO_ReadOnly) ) { |
174 | QStringList list; | 174 | QStringList list; |
175 | QTextStream stream ( &f); | 175 | QTextStream stream ( &f); |
176 | QString streamIn; | 176 | QString streamIn; |
177 | streamIn = stream.read(); | 177 | streamIn = stream.read(); |
178 | list = QStringList::split("\n", streamIn); | 178 | list = QStringList::split("\n", streamIn); |
179 | for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) { | 179 | for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) { |
180 | if( (*line).startsWith("Socket 0:") ){ | 180 | if( (*line).startsWith("Socket 0:") ){ |
181 | if( (*line).startsWith("Socket 0: empty") && cardInPcmcia0 ){ | 181 | if( (*line).startsWith("Socket 0: empty") && cardInPcmcia0 ){ |
182 | cardInPcmcia0 = FALSE; | 182 | cardInPcmcia0 = FALSE; |
183 | } else if ( !(*line).startsWith("Socket 0: empty") && !cardInPcmcia0 ){ | 183 | } else if ( !(*line).startsWith("Socket 0: empty") && !cardInPcmcia0 ){ |
184 | cardInPcmcia0Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 ); | 184 | cardInPcmcia0Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 ); |
185 | cardInPcmcia0Name.stripWhiteSpace(); | 185 | cardInPcmcia0Name.stripWhiteSpace(); |
186 | cardInPcmcia0 = TRUE; | 186 | cardInPcmcia0 = TRUE; |
187 | show(); | 187 | show(); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | if( (*line).startsWith("Socket 1:") ){ | 190 | if( (*line).startsWith("Socket 1:") ){ |
191 | if( (*line).startsWith("Socket 1: empty") && cardInPcmcia1 ){ | 191 | if( (*line).startsWith("Socket 1: empty") && cardInPcmcia1 ){ |
192 | cardInPcmcia1 = FALSE; | 192 | cardInPcmcia1 = FALSE; |
193 | } else if ( !(*line).startsWith("Socket 1: empty") && !cardInPcmcia1 ){ | 193 | } else if ( !(*line).startsWith("Socket 1: empty") && !cardInPcmcia1 ){ |
194 | cardInPcmcia1Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 ); | 194 | cardInPcmcia1Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 ); |
195 | cardInPcmcia1Name.stripWhiteSpace(); | 195 | cardInPcmcia1Name.stripWhiteSpace(); |
196 | cardInPcmcia1 = TRUE; | 196 | cardInPcmcia1 = TRUE; |
197 | show(); | 197 | show(); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | // no file found | 202 | // no file found |
203 | qDebug("no file found"); | 203 | qDebug("no file found"); |
204 | cardInPcmcia0 = FALSE; | 204 | cardInPcmcia0 = FALSE; |
205 | cardInPcmcia1 = FALSE; | 205 | cardInPcmcia1 = FALSE; |
206 | return FALSE; | 206 | return FALSE; |
207 | 207 | ||
208 | } | 208 | } |
209 | 209 | ||
210 | if(!cardInPcmcia0 && !cardInPcmcia1) { | 210 | if(!cardInPcmcia0 && !cardInPcmcia1) { |
211 | qDebug("Pcmcia: no cards"); | 211 | qDebug("Pcmcia: no cards"); |
212 | } | 212 | } |
213 | 213 | ||
214 | if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { | 214 | if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) { |
215 | QString text = ""; | 215 | QString text = ""; |
216 | if(cardWas0 != cardInPcmcia0) { | 216 | if(cardWas0 != cardInPcmcia0) { |
217 | if(cardInPcmcia0) { text += tr("New card: "); } | 217 | if(cardInPcmcia0) { text += tr("New card: "); } |
218 | else { text += tr("Ejected: "); } | 218 | else { text += tr("Ejected: "); } |
219 | text += cardInPcmcia0Name; | 219 | text += cardInPcmcia0Name; |
220 | } | 220 | } |
221 | if(cardWas0 != cardInPcmcia0 && cardWas1 != cardInPcmcia1) { | 221 | if(cardWas0 != cardInPcmcia0 && cardWas1 != cardInPcmcia1) { |
222 | text += "\n"; | 222 | text += "\n"; |
223 | } | 223 | } |
224 | if(cardWas1 != cardInPcmcia1) { | 224 | if(cardWas1 != cardInPcmcia1) { |
225 | if(cardInPcmcia1) { text += tr("New card: "); } | 225 | if(cardInPcmcia1) { text += tr("New card: "); } |
226 | else { text += tr("Ejected: "); } | 226 | else { text += tr("Ejected: "); } |
227 | text += cardInPcmcia1Name; | 227 | text += cardInPcmcia1Name; |
228 | } | 228 | } |
229 | popUp( text ); | 229 | popUp( text ); |
230 | } | 230 | } |
231 | 231 | ||
232 | f.close(); | 232 | f.close(); |
233 | 233 | ||
234 | return ((cardWas0 == cardInPcmcia0 || cardWas1 == cardInPcmcia1) ? FALSE : TRUE); | 234 | return ((cardWas0 == cardInPcmcia0 || cardWas1 == cardInPcmcia1) ? FALSE : TRUE); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | bool CardMonitor::getStatusSd( int showPopUp = FALSE ) { | 238 | bool CardMonitor::getStatusSd( int showPopUp ) { |
239 | 239 | ||
240 | bool cardWas=cardInSd; // remember last state | 240 | bool cardWas=cardInSd; // remember last state |
241 | cardInSd=false; | 241 | cardInSd=false; |
242 | 242 | ||
243 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 243 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
244 | struct mntent *me; | 244 | struct mntent *me; |
245 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 245 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
246 | 246 | ||
247 | if ( mntfp ) { | 247 | if ( mntfp ) { |
248 | while ( (me = getmntent( mntfp )) != 0 ) { | 248 | while ( (me = getmntent( mntfp )) != 0 ) { |
249 | QString fs = me->mnt_fsname; | 249 | QString fs = me->mnt_fsname; |
250 | if ( fs.left(7)=="/dev/sd" || fs.left(9) == "/dev/mmcd" ) { | 250 | if ( fs.left(7)=="/dev/sd" || fs.left(9) == "/dev/mmcd" ) { |
251 | cardInSd=true; | 251 | cardInSd=true; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | endmntent( mntfp ); | 254 | endmntent( mntfp ); |
255 | } | 255 | } |
256 | if(!showPopUp && cardWas != cardInSd) { | 256 | if(!showPopUp && cardWas != cardInSd) { |
257 | QString text = ""; | 257 | QString text = ""; |
258 | if(cardInSd) { text += "SD Inserted"; } | 258 | if(cardInSd) { text += "SD Inserted"; } |
259 | else { text += "SD Removed"; } | 259 | else { text += "SD Removed"; } |
260 | popUp( text ); | 260 | popUp( text ); |
261 | } | 261 | } |
262 | 262 | ||
263 | #else | 263 | #else |
264 | #error "Not on Linux" | 264 | #error "Not on Linux" |
265 | #endif | 265 | #endif |
266 | return ((cardWas == cardInSd) ? FALSE : TRUE); | 266 | return ((cardWas == cardInSd) ? FALSE : TRUE); |
267 | } | 267 | } |
268 | 268 | ||
269 | void CardMonitor::paintEvent( QPaintEvent * ) { | 269 | void CardMonitor::paintEvent( QPaintEvent * ) { |
270 | QPainter p( this ); | 270 | QPainter p( this ); |
271 | 271 | ||
272 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 272 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { |
273 | p.drawPixmap( 0, 0, pm ); | 273 | p.drawPixmap( 0, 0, pm ); |
274 | show(); | 274 | show(); |
275 | } else { | 275 | } else { |
276 | p.eraseRect( rect() ); | 276 | p.eraseRect( rect() ); |
277 | hide(); | 277 | hide(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | 281 | ||
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index b29ee62..4278f46 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -581,49 +581,50 @@ void VMemo::record(void) | |||
581 | ::close(dsp); | 581 | ::close(dsp); |
582 | fileName = fileName.left(fileName.length()-4); | 582 | fileName = fileName.left(fileName.length()-4); |
583 | // if(useAlerts) | 583 | // if(useAlerts) |
584 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); | 584 | // QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName); |
585 | qDebug("done recording "+fileName); | 585 | qDebug("done recording "+fileName); |
586 | QSound::play(Resource::findSound("vmemoe")); | 586 | QSound::play(Resource::findSound("vmemoe")); |
587 | 587 | ||
588 | Config cfg("qpe"); | 588 | Config cfg("qpe"); |
589 | cfg.setGroup("Volume"); | 589 | cfg.setGroup("Volume"); |
590 | QString foo = cfg.readEntry("Mute","TRUE"); | 590 | QString foo = cfg.readEntry("Mute","TRUE"); |
591 | if(foo.find("TRUE",0,TRUE) != -1) | 591 | if(foo.find("TRUE",0,TRUE) != -1) |
592 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | 592 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute |
593 | 593 | ||
594 | } | 594 | } |
595 | 595 | ||
596 | int VMemo::setToggleButton(int tog) { | 596 | int VMemo::setToggleButton(int tog) { |
597 | 597 | ||
598 | for( int i=0; i < 10;i++) { | 598 | for( int i=0; i < 10;i++) { |
599 | switch (tog) { | 599 | switch (tog) { |
600 | case 0: | 600 | case 0: |
601 | return -1; | 601 | return -1; |
602 | break; | 602 | break; |
603 | case 1: | 603 | case 1: |
604 | return 0; | 604 | return 0; |
605 | break; | 605 | break; |
606 | case 2: | 606 | case 2: |
607 | return Key_Escape; | 607 | return Key_Escape; |
608 | break; | 608 | break; |
609 | case 3: | 609 | case 3: |
610 | return Key_Space; | 610 | return Key_Space; |
611 | break; | 611 | break; |
612 | case 4: | 612 | case 4: |
613 | return Key_F12; | 613 | return Key_F12; |
614 | break; | 614 | break; |
615 | case 5: | 615 | case 5: |
616 | return Key_F9; | 616 | return Key_F9; |
617 | break; | 617 | break; |
618 | case 6: | 618 | case 6: |
619 | return Key_F10; | 619 | return Key_F10; |
620 | break; | 620 | break; |
621 | case 7: | 621 | case 7: |
622 | return Key_F11; | 622 | return Key_F11; |
623 | break; | 623 | break; |
624 | case 8: | 624 | case 8: |
625 | return Key_F13; | 625 | return Key_F13; |
626 | break; | 626 | break; |
627 | }; | 627 | }; |
628 | } | 628 | } |
629 | return -1; | ||
629 | } | 630 | } |
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 8299b3d..7a67ab2 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -68,98 +68,98 @@ namespace { | |||
68 | } | 68 | } |
69 | bool isDir()const{ | 69 | bool isDir()const{ |
70 | return dir; | 70 | return dir; |
71 | } | 71 | } |
72 | QString path()const{ | 72 | QString path()const{ |
73 | return text(1 ); | 73 | return text(1 ); |
74 | } | 74 | } |
75 | QString key(int id, bool )const { | 75 | QString key(int id, bool )const { |
76 | QString ke; | 76 | QString ke; |
77 | if( id == 0 || id == 1 ){ // name | 77 | if( id == 0 || id == 1 ){ // name |
78 | if( dir ){ | 78 | if( dir ){ |
79 | ke.append("0" ); | 79 | ke.append("0" ); |
80 | ke.append( text(1) ); | 80 | ke.append( text(1) ); |
81 | }else{ | 81 | }else{ |
82 | ke.append("1" ); | 82 | ke.append("1" ); |
83 | ke.append( text(1) ); | 83 | ke.append( text(1) ); |
84 | } | 84 | } |
85 | }else if( id == 2 ){ // size | 85 | }else if( id == 2 ){ // size |
86 | return text(2); | 86 | return text(2); |
87 | }else if( id == 3 ){ // date | 87 | }else if( id == 3 ){ // date |
88 | return text(3); | 88 | return text(3); |
89 | } | 89 | } |
90 | return ke; | 90 | return ke; |
91 | }; | 91 | }; |
92 | private: | 92 | private: |
93 | bool mLocked:1; | 93 | bool mLocked:1; |
94 | bool dir:1; | 94 | bool dir:1; |
95 | QString m_dir; | 95 | QString m_dir; |
96 | }; | 96 | }; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, | 100 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, |
101 | const QString &dirName, | 101 | const QString &dirName, |
102 | const QString &fileName, | 102 | const QString &fileName, |
103 | const QStringList &mimeTypes ) | 103 | const QStringList &mimeTypes ) |
104 | : QWidget( wid, "OFileSelector") | 104 | : QWidget( wid, "OFileSelector") |
105 | { | 105 | { |
106 | m_mimetypes = mimeTypes; | 106 | m_mimetypes = mimeTypes; |
107 | initVars(); | 107 | initVars(); |
108 | m_mode = mode; | 108 | m_mode = mode; |
109 | m_selector = selector; | 109 | m_selector = selector; |
110 | m_currentDir = dirName; | 110 | m_currentDir = dirName; |
111 | init(); | 111 | init(); |
112 | QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); | 112 | QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); |
113 | } | 113 | } |
114 | 114 | ||
115 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, | 115 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, |
116 | const char *name, bool newVisible = TRUE, | 116 | const char *name, bool newVisible, |
117 | bool closeVisible = FALSE ) | 117 | bool closeVisible ) |
118 | : QWidget( parent, name ) | 118 | : QWidget( parent, name ) |
119 | { | 119 | { |
120 | m_mimetypes = QStringList::split(";", mimeFilter ); | 120 | m_mimetypes = QStringList::split(";", mimeFilter ); |
121 | initVars(); | 121 | initVars(); |
122 | m_currentDir = QPEApplication::documentDir(); | 122 | m_currentDir = QPEApplication::documentDir(); |
123 | m_mode = OPEN; | 123 | m_mode = OPEN; |
124 | m_selector = NORMAL; | 124 | m_selector = NORMAL; |
125 | m_shClose = closeVisible; | 125 | m_shClose = closeVisible; |
126 | m_shNew = newVisible; | 126 | m_shNew = newVisible; |
127 | m_shLne = false; | 127 | m_shLne = false; |
128 | m_shPerm = false; | 128 | m_shPerm = false; |
129 | m_shYesNo = false; | 129 | m_shYesNo = false; |
130 | init(); | 130 | init(); |
131 | 131 | ||
132 | 132 | ||
133 | } | 133 | } |
134 | 134 | ||
135 | OFileSelector::~OFileSelector() | 135 | OFileSelector::~OFileSelector() |
136 | { | 136 | { |
137 | 137 | ||
138 | } | 138 | } |
139 | 139 | ||
140 | void OFileSelector::setNewVisible( bool visible ) | 140 | void OFileSelector::setNewVisible( bool visible ) |
141 | { | 141 | { |
142 | m_shNew = visible; | 142 | m_shNew = visible; |
143 | if( m_selector == NORMAL ){ | 143 | if( m_selector == NORMAL ){ |
144 | delete m_select; | 144 | delete m_select; |
145 | // we need to initialize but keep the selected mimetype | 145 | // we need to initialize but keep the selected mimetype |
146 | QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; | 146 | QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; |
147 | m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , | 147 | m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , |
148 | m_stack, "fileselector", | 148 | m_stack, "fileselector", |
149 | m_shNew, m_shClose); | 149 | m_shNew, m_shClose); |
150 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 150 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
151 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 151 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
152 | //connect to close me and other signals as well | 152 | //connect to close me and other signals as well |
153 | m_stack->addWidget( m_select, NORMAL ); | 153 | m_stack->addWidget( m_select, NORMAL ); |
154 | }else{ | 154 | }else{ |
155 | m_new->show(); | 155 | m_new->show(); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | void OFileSelector::setCloseVisible( bool visible ) | 158 | void OFileSelector::setCloseVisible( bool visible ) |
159 | { | 159 | { |
160 | m_shClose = visible; | 160 | m_shClose = visible; |
161 | if( m_selector == NORMAL ){ | 161 | if( m_selector == NORMAL ){ |
162 | setNewVisible( m_shNew ); // yeah baby | 162 | setNewVisible( m_shNew ); // yeah baby |
163 | }else{ | 163 | }else{ |
164 | m_close->show(); | 164 | m_close->show(); |
165 | } | 165 | } |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 293c391..8f2b9c9 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -454,100 +454,100 @@ void OpieFtp::disConnector() | |||
454 | void OpieFtp::localUpload() | 454 | void OpieFtp::localUpload() |
455 | { | 455 | { |
456 | int fsz; | 456 | int fsz; |
457 | // QCopEnvelope ( "QPE/System", "busy()" ); | 457 | // QCopEnvelope ( "QPE/System", "busy()" ); |
458 | // qApp->processEvents(); | 458 | // qApp->processEvents(); |
459 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 459 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
460 | QListViewItemIterator it( Local_View ); | 460 | QListViewItemIterator it( Local_View ); |
461 | for ( ; it.current(); ++it ) { | 461 | for ( ; it.current(); ++it ) { |
462 | if ( it.current()->isSelected() ) { | 462 | if ( it.current()->isSelected() ) { |
463 | QString strItem = it.current()->text(0); | 463 | QString strItem = it.current()->text(0); |
464 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 464 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
465 | QString remoteFile= currentRemoteDir+strItem; | 465 | QString remoteFile= currentRemoteDir+strItem; |
466 | QFileInfo fi(localFile); | 466 | QFileInfo fi(localFile); |
467 | if( !fi.isDir()) { | 467 | if( !fi.isDir()) { |
468 | fsz=fi.size(); | 468 | fsz=fi.size(); |
469 | ProgressBar->setTotalSteps(fsz); | 469 | ProgressBar->setTotalSteps(fsz); |
470 | 470 | ||
471 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 471 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
472 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 472 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
473 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 473 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
474 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 474 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
475 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 475 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
476 | 476 | ||
477 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 477 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
478 | QString msg; | 478 | QString msg; |
479 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 479 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
480 | msg.replace(QRegExp(":"),"\n"); | 480 | msg.replace(QRegExp(":"),"\n"); |
481 | QMessageBox::message(tr("Note"),msg); | 481 | QMessageBox::message(tr("Note"),msg); |
482 | } | 482 | } |
483 | } else { | 483 | } else { |
484 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 484 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
485 | } | 485 | } |
486 | ProgressBar->reset(); | 486 | ProgressBar->reset(); |
487 | nullifyCallBack(); | 487 | nullifyCallBack(); |
488 | it.current()->setSelected(FALSE); | 488 | it.current()->setSelected(FALSE); |
489 | } //end currentSelected | 489 | } //end currentSelected |
490 | } | 490 | } |
491 | for ( ; it.current(); ++it ) { | 491 | for ( ; it.current(); ++it ) { |
492 | Local_View->clearSelection(); | 492 | Local_View->clearSelection(); |
493 | } | 493 | } |
494 | Local_View->clearFocus(); | 494 | Local_View->clearFocus(); |
495 | TabWidget->setCurrentPage(1); | 495 | TabWidget->setCurrentPage(1); |
496 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 496 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
497 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 497 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
498 | } | 498 | } |
499 | 499 | ||
500 | void OpieFtp::nullifyCallBack() | 500 | void OpieFtp::nullifyCallBack() |
501 | { | 501 | { |
502 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 502 | FtpOptions(FTPLIB_CALLBACK, 0, conn); |
503 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 503 | FtpOptions(FTPLIB_IDLETIME, 0, conn); |
504 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 504 | FtpOptions(FTPLIB_CALLBACKARG, 0, conn); |
505 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 505 | FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn); |
506 | } | 506 | } |
507 | 507 | ||
508 | void OpieFtp::remoteDownload() | 508 | void OpieFtp::remoteDownload() |
509 | { | 509 | { |
510 | // qApp->processEvents(); | 510 | // qApp->processEvents(); |
511 | int fsz; | 511 | int fsz; |
512 | // QCopEnvelope ( "QPE/System", "busy()" ); | 512 | // QCopEnvelope ( "QPE/System", "busy()" ); |
513 | 513 | ||
514 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 514 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
515 | QListViewItemIterator it( Remote_View ); | 515 | QListViewItemIterator it( Remote_View ); |
516 | for ( ; it.current(); ++it ) { | 516 | for ( ; it.current(); ++it ) { |
517 | if ( it.current()->isSelected() ) { | 517 | if ( it.current()->isSelected() ) { |
518 | QString strItem = it.current()->text(0); | 518 | QString strItem = it.current()->text(0); |
519 | // strItem=strItem.right(strItem.length()-1); | 519 | // strItem=strItem.right(strItem.length()-1); |
520 | QString localFile = currentDir.canonicalPath(); | 520 | QString localFile = currentDir.canonicalPath(); |
521 | if(localFile.right(1).find("/",0,TRUE) == -1) | 521 | if(localFile.right(1).find("/",0,TRUE) == -1) |
522 | localFile += "/"; | 522 | localFile += "/"; |
523 | localFile += strItem; | 523 | localFile += strItem; |
524 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 524 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
525 | QString remoteFile= currentRemoteDir+strItem; | 525 | QString remoteFile= currentRemoteDir+strItem; |
526 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 526 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
527 | fsz = 0; | 527 | fsz = 0; |
528 | QString temp; | 528 | QString temp; |
529 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 529 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
530 | 530 | ||
531 | ProgressBar->setTotalSteps(fsz); | 531 | ProgressBar->setTotalSteps(fsz); |
532 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 532 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
533 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 533 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
534 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 534 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
535 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 535 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
536 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 536 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
537 | 537 | ||
538 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 538 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
539 | QString msg; | 539 | QString msg; |
540 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 540 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
541 | msg.replace(QRegExp(":"),"\n"); | 541 | msg.replace(QRegExp(":"),"\n"); |
542 | QMessageBox::message(tr("Note"),msg); | 542 | QMessageBox::message(tr("Note"),msg); |
543 | } | 543 | } |
544 | ProgressBar->reset(); | 544 | ProgressBar->reset(); |
545 | nullifyCallBack(); | 545 | nullifyCallBack(); |
546 | it.current()->setSelected(FALSE); | 546 | it.current()->setSelected(FALSE); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | for ( ; it.current(); ++it ) { | 549 | for ( ; it.current(); ++it ) { |
550 | Remote_View->clearSelection(); | 550 | Remote_View->clearSelection(); |
551 | } | 551 | } |
552 | Remote_View->setFocus(); | 552 | Remote_View->setFocus(); |
553 | TabWidget->setCurrentPage(0); | 553 | TabWidget->setCurrentPage(0); |
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index b490072..672548f 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -1,90 +1,90 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "soundsettings.h" | 21 | #include "soundsettings.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
27 | 27 | ||
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | #include <qslider.h> | 29 | #include <qslider.h> |
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | 33 | ||
34 | #include <sys/utsname.h> | 34 | #include <sys/utsname.h> |
35 | #include <sys/time.h> | 35 | #include <sys/time.h> |
36 | #include <sys/types.h> | 36 | #include <sys/types.h> |
37 | #include <unistd.h> | 37 | #include <unistd.h> |
38 | #include <stdio.h> | 38 | #include <stdio.h> |
39 | #include <sys/stat.h> | 39 | #include <sys/stat.h> |
40 | 40 | ||
41 | SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl ) | 41 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
42 | : SoundSettingsBase( parent, name, TRUE, fl ) | 42 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
43 | { | 43 | { |
44 | keyReset=FALSE; | 44 | keyReset=FALSE; |
45 | 45 | ||
46 | Config config( "qpe"); | 46 | Config config( "qpe"); |
47 | config.setGroup( "Volume" ); | 47 | config.setGroup( "Volume" ); |
48 | volume->setValue(100-config.readNumEntry("VolumePercent")); | 48 | volume->setValue(100-config.readNumEntry("VolumePercent")); |
49 | mic->setValue(100-config.readNumEntry("Mic")); | 49 | mic->setValue(100-config.readNumEntry("Mic")); |
50 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); | 50 | // touchsound->setChecked(config.readBoolEntry("TouchSound")); |
51 | // keysound->setChecked(config.readBoolEntry("KeySound")); | 51 | // keysound->setChecked(config.readBoolEntry("KeySound")); |
52 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
55 | 55 | ||
56 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
57 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
58 | if(rate == 8000) | 58 | if(rate == 8000) |
59 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
60 | else if(rate == 11025) | 60 | else if(rate == 11025) |
61 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
62 | else if(rate == 22050) | 62 | else if(rate == 22050) |
63 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
64 | else if(rate == 33075) | 64 | else if(rate == 33075) |
65 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
66 | else if(rate==44100) | 66 | else if(rate==44100) |
67 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
68 | 68 | ||
69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only |
70 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 70 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
71 | if (uname(&name) != -1) { | 71 | if (uname(&name) != -1) { |
72 | QString release=name.release; | 72 | QString release=name.release; |
73 | 73 | ||
74 | if( release.find("embedix",0,TRUE) !=-1) | 74 | if( release.find("embedix",0,TRUE) !=-1) |
75 | stereoCheckBox->hide(); | 75 | stereoCheckBox->hide(); |
76 | } | 76 | } |
77 | // else | 77 | // else |
78 | // stereoCheckBox->hide(); | 78 | // stereoCheckBox->hide(); |
79 | 79 | ||
80 | 80 | ||
81 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 81 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
82 | 82 | ||
83 | cfg.setGroup("Defaults"); | 83 | cfg.setGroup("Defaults"); |
84 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 84 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
85 | 85 | ||
86 | updateStorageCombo(); | 86 | updateStorageCombo(); |
87 | 87 | ||
88 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); | 88 | connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int))); |
89 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); | 89 | connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int))); |
90 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); | 90 | connect(qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) ); |
diff --git a/noncore/tools/opie-sh/fviewer.cpp b/noncore/tools/opie-sh/fviewer.cpp index 882c72c..6f8f054 100644 --- a/noncore/tools/opie-sh/fviewer.cpp +++ b/noncore/tools/opie-sh/fviewer.cpp | |||
@@ -1,59 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | #include "fviewer.h" | 16 | #include "fviewer.h" |
17 | 17 | ||
18 | FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name) | 18 | FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent, const char*name):QWidget(parent, name) |
19 | { | 19 | { |
20 | QVBoxLayout *layout = new QVBoxLayout(this); | 20 | QVBoxLayout *layout = new QVBoxLayout(this); |
21 | 21 | ||
22 | setIcon(Resource::loadPixmap("opie-sh")); | 22 | setIcon(Resource::loadPixmap("opie-sh")); |
23 | 23 | ||
24 | textView = new QTextBrowser(this, "textview"); | 24 | textView = new QTextBrowser(this, "textview"); |
25 | layout->addWidget(textView); | 25 | layout->addWidget(textView); |
26 | 26 | ||
27 | QString string; | 27 | QString string; |
28 | 28 | ||
29 | if(title.isNull()) | 29 | if(title.isNull()) |
30 | { | 30 | { |
31 | setCaption(filename); | 31 | setCaption(filename); |
32 | } | 32 | } |
33 | else | 33 | else |
34 | { | 34 | { |
35 | setCaption(title); | 35 | setCaption(title); |
36 | } | 36 | } |
37 | 37 | ||
38 | file = new QFile(); | 38 | file = new QFile(); |
39 | 39 | ||
40 | if(!filename.isNull()) | 40 | if(!filename.isNull()) |
41 | { | 41 | { |
42 | file->setName(filename); | 42 | file->setName(filename); |
43 | file->open(IO_ReadOnly); | 43 | file->open(IO_ReadOnly); |
44 | } | 44 | } |
45 | else | 45 | else |
46 | { | 46 | { |
47 | file->open(IO_ReadOnly, 0); | 47 | file->open(IO_ReadOnly, 0); |
48 | } | 48 | } |
49 | 49 | ||
50 | stream = new QTextStream(file); | 50 | stream = new QTextStream(file); |
51 | 51 | ||
52 | string = stream->read(); | 52 | string = stream->read(); |
53 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/"); | 53 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/"); |
54 | textView->setText(string, QDir::currentDirPath()+"/"); | 54 | textView->setText(string, QDir::currentDirPath()+"/"); |
55 | printf("%s\n", QDir::currentDirPath().latin1()); | 55 | printf("%s\n", QDir::currentDirPath().latin1()); |
56 | file->close(); | 56 | file->close(); |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
diff --git a/noncore/tools/opie-sh/inputdialog.cpp b/noncore/tools/opie-sh/inputdialog.cpp index 0780def..1c4e688 100644 --- a/noncore/tools/opie-sh/inputdialog.cpp +++ b/noncore/tools/opie-sh/inputdialog.cpp | |||
@@ -1,66 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | #include "inputdialog.h" | 16 | #include "inputdialog.h" |
17 | 17 | ||
18 | InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString title, QString filename, bool edit, QWidget *parent=0, const char *name=0, bool modal=true, WFlags f=0):QDialog(parent, name, modal, f) | 18 | InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString title, QString filename, bool edit, QWidget *parent, const char *name, bool modal, WFlags f):QDialog(parent, name, modal, f) |
19 | { | 19 | { |
20 | type = newtype; | 20 | type = newtype; |
21 | QHBoxLayout *layout = new QHBoxLayout(this); | 21 | QHBoxLayout *layout = new QHBoxLayout(this); |
22 | layout->addStrut(32); | 22 | layout->addStrut(32); |
23 | QLabel *label = new QLabel(labelString, this, "label"); | 23 | QLabel *label = new QLabel(labelString, this, "label"); |
24 | setCaption(title); | 24 | setCaption(title); |
25 | int x, y; | 25 | int x, y; |
26 | 26 | ||
27 | layout->addSpacing(5); | 27 | layout->addSpacing(5); |
28 | layout->addWidget(label); | 28 | layout->addWidget(label); |
29 | layout->addSpacing(5); | 29 | layout->addSpacing(5); |
30 | 30 | ||
31 | switch(type) | 31 | switch(type) |
32 | { | 32 | { |
33 | case 0: | 33 | case 0: |
34 | lineEdit = new QLineEdit(this, "line edit"); | 34 | lineEdit = new QLineEdit(this, "line edit"); |
35 | layout->addWidget(lineEdit); | 35 | layout->addWidget(lineEdit); |
36 | break; | 36 | break; |
37 | case 1: | 37 | case 1: |
38 | comboBox = new QComboBox(edit, this, "combo box"); | 38 | comboBox = new QComboBox(edit, this, "combo box"); |
39 | layout->addWidget(comboBox); | 39 | layout->addWidget(comboBox); |
40 | if(!filename.isNull()) | 40 | if(!filename.isNull()) |
41 | { | 41 | { |
42 | QFile file(filename); | 42 | QFile file(filename); |
43 | file.open(IO_ReadOnly); | 43 | file.open(IO_ReadOnly); |
44 | QTextStream stream(&file); | 44 | QTextStream stream(&file); |
45 | QString string = stream.read(); | 45 | QString string = stream.read(); |
46 | 46 | ||
47 | comboBox->insertStringList(QStringList::split('\n', string)); | 47 | comboBox->insertStringList(QStringList::split('\n', string)); |
48 | } | 48 | } |
49 | else | 49 | else |
50 | { | 50 | { |
51 | QFile file; | 51 | QFile file; |
52 | file.open(IO_ReadOnly, 0); | 52 | file.open(IO_ReadOnly, 0); |
53 | QTextStream stream(&file); | 53 | QTextStream stream(&file); |
54 | QString string = stream.read(); | 54 | QString string = stream.read(); |
55 | 55 | ||
56 | comboBox->insertStringList(QStringList::split('\n', string)); | 56 | comboBox->insertStringList(QStringList::split('\n', string)); |
57 | } | 57 | } |
58 | break; | 58 | break; |
59 | case 2: | 59 | case 2: |
60 | listBox = new QListBox(this, "list box"); | 60 | listBox = new QListBox(this, "list box"); |
61 | listBox->setSelectionMode(QListBox::Multi); | 61 | listBox->setSelectionMode(QListBox::Multi); |
62 | layout->addWidget(listBox); | 62 | layout->addWidget(listBox); |
63 | if(!filename.isNull()) | 63 | if(!filename.isNull()) |
64 | { | 64 | { |
65 | QFile file(filename); | 65 | QFile file(filename); |
66 | file.open(IO_ReadOnly); | 66 | file.open(IO_ReadOnly); |
@@ -69,49 +69,50 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString | |||
69 | 69 | ||
70 | listBox->insertStringList(QStringList::split('\n', string)); | 70 | listBox->insertStringList(QStringList::split('\n', string)); |
71 | } | 71 | } |
72 | else | 72 | else |
73 | { | 73 | { |
74 | QFile file; | 74 | QFile file; |
75 | file.open(IO_ReadOnly, 0); | 75 | file.open(IO_ReadOnly, 0); |
76 | QTextStream stream(&file); | 76 | QTextStream stream(&file); |
77 | QString string = stream.read(); | 77 | QString string = stream.read(); |
78 | 78 | ||
79 | listBox->insertStringList(QStringList::split('\n', string)); | 79 | listBox->insertStringList(QStringList::split('\n', string)); |
80 | } | 80 | } |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | layout->addSpacing(5); | 83 | layout->addSpacing(5); |
84 | 84 | ||
85 | x=(w/2)-(width()/2); | 85 | x=(w/2)-(width()/2); |
86 | y=(h/2)-(height()/2); | 86 | y=(h/2)-(height()/2); |
87 | 87 | ||
88 | move(x,y); | 88 | move(x,y); |
89 | } | 89 | } |
90 | 90 | ||
91 | QString InputDialog::getString() | 91 | QString InputDialog::getString() |
92 | { | 92 | { |
93 | switch (type) | 93 | switch (type) |
94 | { | 94 | { |
95 | case 0: | 95 | case 0: |
96 | return ((QLineEdit *)child("line edit"))->text(); | 96 | return ((QLineEdit *)child("line edit"))->text(); |
97 | break; | 97 | break; |
98 | case 1: | 98 | case 1: |
99 | return ((QComboBox *)child("combo box"))->currentText(); | 99 | return ((QComboBox *)child("combo box"))->currentText(); |
100 | break; | 100 | break; |
101 | case 2: | 101 | case 2: |
102 | QString string; | 102 | QString string; |
103 | int i; | 103 | int i; |
104 | for(i = 0; i < listBox->count(); i++) | 104 | for(i = 0; i < listBox->count(); i++) |
105 | { | 105 | { |
106 | if(listBox->isSelected(i)) | 106 | if(listBox->isSelected(i)) |
107 | { | 107 | { |
108 | string+=listBox->text(i)+'\n'; | 108 | string+=listBox->text(i)+'\n'; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | if(string[string.length()-1] == '\n') | 111 | if(string[string.length()-1] == '\n') |
112 | { | 112 | { |
113 | string.truncate(string.length()-1); | 113 | string.truncate(string.length()-1); |
114 | } | 114 | } |
115 | return string; | 115 | return string; |
116 | } | 116 | } |
117 | return QString::null; | ||
117 | } | 118 | } |
diff --git a/noncore/tools/opie-sh/mbox.cpp b/noncore/tools/opie-sh/mbox.cpp index cb3ea1b..04b397d 100644 --- a/noncore/tools/opie-sh/mbox.cpp +++ b/noncore/tools/opie-sh/mbox.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "mbox.h" | 17 | #include "mbox.h" |
18 | 18 | ||
19 | MBox::MBox(int w, int h, int type, QString title, QString message, QString *btext0 = 0, QString *btext1= 0, QString *btext2 = 0, QWidget *parent=0, const char*name=0, bool modal=true, WFlags f=0):QDialog(parent, name, modal, f) | 19 | MBox::MBox(int w, int h, int type, QString title, QString message, QString *btext0, QString *btext1, QString *btext2, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) |
20 | { | 20 | { |
21 | QVBoxLayout *layout = new QVBoxLayout(this); | 21 | QVBoxLayout *layout = new QVBoxLayout(this); |
22 | 22 | ||
23 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); | 23 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); |
24 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); | 24 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); |
25 | 25 | ||
26 | int x, y; | 26 | int x, y; |
27 | 27 | ||
28 | layout->addLayout(hlayout1); | 28 | layout->addLayout(hlayout1); |
29 | layout->addLayout(hlayout2); | 29 | layout->addLayout(hlayout2); |
30 | 30 | ||
31 | setCaption(title); | 31 | setCaption(title); |
32 | 32 | ||
33 | QLabel *image = new QLabel(this, "image"); | 33 | QLabel *image = new QLabel(this, "image"); |
34 | QLabel *text = new QLabel(message, this, "text"); | 34 | QLabel *text = new QLabel(message, this, "text"); |
35 | 35 | ||
36 | switch (type) | 36 | switch (type) |
37 | { | 37 | { |
38 | case 0: | 38 | case 0: |
39 | image->setPixmap(Resource::loadPixmap("opie-sh/info")); | 39 | image->setPixmap(Resource::loadPixmap("opie-sh/info")); |
40 | break; | 40 | break; |
41 | case 1: | 41 | case 1: |
42 | image->setPixmap(Resource::loadPixmap("opie-sh/warning")); | 42 | image->setPixmap(Resource::loadPixmap("opie-sh/warning")); |
43 | break; | 43 | break; |
44 | case 2: | 44 | case 2: |
45 | image->setPixmap(Resource::loadPixmap("opie-sh/error")); | 45 | image->setPixmap(Resource::loadPixmap("opie-sh/error")); |
46 | break; | 46 | break; |
47 | } | 47 | } |
48 | 48 | ||
49 | hlayout1->addWidget(image); | 49 | hlayout1->addWidget(image); |
50 | hlayout1->addSpacing(5); | 50 | hlayout1->addSpacing(5); |
51 | hlayout1->addWidget(text); | 51 | hlayout1->addWidget(text); |
52 | 52 | ||
53 | if(!btext0->isNull()) | 53 | if(!btext0->isNull()) |
54 | { | 54 | { |
55 | QPushButton *button0 = new QPushButton((const QString)*btext0, this, "button0"); | 55 | QPushButton *button0 = new QPushButton((const QString)*btext0, this, "button0"); |
56 | hlayout2->addSpacing(5); | 56 | hlayout2->addSpacing(5); |
57 | hlayout2->addWidget(button0); | 57 | hlayout2->addWidget(button0); |
58 | hlayout2->addSpacing(5); | 58 | hlayout2->addSpacing(5); |
59 | connect(button0, SIGNAL(clicked()), this, SLOT(b0pressed()) ); | 59 | connect(button0, SIGNAL(clicked()), this, SLOT(b0pressed()) ); |
60 | } | 60 | } |
61 | else | 61 | else |
62 | { | 62 | { |
63 | QPushButton *button0 = new QPushButton("Ok", this, "button0"); | 63 | QPushButton *button0 = new QPushButton("Ok", this, "button0"); |
64 | hlayout2->addSpacing(5); | 64 | hlayout2->addSpacing(5); |
65 | hlayout2->addWidget(button0); | 65 | hlayout2->addWidget(button0); |
66 | hlayout2->addSpacing(5); | 66 | hlayout2->addSpacing(5); |
67 | connect(button0, SIGNAL(clicked()), this, SLOT(b0pressed()) ); | 67 | connect(button0, SIGNAL(clicked()), this, SLOT(b0pressed()) ); |
diff --git a/noncore/tools/opie-sh/opie-sh.cpp b/noncore/tools/opie-sh/opie-sh.cpp index e898cb1..96b4b93 100644 --- a/noncore/tools/opie-sh/opie-sh.cpp +++ b/noncore/tools/opie-sh/opie-sh.cpp | |||
@@ -54,126 +54,127 @@ int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) | |||
54 | button1Text = args[i+1]; | 54 | button1Text = args[i+1]; |
55 | } | 55 | } |
56 | 56 | ||
57 | if(args[i] == "-2") | 57 | if(args[i] == "-2") |
58 | { | 58 | { |
59 | button2Text = args[i+1]; | 59 | button2Text = args[i+1]; |
60 | } | 60 | } |
61 | 61 | ||
62 | if(args[i] == "-I") | 62 | if(args[i] == "-I") |
63 | { | 63 | { |
64 | type=0; | 64 | type=0; |
65 | } | 65 | } |
66 | 66 | ||
67 | if(args[i] == "-w") | 67 | if(args[i] == "-w") |
68 | { | 68 | { |
69 | type = 1; | 69 | type = 1; |
70 | } | 70 | } |
71 | 71 | ||
72 | if(args[i] == "-e") | 72 | if(args[i] == "-e") |
73 | { | 73 | { |
74 | type = 2; | 74 | type = 2; |
75 | } | 75 | } |
76 | 76 | ||
77 | if(args[i] == "-g") | 77 | if(args[i] == "-g") |
78 | { | 78 | { |
79 | full = false; | 79 | full = false; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); | 83 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); |
84 | if(full) | 84 | if(full) |
85 | { | 85 | { |
86 | w->setCaption(title); | 86 | w->setCaption(title); |
87 | w->showMaximized(); | 87 | w->showMaximized(); |
88 | } | 88 | } |
89 | //mbox->show(); | 89 | //mbox->show(); |
90 | switch(mbox->exec() ) | 90 | switch(mbox->exec() ) |
91 | { | 91 | { |
92 | case 0: | 92 | case 0: |
93 | return -1; | 93 | return -1; |
94 | case 1: | 94 | case 1: |
95 | return -1; | 95 | return -1; |
96 | case 2: | 96 | case 2: |
97 | return 0; | 97 | return 0; |
98 | case 3: | 98 | case 3: |
99 | return 1; | 99 | return 1; |
100 | case 4: | 100 | case 4: |
101 | return 2; | 101 | return 2; |
102 | default: return -1; | ||
102 | } | 103 | } |
103 | } | 104 | } |
104 | 105 | ||
105 | void printusage() | 106 | void printusage() |
106 | { | 107 | { |
107 | printf("Usage instructions for Opie-sh\n"); | 108 | printf("Usage instructions for Opie-sh\n"); |
108 | printf("Usage: opie-sh [dialog type] [type specific options]\n"); | 109 | printf("Usage: opie-sh [dialog type] [type specific options]\n"); |
109 | printf("Types:\n"); | 110 | printf("Types:\n"); |
110 | printf(" -m Message Box\n"); | 111 | printf(" -m Message Box\n"); |
111 | printf(" -f [filename] View file [Default = stdin]\n"); | 112 | printf(" -f [filename] View file [Default = stdin]\n"); |
112 | printf(" -i Input dialog\n"); | 113 | printf(" -i Input dialog\n"); |
113 | printf(" -h --help These instructions\n"); | 114 | printf(" -h --help These instructions\n"); |
114 | printf(" -t [title] The window/dialog title\n"); | 115 | printf(" -t [title] The window/dialog title\n"); |
115 | printf("Message box options:\n"); | 116 | printf("Message box options:\n"); |
116 | printf(" -M [message] The message to display\n"); | 117 | printf(" -M [message] The message to display\n"); |
117 | printf(" -I Use information icon\n"); | 118 | printf(" -I Use information icon\n"); |
118 | printf(" -w Use the warning icon\n"); | 119 | printf(" -w Use the warning icon\n"); |
119 | printf(" -e Use the error icon\n"); | 120 | printf(" -e Use the error icon\n"); |
120 | printf(" -0 [text] First button text [Default = OK]\n"); | 121 | printf(" -0 [text] First button text [Default = OK]\n"); |
121 | printf(" -1 [text] Second button text\n"); | 122 | printf(" -1 [text] Second button text\n"); |
122 | printf(" -2 [text] Third button text\n"); | 123 | printf(" -2 [text] Third button text\n"); |
123 | printf(" -g Disable fullscreen\n"); | 124 | printf(" -g Disable fullscreen\n"); |
124 | printf("Input Dialog options:\n"); | 125 | printf("Input Dialog options:\n"); |
125 | printf(" -s A single line of input (output to console)\n"); | 126 | printf(" -s A single line of input (output to console)\n"); |
126 | printf(" -l List input (newline separated list read in from file)\n"); | 127 | printf(" -l List input (newline separated list read in from file)\n"); |
127 | printf(" -b A list box, enabling multiple selections (input same as -l)\n"); | 128 | printf(" -b A list box, enabling multiple selections (input same as -l)\n"); |
128 | printf(" -L [label] The label for the input field\n"); | 129 | printf(" -L [label] The label for the input field\n"); |
129 | printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n"); | 130 | printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n"); |
130 | printf(" -E Makes list input editable\n"); | 131 | printf(" -E Makes list input editable\n"); |
131 | printf(" -g Disable fullscreen\n\0"); | 132 | printf(" -g Disable fullscreen\n"); |
132 | } | 133 | } |
133 | 134 | ||
134 | int fileviewer(QPEApplication *a, int argc, QStringList args) | 135 | int fileviewer(QPEApplication *a, int argc, QStringList args) |
135 | { | 136 | { |
136 | int i; | 137 | int i; |
137 | QString filename, title, icon; | 138 | QString filename, title, icon; |
138 | bool update=false; | 139 | bool update=false; |
139 | 140 | ||
140 | for(i=0; i < argc; i++) | 141 | for(i=0; i < argc; i++) |
141 | { | 142 | { |
142 | if(args[i] == "-f") | 143 | if(args[i] == "-f") |
143 | { | 144 | { |
144 | if(args[i+1][0] != '-') | 145 | if(args[i+1][0] != '-') |
145 | { | 146 | { |
146 | filename = args[i+1]; | 147 | filename = args[i+1]; |
147 | } | 148 | } |
148 | } | 149 | } |
149 | 150 | ||
150 | if(args[i] == "-I") | 151 | if(args[i] == "-I") |
151 | { | 152 | { |
152 | icon=args[i+1]; | 153 | icon=args[i+1]; |
153 | } | 154 | } |
154 | 155 | ||
155 | if(args[i] == "-t") | 156 | if(args[i] == "-t") |
156 | { | 157 | { |
157 | title = args[i+1]; | 158 | title = args[i+1]; |
158 | } | 159 | } |
159 | } | 160 | } |
160 | FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); | 161 | FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); |
161 | a->setMainWidget(fview); | 162 | a->setMainWidget(fview); |
162 | fview->showMaximized(); | 163 | fview->showMaximized(); |
163 | return a->exec(); | 164 | return a->exec(); |
164 | } | 165 | } |
165 | 166 | ||
166 | int input(int wi, int h, QWidget *w, int argc, QStringList args) | 167 | int input(int wi, int h, QWidget *w, int argc, QStringList args) |
167 | { | 168 | { |
168 | int i, type = 0; | 169 | int i, type = 0; |
169 | QString title, label, filename; | 170 | QString title, label, filename; |
170 | bool edit=false, full=true; | 171 | bool edit=false, full=true; |
171 | 172 | ||
172 | for(i=0; i < argc; i++) | 173 | for(i=0; i < argc; i++) |
173 | { | 174 | { |
174 | if(args[i] == "-s") | 175 | if(args[i] == "-s") |
175 | { | 176 | { |
176 | type = 0; | 177 | type = 0; |
177 | } | 178 | } |
178 | 179 | ||
179 | if(args[i] == "-l") | 180 | if(args[i] == "-l") |
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp index 7479e85..6ea4801 100644 --- a/noncore/tools/remote/buttondialog.cpp +++ b/noncore/tools/remote/buttondialog.cpp | |||
@@ -1,281 +1,281 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "buttondialog.h" | 17 | #include "buttondialog.h" |
18 | 18 | ||
19 | ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0):QDialog(parent, name, modal, f) | 19 | ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) |
20 | { | 20 | { |
21 | setCaption(tr(buttonName)); | 21 | setCaption(tr(buttonName)); |
22 | 22 | ||
23 | QVBoxLayout *layout = new QVBoxLayout(this); | 23 | QVBoxLayout *layout = new QVBoxLayout(this); |
24 | 24 | ||
25 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); | 25 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); |
26 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); | 26 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); |
27 | QHBoxLayout *hlayout3 = new QHBoxLayout(this); | 27 | QHBoxLayout *hlayout3 = new QHBoxLayout(this); |
28 | 28 | ||
29 | layout->addSpacing(5); | 29 | layout->addSpacing(5); |
30 | layout->addLayout(hlayout1); | 30 | layout->addLayout(hlayout1); |
31 | layout->addSpacing(5); | 31 | layout->addSpacing(5); |
32 | layout->addLayout(hlayout2); | 32 | layout->addLayout(hlayout2); |
33 | layout->addSpacing(5); | 33 | layout->addSpacing(5); |
34 | layout->addLayout(hlayout3); | 34 | layout->addLayout(hlayout3); |
35 | layout->addSpacing(5); | 35 | layout->addSpacing(5); |
36 | 36 | ||
37 | remote = new QComboBox(false, this, "remote"); | 37 | remote = new QComboBox(false, this, "remote"); |
38 | QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel"); | 38 | QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel"); |
39 | hlayout1->addSpacing(5); | 39 | hlayout1->addSpacing(5); |
40 | hlayout1->addWidget(remoteLabel); | 40 | hlayout1->addWidget(remoteLabel); |
41 | hlayout1->addSpacing(5); | 41 | hlayout1->addSpacing(5); |
42 | hlayout1->addWidget(remote); | 42 | hlayout1->addWidget(remote); |
43 | hlayout1->addSpacing(5); | 43 | hlayout1->addSpacing(5); |
44 | remote->insertItem("Remote "); | 44 | remote->insertItem("Remote "); |
45 | remote->insertStringList(getRemotes()); | 45 | remote->insertStringList(getRemotes()); |
46 | connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) ); | 46 | connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) ); |
47 | 47 | ||
48 | button = new QComboBox(false, this, "button"); | 48 | button = new QComboBox(false, this, "button"); |
49 | QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel"); | 49 | QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel"); |
50 | hlayout2->addSpacing(5); | 50 | hlayout2->addSpacing(5); |
51 | hlayout2->addWidget(buttonLabel); | 51 | hlayout2->addWidget(buttonLabel); |
52 | hlayout2->addSpacing(5); | 52 | hlayout2->addSpacing(5); |
53 | hlayout2->addWidget(button); | 53 | hlayout2->addWidget(button); |
54 | hlayout2->addSpacing(5); | 54 | hlayout2->addSpacing(5); |
55 | button->insertItem("Button "); | 55 | button->insertItem("Button "); |
56 | connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) ); | 56 | connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) ); |
57 | 57 | ||
58 | label = new QLineEdit(this, "label"); | 58 | label = new QLineEdit(this, "label"); |
59 | label->setText(buttonName); | 59 | label->setText(buttonName); |
60 | QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel"); | 60 | QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel"); |
61 | hlayout3->addSpacing(5); | 61 | hlayout3->addSpacing(5); |
62 | hlayout3->addWidget(labelLabel); | 62 | hlayout3->addWidget(labelLabel); |
63 | hlayout3->addSpacing(5); | 63 | hlayout3->addSpacing(5); |
64 | hlayout3->addWidget(label); | 64 | hlayout3->addWidget(label); |
65 | hlayout3->addSpacing(5); | 65 | hlayout3->addSpacing(5); |
66 | } | 66 | } |
67 | 67 | ||
68 | void ButtonDialog::remoteSelected(const QString &string) | 68 | void ButtonDialog::remoteSelected(const QString &string) |
69 | { | 69 | { |
70 | button->insertStringList(getButtons(string.latin1()) ); | 70 | button->insertStringList(getButtons(string.latin1()) ); |
71 | list="SEND_ONCE"; | 71 | list="SEND_ONCE"; |
72 | list+=string; | 72 | list+=string; |
73 | } | 73 | } |
74 | 74 | ||
75 | void ButtonDialog::buttonSelected(const QString &string) | 75 | void ButtonDialog::buttonSelected(const QString &string) |
76 | { | 76 | { |
77 | list+=string; | 77 | list+=string; |
78 | } | 78 | } |
79 | 79 | ||
80 | QStringList ButtonDialog::getList() | 80 | QStringList ButtonDialog::getList() |
81 | { | 81 | { |
82 | return list; | 82 | return list; |
83 | } | 83 | } |
84 | 84 | ||
85 | QString ButtonDialog::getLabel() | 85 | QString ButtonDialog::getLabel() |
86 | { | 86 | { |
87 | return label->text(); | 87 | return label->text(); |
88 | } | 88 | } |
89 | 89 | ||
90 | QStringList ButtonDialog::getRemotes() | 90 | QStringList ButtonDialog::getRemotes() |
91 | { | 91 | { |
92 | const char write_buffer[] = "LIST\n"; | 92 | const char write_buffer[] = "LIST\n"; |
93 | const char *readbuffer; | 93 | const char *readbuffer; |
94 | int i, numlines; | 94 | int i, numlines; |
95 | QStringList list; | 95 | QStringList list; |
96 | 96 | ||
97 | addr.sun_family=AF_UNIX; | 97 | addr.sun_family=AF_UNIX; |
98 | strcpy(addr.sun_path,"/dev/lircd"); | 98 | strcpy(addr.sun_path,"/dev/lircd"); |
99 | 99 | ||
100 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 100 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
101 | if(fd == -1) | 101 | if(fd == -1) |
102 | { | 102 | { |
103 | QMessageBox *mb = new QMessageBox("Error!", | 103 | QMessageBox *mb = new QMessageBox("Error!", |
104 | "couldnt connect to socket", | 104 | "couldnt connect to socket", |
105 | QMessageBox::NoIcon, | 105 | QMessageBox::NoIcon, |
106 | QMessageBox::Ok, | 106 | QMessageBox::Ok, |
107 | QMessageBox::NoButton, | 107 | QMessageBox::NoButton, |
108 | QMessageBox::NoButton); | 108 | QMessageBox::NoButton); |
109 | mb->exec(); | 109 | mb->exec(); |
110 | perror("ButtonDialog::GetRemotes"); | 110 | perror("ButtonDialog::GetRemotes"); |
111 | return NULL; | 111 | return NULL; |
112 | } | 112 | } |
113 | 113 | ||
114 | if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | 114 | if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) |
115 | { | 115 | { |
116 | QMessageBox *mb = new QMessageBox("Error!", | 116 | QMessageBox *mb = new QMessageBox("Error!", |
117 | "couldnt connect to socket", | 117 | "couldnt connect to socket", |
118 | QMessageBox::NoIcon, | 118 | QMessageBox::NoIcon, |
119 | QMessageBox::Ok, | 119 | QMessageBox::Ok, |
120 | QMessageBox::NoButton, | 120 | QMessageBox::NoButton, |
121 | QMessageBox::NoButton); | 121 | QMessageBox::NoButton); |
122 | mb->exec(); | 122 | mb->exec(); |
123 | perror("ButtonDialog::GetRemotes"); | 123 | perror("ButtonDialog::GetRemotes"); |
124 | return NULL; | 124 | return NULL; |
125 | } | 125 | } |
126 | 126 | ||
127 | write(fd, write_buffer, strlen(write_buffer)); | 127 | write(fd, write_buffer, strlen(write_buffer)); |
128 | 128 | ||
129 | for(i=0; i<5; i++) | 129 | for(i=0; i<5; i++) |
130 | { | 130 | { |
131 | printf("%d\n", i); | 131 | printf("%d\n", i); |
132 | readbuffer = readPacket(); | 132 | readbuffer = readPacket(); |
133 | printf("%s", readbuffer); | 133 | printf("%s", readbuffer); |
134 | printf("%d\n", i); | 134 | printf("%d\n", i); |
135 | } | 135 | } |
136 | 136 | ||
137 | numlines = atoi(readbuffer); | 137 | numlines = atoi(readbuffer); |
138 | 138 | ||
139 | for(i=0; i<numlines; i++) | 139 | for(i=0; i<numlines; i++) |
140 | { | 140 | { |
141 | list+=readPacket(); | 141 | list+=readPacket(); |
142 | } | 142 | } |
143 | 143 | ||
144 | if(strcasecmp(readPacket(), "END") != 0) | 144 | if(strcasecmp(readPacket(), "END") != 0) |
145 | { | 145 | { |
146 | QMessageBox *mb = new QMessageBox("Error!", | 146 | QMessageBox *mb = new QMessageBox("Error!", |
147 | "bad packet", | 147 | "bad packet", |
148 | QMessageBox::NoIcon, | 148 | QMessageBox::NoIcon, |
149 | QMessageBox::Ok, | 149 | QMessageBox::Ok, |
150 | QMessageBox::NoButton, | 150 | QMessageBox::NoButton, |
151 | QMessageBox::NoButton); | 151 | QMessageBox::NoButton); |
152 | mb->exec(); | 152 | mb->exec(); |
153 | perror("ButtonDialog::GetRemotes"); | 153 | perror("ButtonDialog::GetRemotes"); |
154 | return NULL; | 154 | return NULL; |
155 | } | 155 | } |
156 | 156 | ||
157 | std::close(fd); | 157 | ::close(fd); |
158 | return list; | 158 | return list; |
159 | } | 159 | } |
160 | 160 | ||
161 | QStringList ButtonDialog::getButtons(const char *remoteName) | 161 | QStringList ButtonDialog::getButtons(const char *remoteName) |
162 | { | 162 | { |
163 | QString write_buffer = "LIST "; | 163 | QString write_buffer = "LIST "; |
164 | const char *readbuffer; | 164 | const char *readbuffer; |
165 | int i, j, numlines; | 165 | int i, j, numlines; |
166 | QStringList list; | 166 | QStringList list; |
167 | QString string; | 167 | QString string; |
168 | 168 | ||
169 | write_buffer += remoteName; | 169 | write_buffer += remoteName; |
170 | write_buffer += '\n'; | 170 | write_buffer += '\n'; |
171 | 171 | ||
172 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 172 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
173 | if(fd == -1) | 173 | if(fd == -1) |
174 | { | 174 | { |
175 | QMessageBox *mb = new QMessageBox("Error!", | 175 | QMessageBox *mb = new QMessageBox("Error!", |
176 | "couldnt connect to socket", | 176 | "couldnt connect to socket", |
177 | QMessageBox::NoIcon, | 177 | QMessageBox::NoIcon, |
178 | QMessageBox::Ok, | 178 | QMessageBox::Ok, |
179 | QMessageBox::NoButton, | 179 | QMessageBox::NoButton, |
180 | QMessageBox::NoButton); | 180 | QMessageBox::NoButton); |
181 | mb->exec(); | 181 | mb->exec(); |
182 | perror("ButtonDialog::GetButtons"); | 182 | perror("ButtonDialog::GetButtons"); |
183 | return NULL; | 183 | return NULL; |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | 187 | if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) |
188 | { | 188 | { |
189 | QMessageBox *mb = new QMessageBox("Error!", | 189 | QMessageBox *mb = new QMessageBox("Error!", |
190 | "couldnt connect to socket", | 190 | "couldnt connect to socket", |
191 | QMessageBox::NoIcon, | 191 | QMessageBox::NoIcon, |
192 | QMessageBox::Ok, | 192 | QMessageBox::Ok, |
193 | QMessageBox::NoButton, | 193 | QMessageBox::NoButton, |
194 | QMessageBox::NoButton); | 194 | QMessageBox::NoButton); |
195 | mb->exec(); | 195 | mb->exec(); |
196 | perror("ButtonDialog::GetButtons"); | 196 | perror("ButtonDialog::GetButtons"); |
197 | return NULL; | 197 | return NULL; |
198 | } | 198 | } |
199 | 199 | ||
200 | write(fd, write_buffer.latin1(), strlen(write_buffer) ); | 200 | write(fd, write_buffer.latin1(), strlen(write_buffer) ); |
201 | 201 | ||
202 | for(i=0; i<5; i++) | 202 | for(i=0; i<5; i++) |
203 | { | 203 | { |
204 | readbuffer = readPacket(); | 204 | readbuffer = readPacket(); |
205 | } | 205 | } |
206 | 206 | ||
207 | numlines = atoi(readbuffer); | 207 | numlines = atoi(readbuffer); |
208 | 208 | ||
209 | for(i=0; i<numlines; i++) | 209 | for(i=0; i<numlines; i++) |
210 | { | 210 | { |
211 | list+=readPacket(); | 211 | list+=readPacket(); |
212 | for(j=0; j<list[i].length(); j++) | 212 | for(j=0; j<list[i].length(); j++) |
213 | { | 213 | { |
214 | if(list[i][j] == ' ') | 214 | if(list[i][j] == ' ') |
215 | break; | 215 | break; |
216 | } | 216 | } |
217 | list[i].remove(0, j+1); | 217 | list[i].remove(0, j+1); |
218 | } | 218 | } |
219 | 219 | ||
220 | if(strcasecmp(readPacket(), "END") != 0) | 220 | if(strcasecmp(readPacket(), "END") != 0) |
221 | { | 221 | { |
222 | QMessageBox *mb = new QMessageBox("Error!", | 222 | QMessageBox *mb = new QMessageBox("Error!", |
223 | "bad packet", | 223 | "bad packet", |
224 | QMessageBox::NoIcon, | 224 | QMessageBox::NoIcon, |
225 | QMessageBox::Ok, | 225 | QMessageBox::Ok, |
226 | QMessageBox::NoButton, | 226 | QMessageBox::NoButton, |
227 | QMessageBox::NoButton); | 227 | QMessageBox::NoButton); |
228 | mb->exec(); | 228 | mb->exec(); |
229 | perror("ButtonDialog::GetButtons"); | 229 | perror("ButtonDialog::GetButtons"); |
230 | return NULL; | 230 | return NULL; |
231 | } | 231 | } |
232 | 232 | ||
233 | std::close(fd); | 233 | ::close(fd); |
234 | return list; | 234 | return list; |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | //this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html | 238 | //this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html |
239 | const char *ButtonDialog::readPacket() | 239 | const char *ButtonDialog::readPacket() |
240 | { | 240 | { |
241 | static char buffer[PACKET_SIZE+1]=""; | 241 | static char buffer[PACKET_SIZE+1]=""; |
242 | char *end; | 242 | char *end; |
243 | static int ptr=0,end_len=0; | 243 | static int ptr=0,end_len=0; |
244 | ssize_t ret; | 244 | ssize_t ret; |
245 | timeout = 0; | 245 | timeout = 0; |
246 | 246 | ||
247 | if(ptr>0) | 247 | if(ptr>0) |
248 | { | 248 | { |
249 | memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1); | 249 | memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1); |
250 | ptr=strlen(buffer); | 250 | ptr=strlen(buffer); |
251 | end=strchr(buffer,'\n'); | 251 | end=strchr(buffer,'\n'); |
252 | } | 252 | } |
253 | else | 253 | else |
254 | { | 254 | { |
255 | end=NULL; | 255 | end=NULL; |
256 | } | 256 | } |
257 | alarm(TIMEOUT); | 257 | alarm(TIMEOUT); |
258 | while(end==NULL) | 258 | while(end==NULL) |
259 | { | 259 | { |
260 | if(PACKET_SIZE<=ptr) | 260 | if(PACKET_SIZE<=ptr) |
261 | { | 261 | { |
262 | fprintf(stderr,"bad packet\n"); | 262 | fprintf(stderr,"bad packet\n"); |
263 | ptr=0; | 263 | ptr=0; |
264 | return(NULL); | 264 | return(NULL); |
265 | } | 265 | } |
266 | ret=read(fd,buffer+ptr,PACKET_SIZE-ptr); | 266 | ret=read(fd,buffer+ptr,PACKET_SIZE-ptr); |
267 | 267 | ||
268 | if(ret<=0 || timeout) | 268 | if(ret<=0 || timeout) |
269 | { | 269 | { |
270 | if(timeout) | 270 | if(timeout) |
271 | { | 271 | { |
272 | fprintf(stderr,"timeout\n"); | 272 | fprintf(stderr,"timeout\n"); |
273 | } | 273 | } |
274 | else | 274 | else |
275 | { | 275 | { |
276 | alarm(0); | 276 | alarm(0); |
277 | } | 277 | } |
278 | ptr=0; | 278 | ptr=0; |
279 | return(NULL); | 279 | return(NULL); |
280 | } | 280 | } |
281 | buffer[ptr+ret]=0; | 281 | buffer[ptr+ret]=0; |
diff --git a/noncore/tools/remote/channelgroup.cpp b/noncore/tools/remote/channelgroup.cpp index 9f90284..7c33674 100644 --- a/noncore/tools/remote/channelgroup.cpp +++ b/noncore/tools/remote/channelgroup.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "channelgroup.h" | 17 | #include "channelgroup.h" |
18 | 18 | ||
19 | ChannelGroup::ChannelGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | ChannelGroup::ChannelGroup(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QGridLayout *layout = new QGridLayout(this); | 21 | QGridLayout *layout = new QGridLayout(this); |
22 | QVBoxLayout *volLayout = new QVBoxLayout(this); | 22 | QVBoxLayout *volLayout = new QVBoxLayout(this); |
23 | QVBoxLayout *chanLayout = new QVBoxLayout(this); | 23 | QVBoxLayout *chanLayout = new QVBoxLayout(this); |
24 | 24 | ||
25 | layout->addRowSpacing(1,1); | 25 | layout->addRowSpacing(1,1); |
26 | layout->addRowSpacing(3,1); | 26 | layout->addRowSpacing(3,1); |
27 | layout->addRowSpacing(5,1); | 27 | layout->addRowSpacing(5,1); |
28 | 28 | ||
29 | layout->addColSpacing(1,1); | 29 | layout->addColSpacing(1,1); |
30 | layout->addColSpacing(3,1); | 30 | layout->addColSpacing(3,1); |
31 | layout->addColSpacing(5,1); | 31 | layout->addColSpacing(5,1); |
32 | layout->addColSpacing(7,1); | 32 | layout->addColSpacing(7,1); |
33 | 33 | ||
34 | QPushButton *one = new QPushButton("1", this, "one"); | 34 | QPushButton *one = new QPushButton("1", this, "one"); |
35 | layout->addWidget(one, 0, 2, 0); | 35 | layout->addWidget(one, 0, 2, 0); |
36 | connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 36 | connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
37 | 37 | ||
38 | QPushButton *two = new QPushButton("2", this, "two"); | 38 | QPushButton *two = new QPushButton("2", this, "two"); |
39 | layout->addWidget(two, 0, 4, 0); | 39 | layout->addWidget(two, 0, 4, 0); |
40 | connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 40 | connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
41 | 41 | ||
42 | QPushButton *three = new QPushButton("3", this, "three"); | 42 | QPushButton *three = new QPushButton("3", this, "three"); |
43 | layout->addWidget(three, 0, 6, 0); | 43 | layout->addWidget(three, 0, 6, 0); |
44 | connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 44 | connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
45 | 45 | ||
46 | QPushButton *four = new QPushButton("4", this, "four"); | 46 | QPushButton *four = new QPushButton("4", this, "four"); |
47 | layout->addWidget(four, 2, 2, 0); | 47 | layout->addWidget(four, 2, 2, 0); |
48 | connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 48 | connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
49 | 49 | ||
50 | QPushButton *five = new QPushButton("5", this, "five"); | 50 | QPushButton *five = new QPushButton("5", this, "five"); |
51 | layout->addWidget(five, 2, 4, 0); | 51 | layout->addWidget(five, 2, 4, 0); |
52 | connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 52 | connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
53 | 53 | ||
54 | QPushButton *six = new QPushButton("6", this, "six"); | 54 | QPushButton *six = new QPushButton("6", this, "six"); |
55 | layout->addWidget(six, 2, 6, 0); | 55 | layout->addWidget(six, 2, 6, 0); |
56 | connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 56 | connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
57 | 57 | ||
58 | QPushButton *seven = new QPushButton("7", this, "seven"); | 58 | QPushButton *seven = new QPushButton("7", this, "seven"); |
59 | layout->addWidget(seven, 4, 2, 0); | 59 | layout->addWidget(seven, 4, 2, 0); |
60 | connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 60 | connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
61 | 61 | ||
62 | QPushButton *eight = new QPushButton("8", this, "eight"); | 62 | QPushButton *eight = new QPushButton("8", this, "eight"); |
63 | layout->addWidget(eight, 4, 4, 0); | 63 | layout->addWidget(eight, 4, 4, 0); |
64 | connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 64 | connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
65 | 65 | ||
66 | QPushButton *nine = new QPushButton("9", this, "nine"); | 66 | QPushButton *nine = new QPushButton("9", this, "nine"); |
67 | layout->addWidget(nine, 4, 6, 0); | 67 | layout->addWidget(nine, 4, 6, 0); |
diff --git a/noncore/tools/remote/channelgroupconf.cpp b/noncore/tools/remote/channelgroupconf.cpp index 2d98115..e39121e 100644 --- a/noncore/tools/remote/channelgroupconf.cpp +++ b/noncore/tools/remote/channelgroupconf.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "channelgroupconf.h" | 17 | #include "channelgroupconf.h" |
18 | 18 | ||
19 | ChannelGroupConf::ChannelGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | ChannelGroupConf::ChannelGroupConf(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QGridLayout *layout = new QGridLayout(this); | 21 | QGridLayout *layout = new QGridLayout(this); |
22 | QVBoxLayout *volLayout = new QVBoxLayout(this); | 22 | QVBoxLayout *volLayout = new QVBoxLayout(this); |
23 | QVBoxLayout *chanLayout = new QVBoxLayout(this); | 23 | QVBoxLayout *chanLayout = new QVBoxLayout(this); |
24 | 24 | ||
25 | layout->addRowSpacing(1,5); | 25 | layout->addRowSpacing(1,5); |
26 | layout->addRowSpacing(3,5); | 26 | layout->addRowSpacing(3,5); |
27 | layout->addRowSpacing(5,5); | 27 | layout->addRowSpacing(5,5); |
28 | 28 | ||
29 | layout->addColSpacing(1,1); | 29 | layout->addColSpacing(1,1); |
30 | layout->addColSpacing(3,1); | 30 | layout->addColSpacing(3,1); |
31 | layout->addColSpacing(5,1); | 31 | layout->addColSpacing(5,1); |
32 | layout->addColSpacing(7,1); | 32 | layout->addColSpacing(7,1); |
33 | 33 | ||
34 | QPushButton *one = new QPushButton("1", this, "one"); | 34 | QPushButton *one = new QPushButton("1", this, "one"); |
35 | layout->addWidget(one, 0, 2, 0); | 35 | layout->addWidget(one, 0, 2, 0); |
36 | connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 36 | connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
37 | 37 | ||
38 | QPushButton *two = new QPushButton("2", this, "two"); | 38 | QPushButton *two = new QPushButton("2", this, "two"); |
39 | layout->addWidget(two, 0, 4, 0); | 39 | layout->addWidget(two, 0, 4, 0); |
40 | connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 40 | connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
41 | 41 | ||
42 | QPushButton *three = new QPushButton("3", this, "three"); | 42 | QPushButton *three = new QPushButton("3", this, "three"); |
43 | layout->addWidget(three, 0, 6, 0); | 43 | layout->addWidget(three, 0, 6, 0); |
44 | connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 44 | connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
45 | 45 | ||
46 | QPushButton *four = new QPushButton("4", this, "four"); | 46 | QPushButton *four = new QPushButton("4", this, "four"); |
47 | layout->addWidget(four, 2, 2, 0); | 47 | layout->addWidget(four, 2, 2, 0); |
48 | connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 48 | connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
49 | 49 | ||
50 | QPushButton *five = new QPushButton("5", this, "five"); | 50 | QPushButton *five = new QPushButton("5", this, "five"); |
51 | layout->addWidget(five, 2, 4, 0); | 51 | layout->addWidget(five, 2, 4, 0); |
52 | connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 52 | connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
53 | 53 | ||
54 | QPushButton *six = new QPushButton("6", this, "six"); | 54 | QPushButton *six = new QPushButton("6", this, "six"); |
55 | layout->addWidget(six, 2, 6, 0); | 55 | layout->addWidget(six, 2, 6, 0); |
56 | connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 56 | connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
57 | 57 | ||
58 | QPushButton *seven = new QPushButton("7", this, "seven"); | 58 | QPushButton *seven = new QPushButton("7", this, "seven"); |
59 | layout->addWidget(seven, 4, 2, 0); | 59 | layout->addWidget(seven, 4, 2, 0); |
60 | connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 60 | connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
61 | 61 | ||
62 | QPushButton *eight = new QPushButton("8", this, "eight"); | 62 | QPushButton *eight = new QPushButton("8", this, "eight"); |
63 | layout->addWidget(eight, 4, 4, 0); | 63 | layout->addWidget(eight, 4, 4, 0); |
64 | connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 64 | connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
65 | 65 | ||
66 | QPushButton *nine = new QPushButton("9", this, "nine"); | 66 | QPushButton *nine = new QPushButton("9", this, "nine"); |
67 | layout->addWidget(nine, 4, 6, 0); | 67 | layout->addWidget(nine, 4, 6, 0); |
diff --git a/noncore/tools/remote/configtab.cpp b/noncore/tools/remote/configtab.cpp index f5896a9..17cdc6a 100644 --- a/noncore/tools/remote/configtab.cpp +++ b/noncore/tools/remote/configtab.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "configtab.h" | 17 | #include "configtab.h" |
18 | 18 | ||
19 | ConfigTab::ConfigTab(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | ConfigTab::ConfigTab(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | 21 | ||
22 | QVBoxLayout *layout = new QVBoxLayout(this); | 22 | QVBoxLayout *layout = new QVBoxLayout(this); |
23 | 23 | ||
24 | topGroupConf = new TopGroupConf(this, "topGroupConf"); | 24 | topGroupConf = new TopGroupConf(this, "topGroupConf"); |
25 | layout->addWidget(topGroupConf, 1); | 25 | layout->addWidget(topGroupConf, 1); |
26 | layout->addSpacing(1); | 26 | layout->addSpacing(1); |
27 | 27 | ||
28 | dvdGroupConf = new DVDGroupConf(this, "dvdGroupConf"); | 28 | dvdGroupConf = new DVDGroupConf(this, "dvdGroupConf"); |
29 | layout->addWidget(dvdGroupConf, 1); | 29 | layout->addWidget(dvdGroupConf, 1); |
30 | layout->addSpacing(1); | 30 | layout->addSpacing(1); |
31 | 31 | ||
32 | vcrGroupConf = new VCRGroupConf(this, "vcrGroupConf"); | 32 | vcrGroupConf = new VCRGroupConf(this, "vcrGroupConf"); |
33 | layout->addWidget(vcrGroupConf, 1); | 33 | layout->addWidget(vcrGroupConf, 1); |
34 | layout->addSpacing(1); | 34 | layout->addSpacing(1); |
35 | 35 | ||
36 | channelGroupConf = new ChannelGroupConf(this, "channelGroupConf"); | 36 | channelGroupConf = new ChannelGroupConf(this, "channelGroupConf"); |
37 | layout->addWidget(channelGroupConf, 1); | 37 | layout->addWidget(channelGroupConf, 1); |
38 | 38 | ||
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | void ConfigTab::setConfig(Config *newCfg) | 42 | void ConfigTab::setConfig(Config *newCfg) |
43 | { | 43 | { |
44 | cfg = newCfg; | 44 | cfg = newCfg; |
45 | cfg->setGroup("Remotes"); | 45 | cfg->setGroup("Remotes"); |
46 | topGroupConf->updateRemotes(cfg->readListEntry("remoteList", ',') ); | 46 | topGroupConf->updateRemotes(cfg->readListEntry("remoteList", ',') ); |
47 | cfg->setGroup("Default"); | 47 | cfg->setGroup("Default"); |
48 | const QObject *obj; | 48 | const QObject *obj; |
49 | 49 | ||
50 | const QObjectList *objList = topGroupConf->children(); | 50 | const QObjectList *objList = topGroupConf->children(); |
51 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) | 51 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) |
52 | { | 52 | { |
53 | if(obj->inherits("QPushButton")) | 53 | if(obj->inherits("QPushButton")) |
54 | { | 54 | { |
55 | if(!cfg->hasKey((QString)obj->name()+"Label")) | 55 | if(!cfg->hasKey((QString)obj->name()+"Label")) |
56 | { | 56 | { |
57 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); | 57 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | objList = dvdGroupConf->children(); | 62 | objList = dvdGroupConf->children(); |
63 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) | 63 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) |
64 | { | 64 | { |
65 | if(obj->inherits("QPushButton")) | 65 | if(obj->inherits("QPushButton")) |
66 | { | 66 | { |
67 | if(!cfg->hasKey((QString)obj->name()+"Label")) | 67 | if(!cfg->hasKey((QString)obj->name()+"Label")) |
diff --git a/noncore/tools/remote/dvdgroup.cpp b/noncore/tools/remote/dvdgroup.cpp index a75c48a..d7ff515 100644 --- a/noncore/tools/remote/dvdgroup.cpp +++ b/noncore/tools/remote/dvdgroup.cpp | |||
@@ -1,73 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under | 5 | This program is free software; you can redistribute it and/or modify it under |
6 | the terms of the GNU General Public | 6 | the terms of the GNU General Public |
7 | License as published by the Free Software Foundation; either version 2 of the | 7 | License as published by the Free Software Foundation; either version 2 of the |
8 | License, or (at your option) any later | 8 | License, or (at your option) any later |
9 | version. | 9 | version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | 11 | This program is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the | 12 | WARRANTY; without even the |
13 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 | ||
15 | GNU General | 15 | GNU General |
16 | Public License for more details. | 16 | Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License along with | 18 | You should have received a copy of the GNU General Public License along with |
19 | this program; if not, write to the Free | 19 | this program; if not, write to the Free |
20 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "dvdgroup.h" | 23 | #include "dvdgroup.h" |
24 | 24 | ||
25 | DVDGroup::DVDGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 25 | DVDGroup::DVDGroup(QWidget *parent, const char *name):QWidget(parent,name) |
26 | { | 26 | { |
27 | QGridLayout *layout = new QGridLayout(this); | 27 | QGridLayout *layout = new QGridLayout(this); |
28 | 28 | ||
29 | //put rows between the buttons of size 1 | 29 | //put rows between the buttons of size 1 |
30 | layout->addRowSpacing(1,1); | 30 | layout->addRowSpacing(1,1); |
31 | layout->addRowSpacing(3,1); | 31 | layout->addRowSpacing(3,1); |
32 | 32 | ||
33 | //put collumns between the buttons of size 5 | 33 | //put collumns between the buttons of size 5 |
34 | layout->addColSpacing(1,5); | 34 | layout->addColSpacing(1,5); |
35 | layout->addColSpacing(3,5); | 35 | layout->addColSpacing(3,5); |
36 | layout->addColSpacing(5,5); | 36 | layout->addColSpacing(5,5); |
37 | layout->addColSpacing(7,5); | 37 | layout->addColSpacing(7,5); |
38 | 38 | ||
39 | //make sure that the collumns with the buttons in them stretch before the filler collumns do | 39 | //make sure that the collumns with the buttons in them stretch before the filler collumns do |
40 | //since there is so little room, there is no need to do this for the rows | 40 | //since there is so little room, there is no need to do this for the rows |
41 | layout->setColStretch(4,1); | 41 | layout->setColStretch(4,1); |
42 | layout->setColStretch(2,1); | 42 | layout->setColStretch(2,1); |
43 | layout->setColStretch(6,1); | 43 | layout->setColStretch(6,1); |
44 | layout->setColStretch(8,1); | 44 | layout->setColStretch(8,1); |
45 | layout->setColStretch(0,1); | 45 | layout->setColStretch(0,1); |
46 | 46 | ||
47 | //add the menu navigation buttons, and connect them to the RemoteTab slots... | 47 | //add the menu navigation buttons, and connect them to the RemoteTab slots... |
48 | QPushButton *up = new QPushButton("Up", this,"up"); | 48 | QPushButton *up = new QPushButton("Up", this,"up"); |
49 | layout->addWidget(up, 0, 4, 0); | 49 | layout->addWidget(up, 0, 4, 0); |
50 | connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 50 | connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
51 | 51 | ||
52 | QPushButton *down = new QPushButton("Down",this,"down"); | 52 | QPushButton *down = new QPushButton("Down",this,"down"); |
53 | layout->addWidget(down, 4, 4, 0); | 53 | layout->addWidget(down, 4, 4, 0); |
54 | connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 54 | connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
55 | 55 | ||
56 | QPushButton *left = new QPushButton("Left",this,"left"); | 56 | QPushButton *left = new QPushButton("Left",this,"left"); |
57 | layout->addWidget(left, 2, 2, 0); | 57 | layout->addWidget(left, 2, 2, 0); |
58 | connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 58 | connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
59 | 59 | ||
60 | QPushButton *right = new QPushButton("Right", this, "right"); | 60 | QPushButton *right = new QPushButton("Right", this, "right"); |
61 | layout->addWidget(right, 2, 6, 0); | 61 | layout->addWidget(right, 2, 6, 0); |
62 | connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 62 | connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
63 | 63 | ||
64 | QPushButton *enter = new QPushButton("Enter",this,"enter"); | 64 | QPushButton *enter = new QPushButton("Enter",this,"enter"); |
65 | layout->addWidget(enter, 2, 4, 0); | 65 | layout->addWidget(enter, 2, 4, 0); |
66 | connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 66 | connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
67 | 67 | ||
68 | //add some other buttons | 68 | //add some other buttons |
69 | 69 | ||
70 | QPushButton *eject = new QPushButton("Eject", this, "eject"); | 70 | QPushButton *eject = new QPushButton("Eject", this, "eject"); |
71 | layout->addWidget(eject, 0, 0, 0); | 71 | layout->addWidget(eject, 0, 0, 0); |
72 | connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 72 | connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
73 | 73 | ||
diff --git a/noncore/tools/remote/dvdgroupconf.cpp b/noncore/tools/remote/dvdgroupconf.cpp index 5bfe393..2a08ab6 100644 --- a/noncore/tools/remote/dvdgroupconf.cpp +++ b/noncore/tools/remote/dvdgroupconf.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "dvdgroupconf.h" | 17 | #include "dvdgroupconf.h" |
18 | 18 | ||
19 | DVDGroupConf::DVDGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | DVDGroupConf::DVDGroupConf(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QGridLayout *layout = new QGridLayout(this); | 21 | QGridLayout *layout = new QGridLayout(this); |
22 | 22 | ||
23 | //put rows between the buttons of size 1 | 23 | //put rows between the buttons of size 1 |
24 | layout->addRowSpacing(1,1); | 24 | layout->addRowSpacing(1,1); |
25 | layout->addRowSpacing(3,1); | 25 | layout->addRowSpacing(3,1); |
26 | 26 | ||
27 | //put collumns between the buttons of size 5 | 27 | //put collumns between the buttons of size 5 |
28 | layout->addColSpacing(1,5); | 28 | layout->addColSpacing(1,5); |
29 | layout->addColSpacing(3,5); | 29 | layout->addColSpacing(3,5); |
30 | layout->addColSpacing(5,5); | 30 | layout->addColSpacing(5,5); |
31 | layout->addColSpacing(7,5); | 31 | layout->addColSpacing(7,5); |
32 | 32 | ||
33 | //make sure that the collumns with the buttons in them stretch before the filler collumns do | 33 | //make sure that the collumns with the buttons in them stretch before the filler collumns do |
34 | //since there is so little room, there is no need to do this for the rows | 34 | //since there is so little room, there is no need to do this for the rows |
35 | layout->setColStretch(4,1); | 35 | layout->setColStretch(4,1); |
36 | layout->setColStretch(2,1); | 36 | layout->setColStretch(2,1); |
37 | layout->setColStretch(6,1); | 37 | layout->setColStretch(6,1); |
38 | layout->setColStretch(8,1); | 38 | layout->setColStretch(8,1); |
39 | layout->setColStretch(0,1); | 39 | layout->setColStretch(0,1); |
40 | 40 | ||
41 | //add the menu navigation buttons, and connect them to the RemoteTab slots... | 41 | //add the menu navigation buttons, and connect them to the RemoteTab slots... |
42 | QPushButton *up = new QPushButton("Up",this,"up"); | 42 | QPushButton *up = new QPushButton("Up",this,"up"); |
43 | layout->addWidget(up, 0, 4, 0); | 43 | layout->addWidget(up, 0, 4, 0); |
44 | connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 44 | connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
45 | 45 | ||
46 | QPushButton *down = new QPushButton("Down",this,"down"); | 46 | QPushButton *down = new QPushButton("Down",this,"down"); |
47 | layout->addWidget(down, 4, 4, 0); | 47 | layout->addWidget(down, 4, 4, 0); |
48 | connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 48 | connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
49 | 49 | ||
50 | QPushButton *left = new QPushButton("Left",this,"left"); | 50 | QPushButton *left = new QPushButton("Left",this,"left"); |
51 | layout->addWidget(left, 2, 2, 0); | 51 | layout->addWidget(left, 2, 2, 0); |
52 | connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 52 | connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
53 | 53 | ||
54 | QPushButton *right = new QPushButton("Right", this, "right"); | 54 | QPushButton *right = new QPushButton("Right", this, "right"); |
55 | layout->addWidget(right, 2, 6, 0); | 55 | layout->addWidget(right, 2, 6, 0); |
56 | connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 56 | connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
57 | 57 | ||
58 | QPushButton *enter = new QPushButton("Enter",this,"enter"); | 58 | QPushButton *enter = new QPushButton("Enter",this,"enter"); |
59 | layout->addWidget(enter, 2, 4, 0); | 59 | layout->addWidget(enter, 2, 4, 0); |
60 | connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 60 | connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
61 | 61 | ||
62 | //add some other buttons | 62 | //add some other buttons |
63 | 63 | ||
64 | QPushButton *eject = new QPushButton("Eject", this, "eject"); | 64 | QPushButton *eject = new QPushButton("Eject", this, "eject"); |
65 | layout->addWidget(eject, 0, 0, 0); | 65 | layout->addWidget(eject, 0, 0, 0); |
66 | connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 66 | connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
67 | 67 | ||
diff --git a/noncore/tools/remote/learntab.cpp b/noncore/tools/remote/learntab.cpp index 054bc7b..998f449 100644 --- a/noncore/tools/remote/learntab.cpp +++ b/noncore/tools/remote/learntab.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "learntab.h" | 17 | #include "learntab.h" |
18 | 18 | ||
19 | LearnTab::LearnTab(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | LearnTab::LearnTab(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QVBoxLayout *layout = new QVBoxLayout(this); | 21 | QVBoxLayout *layout = new QVBoxLayout(this); |
22 | QString *string = new QString("<qt><h1>Opie-Remote Usage Instructions</h1><p>First, some definitions. A Remote is a remote entry in an lircd.conf file, it represents one remote you want to emulate. A Remote Layout is one entry in your ~/Settings/Remote.conf file. It represents the buttons that you see on your screen. Each button on a Remote Layout can be mapped to any button in a Remote. This way you can have, for example, a vcr remote layout, in which all the play/pause/etc buttons are mapped to the buttons on your vcr's remote. However, most VCR's don't have volume controls, so the volume buttons can be mapped to the volume buttons on your TV.</p><p>The first things you need the lirc and lirc-modules ipkgs. If you installed this from an ipkg, they should already be there, thanks to the wonderful world of dependencies. If not, get them. The next thing you need is an lircd.conf file. you can get these at <a href=http://www.lirc.org/>http://www.lirc.org/</a>. Read the documentation there to figure out how to make your own, if one for your remote doesn't exist, or how to have multiple remotes in one lircd.conf file. Once you have a good lircd.conf file, put it in /etc, kill the lircd daemon (if its running) and do a modprobe lirc_sir. Then, run lircd again.</p><p>The next thing you want to do is to create a remote layout. Go to the config tab, and enter a name for your remote layout in the pulldown menu. Dont use the name Remotes, as that could confuse the app. Hopefully, that will be fixed soon. after entering the name you want to use, press New, and then select the name again from the pulldown menu (another oddity that i hope to fix). Then, press each button that you want to map, and a dialog should appear. Select the remote and button that you want to use, and click OK. Once you are done, go to the Remote tab, and select the new remote from the dropdown menu. It should works fine. If at any time you want to change a remote layout, go to the Config tab, select the layout from the dropdown menu, and change the buttons you want to change.</p><p>This is program is written and maintaned by Thomas (spiralman) Stephens. <a href=mailto:spiralman@softhome.net>spiralman@softhome.net</a>. Or, look for me on #opie or #handhelds.org on irc.openprojects.net.</p></qt>"); | 22 | QString *string = new QString("<qt><h1>Opie-Remote Usage Instructions</h1><p>First, some definitions. A Remote is a remote entry in an lircd.conf file, it represents one remote you want to emulate. A Remote Layout is one entry in your ~/Settings/Remote.conf file. It represents the buttons that you see on your screen. Each button on a Remote Layout can be mapped to any button in a Remote. This way you can have, for example, a vcr remote layout, in which all the play/pause/etc buttons are mapped to the buttons on your vcr's remote. However, most VCR's don't have volume controls, so the volume buttons can be mapped to the volume buttons on your TV.</p><p>The first things you need the lirc and lirc-modules ipkgs. If you installed this from an ipkg, they should already be there, thanks to the wonderful world of dependencies. If not, get them. The next thing you need is an lircd.conf file. you can get these at <a href=http://www.lirc.org/>http://www.lirc.org/</a>. Read the documentation there to figure out how to make your own, if one for your remote doesn't exist, or how to have multiple remotes in one lircd.conf file. Once you have a good lircd.conf file, put it in /etc, kill the lircd daemon (if its running) and do a modprobe lirc_sir. Then, run lircd again.</p><p>The next thing you want to do is to create a remote layout. Go to the config tab, and enter a name for your remote layout in the pulldown menu. Dont use the name Remotes, as that could confuse the app. Hopefully, that will be fixed soon. after entering the name you want to use, press New, and then select the name again from the pulldown menu (another oddity that i hope to fix). Then, press each button that you want to map, and a dialog should appear. Select the remote and button that you want to use, and click OK. Once you are done, go to the Remote tab, and select the new remote from the dropdown menu. It should works fine. If at any time you want to change a remote layout, go to the Config tab, select the layout from the dropdown menu, and change the buttons you want to change.</p><p>This is program is written and maintaned by Thomas (spiralman) Stephens. <a href=mailto:spiralman@softhome.net>spiralman@softhome.net</a>. Or, look for me on #opie or #handhelds.org on irc.openprojects.net.</p></qt>"); |
23 | 23 | ||
24 | QTextView *textView = new QTextView(*string, 0, this); | 24 | QTextView *textView = new QTextView(*string, 0, this); |
25 | layout->addWidget(textView); | 25 | layout->addWidget(textView); |
26 | } | 26 | } |
diff --git a/noncore/tools/remote/mainview.cpp b/noncore/tools/remote/mainview.cpp index 47027fb..a7be9e3 100644 --- a/noncore/tools/remote/mainview.cpp +++ b/noncore/tools/remote/mainview.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "mainview.h" | 17 | #include "mainview.h" |
18 | 18 | ||
19 | MainView::MainView(QWidget *parent, const char *name=0) : QWidget(parent, name) | 19 | MainView::MainView(QWidget *parent, const char *name) : QWidget(parent, name) |
20 | { | 20 | { |
21 | setIcon( Resource::loadPixmap( "remote" ) ); | 21 | setIcon( Resource::loadPixmap( "remote" ) ); |
22 | setCaption(tr("Remote") ); | 22 | setCaption(tr("Remote") ); |
23 | 23 | ||
24 | QVBoxLayout *layout = new QVBoxLayout(this); | 24 | QVBoxLayout *layout = new QVBoxLayout(this); |
25 | QTabWidget *tabs = new QTabWidget(this); | 25 | QTabWidget *tabs = new QTabWidget(this); |
26 | 26 | ||
27 | layout->addWidget(tabs); | 27 | layout->addWidget(tabs); |
28 | 28 | ||
29 | printf("MainView: 1\n"); | 29 | printf("MainView: 1\n"); |
30 | remote = new RemoteTab(tabs); | 30 | remote = new RemoteTab(tabs); |
31 | printf("MainView: 2\n"); | 31 | printf("MainView: 2\n"); |
32 | learn = new LearnTab(tabs); | 32 | learn = new LearnTab(tabs); |
33 | printf("MainView: 3\n"); | 33 | printf("MainView: 3\n"); |
34 | config = new ConfigTab(tabs); | 34 | config = new ConfigTab(tabs); |
35 | printf("MainView: 4\n"); | 35 | printf("MainView: 4\n"); |
36 | connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) ); | 36 | connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) ); |
37 | printf("MainView: 5\n"); | 37 | printf("MainView: 5\n"); |
38 | 38 | ||
39 | remote->setIRSocket(fd); | 39 | remote->setIRSocket(fd); |
40 | 40 | ||
41 | tabs->addTab(remote, tr("Remote") ); | 41 | tabs->addTab(remote, tr("Remote") ); |
42 | tabs->addTab(learn,tr("Learn") ); | 42 | tabs->addTab(learn,tr("Learn") ); |
43 | tabs->addTab(config,tr("Config") ); | 43 | tabs->addTab(config,tr("Config") ); |
44 | 44 | ||
45 | printf("1\n"); | 45 | printf("1\n"); |
46 | cfg = new Config("Remote"); | 46 | cfg = new Config("Remote"); |
47 | printf("2\n"); | 47 | printf("2\n"); |
48 | 48 | ||
49 | remote->setConfig(cfg); | 49 | remote->setConfig(cfg); |
50 | config->setConfig(cfg); | 50 | config->setConfig(cfg); |
51 | } | 51 | } |
52 | 52 | ||
53 | int MainView::getIRSocket() | 53 | int MainView::getIRSocket() |
54 | { | 54 | { |
55 | return fd; | 55 | return fd; |
56 | } | 56 | } |
57 | 57 | ||
58 | void MainView::setIRSocket(int newfd) | 58 | void MainView::setIRSocket(int newfd) |
59 | { | 59 | { |
60 | fd = newfd; | 60 | fd = newfd; |
61 | remote->setIRSocket(fd); | 61 | remote->setIRSocket(fd); |
62 | } | 62 | } |
63 | 63 | ||
64 | void MainView::updateRemotesList() | 64 | void MainView::updateRemotesList() |
65 | { | 65 | { |
66 | remote->updateRemotesList(); | 66 | remote->updateRemotesList(); |
67 | printf("MainView: got remotes changed signal\n"); | 67 | printf("MainView: got remotes changed signal\n"); |
diff --git a/noncore/tools/remote/remotetab.cpp b/noncore/tools/remote/remotetab.cpp index 64b8ee4..5b02e94 100644 --- a/noncore/tools/remote/remotetab.cpp +++ b/noncore/tools/remote/remotetab.cpp | |||
@@ -1,154 +1,154 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "remotetab.h" | 17 | #include "remotetab.h" |
18 | 18 | ||
19 | RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | RemoteTab::RemoteTab(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QVBoxLayout *layout = new QVBoxLayout(this); | 21 | QVBoxLayout *layout = new QVBoxLayout(this); |
22 | 22 | ||
23 | topGroup = new TopGroup(this); | 23 | topGroup = new TopGroup(this); |
24 | //topGroup->setMaximumHeight(22); | 24 | //topGroup->setMaximumHeight(22); |
25 | layout->addWidget(topGroup, 0, 0); | 25 | layout->addWidget(topGroup, 0, 0); |
26 | printf("%d %d", topGroup->width(), topGroup->height()); | 26 | printf("%d %d", topGroup->width(), topGroup->height()); |
27 | 27 | ||
28 | layout->addSpacing(1); | 28 | layout->addSpacing(1); |
29 | 29 | ||
30 | dvdGroup = new DVDGroup(this); | 30 | dvdGroup = new DVDGroup(this); |
31 | //dvdGroup->setMaximumHeight(68); | 31 | //dvdGroup->setMaximumHeight(68); |
32 | layout->addWidget(dvdGroup, 0, 0); | 32 | layout->addWidget(dvdGroup, 0, 0); |
33 | 33 | ||
34 | layout->addSpacing(1); | 34 | layout->addSpacing(1); |
35 | 35 | ||
36 | vcrGroup = new VCRGroup(this); | 36 | vcrGroup = new VCRGroup(this); |
37 | layout->addWidget(vcrGroup, 0, 0); | 37 | layout->addWidget(vcrGroup, 0, 0); |
38 | //vcrGroup->setMaximumHeight(45); | 38 | //vcrGroup->setMaximumHeight(45); |
39 | 39 | ||
40 | layout->addSpacing(1); | 40 | layout->addSpacing(1); |
41 | 41 | ||
42 | channelGroup = new ChannelGroup(this); | 42 | channelGroup = new ChannelGroup(this); |
43 | //channelGroup->setMaximumHeight(91); | 43 | //channelGroup->setMaximumHeight(91); |
44 | layout->addWidget(channelGroup, 0, 0); | 44 | layout->addWidget(channelGroup, 0, 0); |
45 | 45 | ||
46 | this->setMaximumWidth(240); | 46 | this->setMaximumWidth(240); |
47 | 47 | ||
48 | timeout = 0; | 48 | timeout = 0; |
49 | 49 | ||
50 | addr.sun_family=AF_UNIX; | 50 | addr.sun_family=AF_UNIX; |
51 | strcpy(addr.sun_path,"/dev/lircd"); | 51 | strcpy(addr.sun_path,"/dev/lircd"); |
52 | } | 52 | } |
53 | 53 | ||
54 | int RemoteTab::sendIR() | 54 | int RemoteTab::sendIR() |
55 | { | 55 | { |
56 | const QObject *button = sender(); | 56 | const QObject *button = sender(); |
57 | QString string = cfg->readEntry(button->name()); | 57 | QString string = cfg->readEntry(button->name()); |
58 | string+='\n'; | 58 | string+='\n'; |
59 | const char *write_buffer = string.latin1(); | 59 | const char *write_buffer = string.latin1(); |
60 | const char *read_buffer; | 60 | const char *read_buffer; |
61 | bool done=false; | 61 | bool done=false; |
62 | 62 | ||
63 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 63 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
64 | if(fd == -1) | 64 | if(fd == -1) |
65 | { | 65 | { |
66 | QMessageBox *mb = new QMessageBox("Error!", | 66 | QMessageBox *mb = new QMessageBox("Error!", |
67 | "couldnt connect to socket", | 67 | "couldnt connect to socket", |
68 | QMessageBox::NoIcon, | 68 | QMessageBox::NoIcon, |
69 | QMessageBox::Ok, | 69 | QMessageBox::Ok, |
70 | QMessageBox::NoButton, | 70 | QMessageBox::NoButton, |
71 | QMessageBox::NoButton); | 71 | QMessageBox::NoButton); |
72 | mb->exec(); | 72 | mb->exec(); |
73 | perror("RemoteTab::SendIR"); | 73 | perror("RemoteTab::SendIR"); |
74 | return NULL; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
78 | if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) | 78 | if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1) |
79 | { | 79 | { |
80 | QMessageBox *mb = new QMessageBox("Error!", | 80 | QMessageBox *mb = new QMessageBox("Error!", |
81 | "couldnt connect to socket", | 81 | "couldnt connect to socket", |
82 | QMessageBox::NoIcon, | 82 | QMessageBox::NoIcon, |
83 | QMessageBox::Ok, | 83 | QMessageBox::Ok, |
84 | QMessageBox::NoButton, | 84 | QMessageBox::NoButton, |
85 | QMessageBox::NoButton); | 85 | QMessageBox::NoButton); |
86 | mb->exec(); | 86 | mb->exec(); |
87 | perror("RemoteTab::SendIR"); | 87 | perror("RemoteTab::SendIR"); |
88 | } | 88 | } |
89 | 89 | ||
90 | printf("fd2: %d\n", fd); | 90 | printf("fd2: %d\n", fd); |
91 | printf("%s", write_buffer); | 91 | printf("%s", write_buffer); |
92 | 92 | ||
93 | printf("1\n"); | 93 | printf("1\n"); |
94 | printf("%d\n", write(fd, write_buffer, strlen(write_buffer) ) ); | 94 | printf("%d\n", write(fd, write_buffer, strlen(write_buffer) ) ); |
95 | printf("2\n"); | 95 | printf("2\n"); |
96 | while(!done) | 96 | while(!done) |
97 | { | 97 | { |
98 | read_buffer=readPacket(); | 98 | read_buffer=readPacket(); |
99 | printf("%s\n", read_buffer); | 99 | printf("%s\n", read_buffer); |
100 | if(strcasecmp(read_buffer, "END") == 0) | 100 | if(strcasecmp(read_buffer, "END") == 0) |
101 | { | 101 | { |
102 | printf("done reading packet\n"); | 102 | printf("done reading packet\n"); |
103 | done=true; | 103 | done=true; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | std::close(fd); | 106 | ::close(fd); |
107 | } | 107 | } |
108 | 108 | ||
109 | // printf("%s\n", readPacket()); | 109 | // printf("%s\n", readPacket()); |
110 | // printf("%d\n", read(fd, read_buffer,sizeof(read_buffer)) ); | 110 | // printf("%d\n", read(fd, read_buffer,sizeof(read_buffer)) ); |
111 | // printf("%s", read_buffer); | 111 | // printf("%s", read_buffer); |
112 | 112 | ||
113 | //this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html | 113 | //this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html |
114 | const char *RemoteTab::readPacket() | 114 | const char *RemoteTab::readPacket() |
115 | { | 115 | { |
116 | static char buffer[PACKET_SIZE+1]=""; | 116 | static char buffer[PACKET_SIZE+1]=""; |
117 | char *end; | 117 | char *end; |
118 | static int ptr=0,end_len=0; | 118 | static int ptr=0,end_len=0; |
119 | ssize_t ret; | 119 | ssize_t ret; |
120 | 120 | ||
121 | if(ptr>0) | 121 | if(ptr>0) |
122 | { | 122 | { |
123 | memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1); | 123 | memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1); |
124 | ptr=strlen(buffer); | 124 | ptr=strlen(buffer); |
125 | end=strchr(buffer,'\n'); | 125 | end=strchr(buffer,'\n'); |
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
129 | end=NULL; | 129 | end=NULL; |
130 | } | 130 | } |
131 | alarm(TIMEOUT); | 131 | alarm(TIMEOUT); |
132 | while(end==NULL) | 132 | while(end==NULL) |
133 | { | 133 | { |
134 | if(PACKET_SIZE<=ptr) | 134 | if(PACKET_SIZE<=ptr) |
135 | { | 135 | { |
136 | // fprintf(stderr,"%s: bad packet\n",progname); | 136 | // fprintf(stderr,"%s: bad packet\n",progname); |
137 | ptr=0; | 137 | ptr=0; |
138 | return(NULL); | 138 | return(NULL); |
139 | } | 139 | } |
140 | ret=read(fd,buffer+ptr,PACKET_SIZE-ptr); | 140 | ret=read(fd,buffer+ptr,PACKET_SIZE-ptr); |
141 | 141 | ||
142 | if(ret<=0 || timeout) | 142 | if(ret<=0 || timeout) |
143 | { | 143 | { |
144 | if(timeout) | 144 | if(timeout) |
145 | { | 145 | { |
146 | // fprintf(stderr,"%s: timeout\n",progname); | 146 | // fprintf(stderr,"%s: timeout\n",progname); |
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | alarm(0); | 150 | alarm(0); |
151 | } | 151 | } |
152 | ptr=0; | 152 | ptr=0; |
153 | return(NULL); | 153 | return(NULL); |
154 | } | 154 | } |
diff --git a/noncore/tools/remote/topgroup.cpp b/noncore/tools/remote/topgroup.cpp index 94ea622..93cffbb 100644 --- a/noncore/tools/remote/topgroup.cpp +++ b/noncore/tools/remote/topgroup.cpp | |||
@@ -1,54 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "topgroup.h" | 17 | #include "topgroup.h" |
18 | 18 | ||
19 | TopGroup::TopGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | TopGroup::TopGroup(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0); | 21 | QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0); |
22 | 22 | ||
23 | QPushButton *power = new QPushButton("Power",this,"power"); | 23 | QPushButton *power = new QPushButton("Power",this,"power"); |
24 | layout->addWidget(power); | 24 | layout->addWidget(power); |
25 | connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 25 | connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
26 | //power->setGeometry(5, 5,40, 20); | 26 | //power->setGeometry(5, 5,40, 20); |
27 | 27 | ||
28 | layout->addSpacing(5); | 28 | layout->addSpacing(5); |
29 | 29 | ||
30 | QPushButton *source = new QPushButton("Source",this,"source"); | 30 | QPushButton *source = new QPushButton("Source",this,"source"); |
31 | layout->addWidget(source); | 31 | layout->addWidget(source); |
32 | connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 32 | connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
33 | //source->setGeometry(50,5,40,20); | 33 | //source->setGeometry(50,5,40,20); |
34 | 34 | ||
35 | remotes = new QComboBox(false, this, "remotes"); | 35 | remotes = new QComboBox(false, this, "remotes"); |
36 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); | 36 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); |
37 | remotes->insertItem("Select Remote"); | 37 | remotes->insertItem("Select Remote"); |
38 | //remotes->setGeometry(135,5,95,20); | 38 | //remotes->setGeometry(135,5,95,20); |
39 | 39 | ||
40 | QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); | 40 | QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); |
41 | //remoteLabel->setGeometry(90,5,40,20); | 41 | //remoteLabel->setGeometry(90,5,40,20); |
42 | remoteLabel->setAlignment(AlignRight | AlignVCenter); | 42 | remoteLabel->setAlignment(AlignRight | AlignVCenter); |
43 | 43 | ||
44 | layout->addWidget(remoteLabel); | 44 | layout->addWidget(remoteLabel); |
45 | layout->addWidget(remotes); | 45 | layout->addWidget(remotes); |
46 | } | 46 | } |
47 | 47 | ||
48 | void TopGroup::updateRemotes(Config *cfg) | 48 | void TopGroup::updateRemotes(Config *cfg) |
49 | { | 49 | { |
50 | remotes->clear(); | 50 | remotes->clear(); |
51 | remotes->insertItem(QString("SelectRemote")); | 51 | remotes->insertItem(QString("SelectRemote")); |
52 | cfg->setGroup("Remotes"); | 52 | cfg->setGroup("Remotes"); |
53 | remotes->insertStringList(cfg->readListEntry("remoteList", ',') ); | 53 | remotes->insertStringList(cfg->readListEntry("remoteList", ',') ); |
54 | } | 54 | } |
diff --git a/noncore/tools/remote/topgroupconf.cpp b/noncore/tools/remote/topgroupconf.cpp index eb071fb..d763a3a 100644 --- a/noncore/tools/remote/topgroupconf.cpp +++ b/noncore/tools/remote/topgroupconf.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "topgroupconf.h" | 17 | #include "topgroupconf.h" |
18 | 18 | ||
19 | TopGroupConf::TopGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name) | 19 | TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 20 | { |
21 | QHBoxLayout *layout = new QHBoxLayout(this); | 21 | QHBoxLayout *layout = new QHBoxLayout(this); |
22 | 22 | ||
23 | QPushButton *power = new QPushButton("Power",this,"power"); | 23 | QPushButton *power = new QPushButton("Power",this,"power"); |
24 | layout->addWidget(power); | 24 | layout->addWidget(power); |
25 | connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 25 | connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
26 | //power->setGeometry(5, 5,40, 20); | 26 | //power->setGeometry(5, 5,40, 20); |
27 | 27 | ||
28 | layout->addSpacing(5); | 28 | layout->addSpacing(5); |
29 | 29 | ||
30 | QPushButton *source = new QPushButton("Source",this,"source"); | 30 | QPushButton *source = new QPushButton("Source",this,"source"); |
31 | layout->addWidget(source); | 31 | layout->addWidget(source); |
32 | connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 32 | connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
33 | //source->setGeometry(50,5,40,20); | 33 | //source->setGeometry(50,5,40,20); |
34 | 34 | ||
35 | remotes = new QComboBox(true, this, "remotes"); | 35 | remotes = new QComboBox(true, this, "remotes"); |
36 | remotes->insertItem(QString("Remotes")); | 36 | remotes->insertItem(QString("Remotes")); |
37 | layout->addWidget(remotes); | 37 | layout->addWidget(remotes); |
38 | layout->setStretchFactor(remotes, 1); | 38 | layout->setStretchFactor(remotes, 1); |
39 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); | 39 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); |
40 | 40 | ||
41 | 41 | ||
42 | QPushButton *newrem = new QPushButton("New", this, "new"); | 42 | QPushButton *newrem = new QPushButton("New", this, "new"); |
43 | layout->addWidget(newrem); | 43 | layout->addWidget(newrem); |
44 | connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) ); | 44 | connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) ); |
45 | 45 | ||
46 | 46 | ||
47 | /*remotes = new QComboBox(false, this, "remotes"); | 47 | /*remotes = new QComboBox(false, this, "remotes"); |
48 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); | 48 | connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) ); |
49 | remotes->insertItem("Select Remote"); | 49 | remotes->insertItem("Select Remote"); |
50 | //remotes->setGeometry(135,5,95,20); | 50 | //remotes->setGeometry(135,5,95,20); |
51 | 51 | ||
52 | QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); | 52 | QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel"); |
53 | //remoteLabel->setGeometry(90,5,40,20); | 53 | //remoteLabel->setGeometry(90,5,40,20); |
54 | remoteLabel->setAlignment(AlignRight | AlignVCenter); | 54 | remoteLabel->setAlignment(AlignRight | AlignVCenter); |
55 | 55 | ||
56 | layout->addWidget(remoteLabel); | 56 | layout->addWidget(remoteLabel); |
57 | layout->addWidget(remotes); | 57 | layout->addWidget(remotes); |
58 | */ | 58 | */ |
59 | } | 59 | } |
60 | 60 | ||
61 | void TopGroupConf::updateRemotes(QStringList list) | 61 | void TopGroupConf::updateRemotes(QStringList list) |
62 | { | 62 | { |
63 | remotes->insertStringList(list); | 63 | remotes->insertStringList(list); |
64 | } | 64 | } |
65 | 65 | ||
66 | QString TopGroupConf::getRemotesText() | 66 | QString TopGroupConf::getRemotesText() |
67 | { | 67 | { |
diff --git a/noncore/tools/remote/vcrgroup.cpp b/noncore/tools/remote/vcrgroup.cpp index 4f07ca3..10ebe5d 100644 --- a/noncore/tools/remote/vcrgroup.cpp +++ b/noncore/tools/remote/vcrgroup.cpp | |||
@@ -1,73 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under | 5 | This program is free software; you can redistribute it and/or modify it under |
6 | the terms of the GNU General Public | 6 | the terms of the GNU General Public |
7 | License as published by the Free Software Foundation; either version 2 of the | 7 | License as published by the Free Software Foundation; either version 2 of the |
8 | License, or (at your option) any later | 8 | License, or (at your option) any later |
9 | version. | 9 | version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, but WITHOUT ANY | 11 | This program is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the | 12 | WARRANTY; without even the |
13 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 | ||
15 | GNU General | 15 | GNU General |
16 | Public License for more details. | 16 | Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License along with | 18 | You should have received a copy of the GNU General Public License along with |
19 | this program; if not, write to the Free | 19 | this program; if not, write to the Free |
20 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "vcrgroup.h" | 23 | #include "vcrgroup.h" |
24 | 24 | ||
25 | VCRGroup::VCRGroup(QWidget *parent=0, const char *name=0) : QWidget(parent, | 25 | VCRGroup::VCRGroup(QWidget *parent, const char *name) : QWidget(parent, |
26 | name) | 26 | name) |
27 | { | 27 | { |
28 | QVBoxLayout *vlayout = new QVBoxLayout(this); | 28 | QVBoxLayout *vlayout = new QVBoxLayout(this); |
29 | 29 | ||
30 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); | 30 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); |
31 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); | 31 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); |
32 | 32 | ||
33 | vlayout->addLayout(hlayout1); | 33 | vlayout->addLayout(hlayout1); |
34 | vlayout->addSpacing(1); | 34 | vlayout->addSpacing(1); |
35 | vlayout->addLayout(hlayout2); | 35 | vlayout->addLayout(hlayout2); |
36 | 36 | ||
37 | QPushButton *play = new | 37 | QPushButton *play = new |
38 | QPushButton("Play",this, "play"); | 38 | QPushButton("Play",this, "play"); |
39 | hlayout1->addWidget(play); | 39 | hlayout1->addWidget(play); |
40 | connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 40 | connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
41 | 41 | ||
42 | hlayout1->addSpacing(5); | 42 | hlayout1->addSpacing(5); |
43 | 43 | ||
44 | QPushButton *pause = new | 44 | QPushButton *pause = new |
45 | QPushButton("Pause",this, "pause"); | 45 | QPushButton("Pause",this, "pause"); |
46 | hlayout1->addWidget(pause); | 46 | hlayout1->addWidget(pause); |
47 | connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 47 | connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
48 | 48 | ||
49 | hlayout1->addSpacing(5); | 49 | hlayout1->addSpacing(5); |
50 | 50 | ||
51 | QPushButton *stop = new | 51 | QPushButton *stop = new |
52 | QPushButton("Stop",this, "stop"); | 52 | QPushButton("Stop",this, "stop"); |
53 | hlayout1->addWidget(stop); | 53 | hlayout1->addWidget(stop); |
54 | connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 54 | connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
55 | 55 | ||
56 | hlayout1->addSpacing(5); | 56 | hlayout1->addSpacing(5); |
57 | 57 | ||
58 | QPushButton *record = new | 58 | QPushButton *record = new |
59 | QPushButton("Record",this, "record"); | 59 | QPushButton("Record",this, "record"); |
60 | hlayout1->addWidget(record); | 60 | hlayout1->addWidget(record); |
61 | connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 61 | connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
62 | 62 | ||
63 | QPushButton *back = new | 63 | QPushButton *back = new |
64 | QPushButton("Back",this, "back"); | 64 | QPushButton("Back",this, "back"); |
65 | hlayout2->addWidget(back); | 65 | hlayout2->addWidget(back); |
66 | connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 66 | connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
67 | 67 | ||
68 | hlayout2->addSpacing(5); | 68 | hlayout2->addSpacing(5); |
69 | 69 | ||
70 | QPushButton *rewind = new | 70 | QPushButton *rewind = new |
71 | QPushButton("Rewind",this, "rewind"); | 71 | QPushButton("Rewind",this, "rewind"); |
72 | hlayout2->addWidget(rewind); | 72 | hlayout2->addWidget(rewind); |
73 | connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); | 73 | connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) ); |
diff --git a/noncore/tools/remote/vcrgroupconf.cpp b/noncore/tools/remote/vcrgroupconf.cpp index a50ed0a..2158d43 100644 --- a/noncore/tools/remote/vcrgroupconf.cpp +++ b/noncore/tools/remote/vcrgroupconf.cpp | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. | 2 | Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie. |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "vcrgroupconf.h" | 17 | #include "vcrgroupconf.h" |
18 | 18 | ||
19 | VCRGroupConf::VCRGroupConf(QWidget *parent=0, const char *name=0) : QWidget(parent, name) | 19 | VCRGroupConf::VCRGroupConf(QWidget *parent, const char *name) : QWidget(parent, name) |
20 | { | 20 | { |
21 | QVBoxLayout *vlayout = new QVBoxLayout(this); | 21 | QVBoxLayout *vlayout = new QVBoxLayout(this); |
22 | 22 | ||
23 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); | 23 | QHBoxLayout *hlayout1 = new QHBoxLayout(this); |
24 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); | 24 | QHBoxLayout *hlayout2 = new QHBoxLayout(this); |
25 | 25 | ||
26 | vlayout->addLayout(hlayout1); | 26 | vlayout->addLayout(hlayout1); |
27 | vlayout->addSpacing(1); | 27 | vlayout->addSpacing(1); |
28 | vlayout->addLayout(hlayout2); | 28 | vlayout->addLayout(hlayout2); |
29 | 29 | ||
30 | QPushButton *play = new QPushButton("Play",this, "play"); | 30 | QPushButton *play = new QPushButton("Play",this, "play"); |
31 | hlayout1->addWidget(play); | 31 | hlayout1->addWidget(play); |
32 | connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 32 | connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
33 | 33 | ||
34 | hlayout1->addSpacing(5); | 34 | hlayout1->addSpacing(5); |
35 | 35 | ||
36 | QPushButton *pause = new QPushButton("Pause",this, "pause"); | 36 | QPushButton *pause = new QPushButton("Pause",this, "pause"); |
37 | hlayout1->addWidget(pause); | 37 | hlayout1->addWidget(pause); |
38 | connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 38 | connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
39 | 39 | ||
40 | hlayout1->addSpacing(5); | 40 | hlayout1->addSpacing(5); |
41 | 41 | ||
42 | QPushButton *stop = new QPushButton("Stop",this, "stop"); | 42 | QPushButton *stop = new QPushButton("Stop",this, "stop"); |
43 | hlayout1->addWidget(stop); | 43 | hlayout1->addWidget(stop); |
44 | connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 44 | connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
45 | 45 | ||
46 | hlayout1->addSpacing(5); | 46 | hlayout1->addSpacing(5); |
47 | 47 | ||
48 | QPushButton *record = new QPushButton("Record",this, "record"); | 48 | QPushButton *record = new QPushButton("Record",this, "record"); |
49 | hlayout1->addWidget(record); | 49 | hlayout1->addWidget(record); |
50 | connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 50 | connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
51 | 51 | ||
52 | QPushButton *back = new QPushButton("Back",this, "back"); | 52 | QPushButton *back = new QPushButton("Back",this, "back"); |
53 | hlayout2->addWidget(back); | 53 | hlayout2->addWidget(back); |
54 | connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 54 | connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
55 | 55 | ||
56 | hlayout2->addSpacing(5); | 56 | hlayout2->addSpacing(5); |
57 | 57 | ||
58 | QPushButton *rewind = new QPushButton("Rewind",this, "rewind"); | 58 | QPushButton *rewind = new QPushButton("Rewind",this, "rewind"); |
59 | hlayout2->addWidget(rewind); | 59 | hlayout2->addWidget(rewind); |
60 | connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 60 | connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
61 | 61 | ||
62 | hlayout2->addSpacing(5); | 62 | hlayout2->addSpacing(5); |
63 | 63 | ||
64 | QPushButton *ff = new QPushButton("FF",this, "ff"); | 64 | QPushButton *ff = new QPushButton("FF",this, "ff"); |
65 | hlayout2->addWidget(ff); | 65 | hlayout2->addWidget(ff); |
66 | connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); | 66 | connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) ); |
67 | 67 | ||
diff --git a/noncore/unsupported/mail2/libmail/imaphandler.cpp b/noncore/unsupported/mail2/libmail/imaphandler.cpp index 730a004..7493240 100644 --- a/noncore/unsupported/mail2/libmail/imaphandler.cpp +++ b/noncore/unsupported/mail2/libmail/imaphandler.cpp | |||
@@ -125,97 +125,97 @@ QString IMAPHandler::iSubscribe(const QString &mailbox) | |||
125 | .arg(tag()) | 125 | .arg(tag()) |
126 | .arg(escape(mailbox))); | 126 | .arg(escape(mailbox))); |
127 | return tag(false); | 127 | return tag(false); |
128 | } | 128 | } |
129 | 129 | ||
130 | QString IMAPHandler::iUnsubscribe(const QString &mailbox) | 130 | QString IMAPHandler::iUnsubscribe(const QString &mailbox) |
131 | { | 131 | { |
132 | doLogin(); | 132 | doLogin(); |
133 | 133 | ||
134 | _ibase->sendCommand(QString("%1 UNSUBSCRIBE \"%2\"\r\n") | 134 | _ibase->sendCommand(QString("%1 UNSUBSCRIBE \"%2\"\r\n") |
135 | .arg(tag()) | 135 | .arg(tag()) |
136 | .arg(escape(mailbox))); | 136 | .arg(escape(mailbox))); |
137 | return tag(false); | 137 | return tag(false); |
138 | } | 138 | } |
139 | 139 | ||
140 | QString IMAPHandler::iList(const QString &reference, const QString &mailbox) | 140 | QString IMAPHandler::iList(const QString &reference, const QString &mailbox) |
141 | { | 141 | { |
142 | doLogin(); | 142 | doLogin(); |
143 | 143 | ||
144 | _ibase->sendCommand(QString("%1 LIST \"%2\" \"%3\"\r\n") | 144 | _ibase->sendCommand(QString("%1 LIST \"%2\" \"%3\"\r\n") |
145 | .arg(tag()) | 145 | .arg(tag()) |
146 | .arg(escape(reference)) | 146 | .arg(escape(reference)) |
147 | .arg(escape(mailbox))); | 147 | .arg(escape(mailbox))); |
148 | return tag(false); | 148 | return tag(false); |
149 | } | 149 | } |
150 | 150 | ||
151 | QString IMAPHandler::iLsub(const QString &reference, const QString &mailbox) | 151 | QString IMAPHandler::iLsub(const QString &reference, const QString &mailbox) |
152 | { | 152 | { |
153 | doLogin(); | 153 | doLogin(); |
154 | 154 | ||
155 | _ibase->sendCommand(QString("%1 LSUB \"%2\" \"%3\"\r\n") | 155 | _ibase->sendCommand(QString("%1 LSUB \"%2\" \"%3\"\r\n") |
156 | .arg(tag()) | 156 | .arg(tag()) |
157 | .arg(escape(reference)) | 157 | .arg(escape(reference)) |
158 | .arg(escape(mailbox))); | 158 | .arg(escape(mailbox))); |
159 | return tag(false); | 159 | return tag(false); |
160 | } | 160 | } |
161 | 161 | ||
162 | QString IMAPHandler::iStatus(const QString &mailbox, const QString &items) | 162 | QString IMAPHandler::iStatus(const QString &mailbox, const QString &items) |
163 | { | 163 | { |
164 | doLogin(); | 164 | doLogin(); |
165 | 165 | ||
166 | _ibase->sendCommand(QString("%1 STATUS \"%2\" (%3)\r\n") | 166 | _ibase->sendCommand(QString("%1 STATUS \"%2\" (%3)\r\n") |
167 | .arg(tag()) | 167 | .arg(tag()) |
168 | .arg(escape(mailbox)) | 168 | .arg(escape(mailbox)) |
169 | .arg(escape(items))); | 169 | .arg(escape(items))); |
170 | return tag(false); | 170 | return tag(false); |
171 | } | 171 | } |
172 | 172 | ||
173 | QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime = 0) | 173 | QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime) |
174 | { | 174 | { |
175 | doLogin(); | 175 | doLogin(); |
176 | 176 | ||
177 | _ibase->sendCommand(QString("%1 APPEND \"%2\" (%3) \"%4\" {%5}\r\n%6\r\n") | 177 | _ibase->sendCommand(QString("%1 APPEND \"%2\" (%3) \"%4\" {%5}\r\n%6\r\n") |
178 | .arg(tag()) | 178 | .arg(tag()) |
179 | .arg(escape(mailbox)) | 179 | .arg(escape(mailbox)) |
180 | .arg(flags) | 180 | .arg(flags) |
181 | .arg(escape(datetime)) | 181 | .arg(escape(datetime)) |
182 | .arg(literal.length()) | 182 | .arg(literal.length()) |
183 | .arg(literal)); | 183 | .arg(literal)); |
184 | return tag(false); | 184 | return tag(false); |
185 | } | 185 | } |
186 | 186 | ||
187 | QString IMAPHandler::iCheck() | 187 | QString IMAPHandler::iCheck() |
188 | { | 188 | { |
189 | doLogin(); | 189 | doLogin(); |
190 | 190 | ||
191 | _ibase->sendCommand(QString("%1 CHECK\r\n") | 191 | _ibase->sendCommand(QString("%1 CHECK\r\n") |
192 | .arg(tag())); | 192 | .arg(tag())); |
193 | return tag(false); | 193 | return tag(false); |
194 | } | 194 | } |
195 | 195 | ||
196 | QString IMAPHandler::iClose() | 196 | QString IMAPHandler::iClose() |
197 | { | 197 | { |
198 | doLogin(); | 198 | doLogin(); |
199 | 199 | ||
200 | _ibase->sendCommand(QString("%1 CLOSE\r\n") | 200 | _ibase->sendCommand(QString("%1 CLOSE\r\n") |
201 | .arg(tag())); | 201 | .arg(tag())); |
202 | return tag(false); | 202 | return tag(false); |
203 | } | 203 | } |
204 | 204 | ||
205 | QString IMAPHandler::iExpunge() | 205 | QString IMAPHandler::iExpunge() |
206 | { | 206 | { |
207 | doLogin(); | 207 | doLogin(); |
208 | 208 | ||
209 | _ibase->sendCommand(QString("%1 EXPUNGE\r\n") | 209 | _ibase->sendCommand(QString("%1 EXPUNGE\r\n") |
210 | .arg(tag())); | 210 | .arg(tag())); |
211 | return tag(false); | 211 | return tag(false); |
212 | } | 212 | } |
213 | 213 | ||
214 | QString IMAPHandler::iSearch(const QString &search, const QString &charset) | 214 | QString IMAPHandler::iSearch(const QString &search, const QString &charset) |
215 | { | 215 | { |
216 | doLogin(); | 216 | doLogin(); |
217 | 217 | ||
218 | _ibase->sendCommand(QString("%1 SEARCH %2 %3\r\n") | 218 | _ibase->sendCommand(QString("%1 SEARCH %2 %3\r\n") |
219 | .arg(tag()) | 219 | .arg(tag()) |
220 | .arg(charset.isEmpty() ? QString(0) : escape(charset)) | 220 | .arg(charset.isEmpty() ? QString(0) : escape(charset)) |
221 | .arg(search)); | 221 | .arg(search)); |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 7df1d6b..05f2f06 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qaction.h> | 12 | #include <qaction.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qfile.h> | 18 | #include <qfile.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qtextview.h> | 20 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
30 | #include "utils.h" | 30 | #include "utils.h" |
31 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
32 | 32 | ||
33 | 33 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
35 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
36 | // packageListServers( QObject(parent), name ), | 36 | // packageListServers( QObject(parent), name ), |
37 | // packageListSearch( parent, name ), | 37 | // packageListSearch( parent, name ), |
38 | // packageListDocLnk( parent, name ) | 38 | // packageListDocLnk( parent, name ) |
39 | { | 39 | { |
40 | setCaption( tr("Package Manager") ); | 40 | setCaption( tr("Package Manager") ); |
41 | settings = new PackageManagerSettings(this,0,TRUE); | 41 | settings = new PackageManagerSettings(this,0,TRUE); |
42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
43 | setCentralWidget( listViewPackages ); | 43 | setCentralWidget( listViewPackages ); |
44 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 44 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
46 | //listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 46 | //listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
47 | ipkg = new PmIpkg( settings, this ); | 47 | ipkg = new PmIpkg( settings, this ); |
48 | packageListServers.setSettings( settings ); | 48 | packageListServers.setSettings( settings ); |
49 | packageListSearch.setSettings( settings ); | 49 | packageListSearch.setSettings( settings ); |
50 | packageListDocLnk.setSettings( settings ); | 50 | packageListDocLnk.setSettings( settings ); |
51 | pvDebug(9,"packageListServers.update"); | 51 | pvDebug(9,"packageListServers.update"); |
52 | packageListServers.update(); | 52 | packageListServers.update(); |
53 | pvDebug(9,"packageListDocLnk.update"); | 53 | pvDebug(9,"packageListDocLnk.update"); |
54 | pvDebug(0,"no UPDATE of DocLnk"); | 54 | pvDebug(0,"no UPDATE of DocLnk"); |
55 | // packageListDocLnk.update(); | 55 | // packageListDocLnk.update(); |
56 | pvDebug(9,"makeMenu"); | 56 | pvDebug(9,"makeMenu"); |
57 | makeMenu(); | 57 | makeMenu(); |
58 | makeChannel(); | 58 | makeChannel(); |
59 | //opie is hardcoded default ;) | 59 | //opie is hardcoded default ;) |
60 | //pvDebug(9,"section->setCurrentItem"); | 60 | //pvDebug(9,"section->setCurrentItem"); |
61 | // for (int i=0;i<section->count();i++) | 61 | // for (int i=0;i<section->count();i++) |
62 | // if (section->text(i)=="opie") | 62 | // if (section->text(i)=="opie") |
63 | // section->setCurrentItem(i); | 63 | // section->setCurrentItem(i); |
64 | // sectionChanged(); | 64 | // sectionChanged(); |
65 | 65 | ||
66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
68 | 68 | ||
69 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 69 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
70 | SLOT(removeLinks()) ); | 70 | SLOT(removeLinks()) ); |
71 | connect( settings->createLinksButton, SIGNAL( clicked()), | 71 | connect( settings->createLinksButton, SIGNAL( clicked()), |
72 | SLOT(createLinks()) ); | 72 | SLOT(createLinks()) ); |
73 | 73 | ||
74 | pvDebug(9,"displayList"); | 74 | pvDebug(9,"displayList"); |
75 | displayList(); | 75 | displayList(); |
76 | } | 76 | } |
77 | 77 | ||
78 | void MainWindow::makeMenu() | 78 | void MainWindow::makeMenu() |
79 | { | 79 | { |
80 | 80 | ||
81 | QPEToolBar *toolBar = new QPEToolBar( this ); | 81 | QPEToolBar *toolBar = new QPEToolBar( this ); |
82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 97f7813..517b37a 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,117 +1,117 @@ | |||
1 | #include "package.h" | 1 | #include "package.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | 11 | ||
12 | Package::Package( QObject *parent=0, const char *name=0 ) | 12 | Package::Package( QObject *parent, const char *name ) |
13 | : QObject(parent,name) | 13 | : QObject(parent,name) |
14 | { | 14 | { |
15 | 15 | ||
16 | } | 16 | } |
17 | 17 | ||
18 | Package::~Package() | 18 | Package::~Package() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | Package::Package( PackageManagerSettings *s, QObject *parent=0, const char *name=0 ) | 22 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) |
23 | : QObject(parent,name) | 23 | : QObject(parent,name) |
24 | { | 24 | { |
25 | Package(parent,name); | 25 | Package(parent,name); |
26 | init(s); | 26 | init(s); |
27 | } | 27 | } |
28 | 28 | ||
29 | void Package::init( PackageManagerSettings *s ) | 29 | void Package::init( PackageManagerSettings *s ) |
30 | { | 30 | { |
31 | settings = s; | 31 | settings = s; |
32 | _size = ""; | 32 | _size = ""; |
33 | _section = ""; | 33 | _section = ""; |
34 | _subsection = ""; | 34 | _subsection = ""; |
35 | _shortDesc = ""; | 35 | _shortDesc = ""; |
36 | _desc = ""; | 36 | _desc = ""; |
37 | _name = ""; | 37 | _name = ""; |
38 | _toProcess = false; | 38 | _toProcess = false; |
39 | _useFileName = false; | 39 | _useFileName = false; |
40 | _old = false; | 40 | _old = false; |
41 | _status = ""; | 41 | _status = ""; |
42 | _dest = settings->getDestinationName(); | 42 | _dest = settings->getDestinationName(); |
43 | _link = settings->createLinks(); | 43 | _link = settings->createLinks(); |
44 | _versions=0; | 44 | _versions=0; |
45 | _version=""; | 45 | _version=""; |
46 | } | 46 | } |
47 | 47 | ||
48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent=0, const char *name=0 ) | 48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
49 | : QObject(parent,name) | 49 | : QObject(parent,name) |
50 | { | 50 | { |
51 | init(s); | 51 | init(s); |
52 | parsePackage( pack ); | 52 | parsePackage( pack ); |
53 | } | 53 | } |
54 | 54 | ||
55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ) | 55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
56 | { | 56 | { |
57 | init(s); | 57 | init(s); |
58 | if ( !QFile::exists( n ) ) | 58 | if ( !QFile::exists( n ) ) |
59 | { | 59 | { |
60 | _name = QString( n ); | 60 | _name = QString( n ); |
61 | }else{ | 61 | }else{ |
62 | pvDebug(4,"remote file: "+n); | 62 | pvDebug(4,"remote file: "+n); |
63 | parseIpkgFile( n ); | 63 | parseIpkgFile( n ); |
64 | _useFileName = true; | 64 | _useFileName = true; |
65 | _fileName = QString( n ); | 65 | _fileName = QString( n ); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | Package::Package( Package *pi, QObject *parent=0, const char *name=0 ) | 69 | Package::Package( Package *pi, QObject *parent, const char *name ) |
70 | { | 70 | { |
71 | init(pi->settings); | 71 | init(pi->settings); |
72 | copyValues( pi ); | 72 | copyValues( pi ); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void Package::setValue( QString n, QString t ) | 76 | void Package::setValue( QString n, QString t ) |
77 | { | 77 | { |
78 | if ( n == "Package" ) | 78 | if ( n == "Package" ) |
79 | { | 79 | { |
80 | _name = QString( t ); | 80 | _name = QString( t ); |
81 | }else if ( n == "Installed-Size" ) | 81 | }else if ( n == "Installed-Size" ) |
82 | { | 82 | { |
83 | _size = t; | 83 | _size = t; |
84 | // }else if ( n == "Priority") | 84 | // }else if ( n == "Priority") |
85 | // { | 85 | // { |
86 | 86 | ||
87 | }else if ( n == "Section") | 87 | }else if ( n == "Section") |
88 | { | 88 | { |
89 | setSection( t ); | 89 | setSection( t ); |
90 | // }else if ( n == "Maintainer") | 90 | // }else if ( n == "Maintainer") |
91 | // { | 91 | // { |
92 | // | 92 | // |
93 | // }else if ( n == "Architecture") | 93 | // }else if ( n == "Architecture") |
94 | // { | 94 | // { |
95 | 95 | ||
96 | }else if ( n == "Version") | 96 | }else if ( n == "Version") |
97 | { | 97 | { |
98 | _version = t; | 98 | _version = t; |
99 | // }else if ( n == "Pre-Depends") | 99 | // }else if ( n == "Pre-Depends") |
100 | // { | 100 | // { |
101 | // | 101 | // |
102 | // }else if ( n == "Depends") | 102 | // }else if ( n == "Depends") |
103 | // { | 103 | // { |
104 | 104 | ||
105 | }else if ( n == "Filename") | 105 | }else if ( n == "Filename") |
106 | { | 106 | { |
107 | _fileName = t; | 107 | _fileName = t; |
108 | // }else if ( n == "Size") | 108 | // }else if ( n == "Size") |
109 | // { | 109 | // { |
110 | // | 110 | // |
111 | //}else if ( n == "MD5Sum") | 111 | //}else if ( n == "MD5Sum") |
112 | //{ | 112 | //{ |
113 | 113 | ||
114 | }else if ( n == "Description") | 114 | }else if ( n == "Description") |
115 | { | 115 | { |
116 | setDesc( t ); | 116 | setDesc( t ); |
117 | }else if ( n == "Status") | 117 | }else if ( n == "Status") |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 3cc0443..e445570 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | #include "packagelist.h" | 1 | #include "packagelist.h" |
2 | 2 | ||
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | 7 | ||
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | 9 | ||
10 | static QDict<Package> *packageListAll; | 10 | static QDict<Package> *packageListAll; |
11 | static int packageListAllRefCount = 0; | 11 | static int packageListAllRefCount = 0; |
12 | 12 | ||
13 | PackageList::PackageList(QObject *parent=0, const char *name=0) | 13 | PackageList::PackageList(QObject *parent, const char *name) |
14 | : QObject(parent,name), packageIter( packageList ) | 14 | : QObject(parent,name), packageIter( packageList ) |
15 | { | 15 | { |
16 | empty=true; | 16 | empty=true; |
17 | if (!packageListAll) packageListAll = new QDict<Package>(); | 17 | if (!packageListAll) packageListAll = new QDict<Package>(); |
18 | packageListAllRefCount++; | 18 | packageListAllRefCount++; |
19 | sections << "All"; | 19 | sections << "All"; |
20 | subSections.insert("All", new QStringList() ); | 20 | subSections.insert("All", new QStringList() ); |
21 | QStringList *ss = subSections["All"]; | 21 | QStringList *ss = subSections["All"]; |
22 | *ss << "All"; | 22 | *ss << "All"; |
23 | aktSection = "All"; | 23 | aktSection = "All"; |
24 | aktSubSection = "All"; | 24 | aktSubSection = "All"; |
25 | } | 25 | } |
26 | 26 | ||
27 | PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) | 27 | PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) |
28 | : QObject(parent,name), packageIter( packageList ) | 28 | : QObject(parent,name), packageIter( packageList ) |
29 | { | 29 | { |
30 | settings = s; | 30 | settings = s; |
31 | PackageList(parent, name); | 31 | PackageList(parent, name); |
32 | } | 32 | } |
33 | 33 | ||
34 | PackageList::~PackageList() | 34 | PackageList::~PackageList() |
35 | { | 35 | { |
36 | if (--packageListAllRefCount < 1 ) delete packageListAll; | 36 | if (--packageListAllRefCount < 1 ) delete packageListAll; |
37 | } | 37 | } |
38 | 38 | ||
39 | /** Inserts a package into the list */ | 39 | /** Inserts a package into the list */ |
40 | void PackageList::insertPackage( Package* pack ) | 40 | void PackageList::insertPackage( Package* pack ) |
41 | { | 41 | { |
42 | if (!pack) return; | 42 | if (!pack) return; |
43 | Package* p = packageListAll->find( pack->name() ); | 43 | Package* p = packageListAll->find( pack->name() ); |
44 | if ( p ) | 44 | if ( p ) |
45 | { | 45 | { |
46 | if ( (p->version() == pack->version()) | 46 | if ( (p->version() == pack->version()) |
47 | // && (p->dest() == pack->dest()) | 47 | // && (p->dest() == pack->dest()) |
48 | ) | 48 | ) |
49 | { | 49 | { |
50 | p->copyValues( pack ); | 50 | p->copyValues( pack ); |
51 | delete pack; | 51 | delete pack; |
52 | pack = p; | 52 | pack = p; |
53 | } else { | 53 | } else { |
54 | QDict<Package> *packver = p->getOtherVersions(); | 54 | QDict<Package> *packver = p->getOtherVersions(); |
55 | // p->setName( pack->name()+"["+p->version()+"]" ); | 55 | // p->setName( pack->name()+"["+p->version()+"]" ); |
56 | if (!packver) | 56 | if (!packver) |
57 | { | 57 | { |
58 | packver = new QDict<Package>(); | 58 | packver = new QDict<Package>(); |
59 | packver->insert( pack->name(), p ); | 59 | packver->insert( pack->name(), p ); |
60 | p->setOtherVersions( packver ); | 60 | p->setOtherVersions( packver ); |
61 | } | 61 | } |
@@ -152,70 +152,70 @@ void PackageList::updateSections( Package* pack ) | |||
152 | *subsecs += "All"; | 152 | *subsecs += "All"; |
153 | } | 153 | } |
154 | QStringList *subsecs = subSections[s]; | 154 | QStringList *subsecs = subSections[s]; |
155 | *subsecs += ss; | 155 | *subsecs += ss; |
156 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 156 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
157 | subsecs = subSections["All"]; | 157 | subsecs = subSections["All"]; |
158 | *subsecs += ss; | 158 | *subsecs += ss; |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void PackageList::readFileEntries( QString filename, QString dest ) | 162 | void PackageList::readFileEntries( QString filename, QString dest ) |
163 | { | 163 | { |
164 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 164 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
165 | QStringList packEntry; | 165 | QStringList packEntry; |
166 | QFile f( filename ); | 166 | QFile f( filename ); |
167 | if ( !f.open(IO_ReadOnly) ) return; | 167 | if ( !f.open(IO_ReadOnly) ) return; |
168 | QTextStream *statusStream = new QTextStream( &f ); | 168 | QTextStream *statusStream = new QTextStream( &f ); |
169 | while ( !statusStream ->eof() ) | 169 | while ( !statusStream ->eof() ) |
170 | { | 170 | { |
171 | QString line = statusStream->readLine(); | 171 | QString line = statusStream->readLine(); |
172 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 172 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
173 | { | 173 | { |
174 | //end of package | 174 | //end of package |
175 | if ( ! packEntry.isEmpty() ) | 175 | if ( ! packEntry.isEmpty() ) |
176 | { | 176 | { |
177 | Package *p = new Package( packEntry, settings ); | 177 | Package *p = new Package( packEntry, settings ); |
178 | if ( p ) | 178 | if ( p ) |
179 | { | 179 | { |
180 | p->setDest( dest ); | 180 | p->setDest( dest ); |
181 | insertPackage( p ); | 181 | insertPackage( p ); |
182 | packEntry.clear(); | 182 | packEntry.clear(); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | }else{ | 185 | }else{ |
186 | packEntry << line; | 186 | packEntry << line; |
187 | }; | 187 | }; |
188 | } | 188 | } |
189 | delete statusStream; | 189 | delete statusStream; |
190 | return; | 190 | return; |
191 | } | 191 | } |
192 | 192 | ||
193 | void PackageList::setSettings( PackageManagerSettings *s ) | 193 | void PackageList::setSettings( PackageManagerSettings *s ) |
194 | { | 194 | { |
195 | settings = s; | 195 | settings = s; |
196 | } | 196 | } |
197 | 197 | ||
198 | Package* PackageList::getByName( QString n ) | 198 | Package* PackageList::getByName( QString n ) |
199 | { | 199 | { |
200 | origPackageList[n]; | 200 | return origPackageList[n]; |
201 | } | 201 | } |
202 | 202 | ||
203 | void PackageList::clear() | 203 | void PackageList::clear() |
204 | { | 204 | { |
205 | origPackageList.clear(); | 205 | origPackageList.clear(); |
206 | packageList.clear(); | 206 | packageList.clear(); |
207 | } | 207 | } |
208 | 208 | ||
209 | void PackageList::allPackages() | 209 | void PackageList::allPackages() |
210 | { | 210 | { |
211 | packageList.clear(); | 211 | packageList.clear(); |
212 | QDictIterator<Package> filterIter( origPackageList ); | 212 | QDictIterator<Package> filterIter( origPackageList ); |
213 | filterIter.toFirst(); | 213 | filterIter.toFirst(); |
214 | Package *pack= filterIter.current() ; | 214 | Package *pack= filterIter.current() ; |
215 | while ( pack ) | 215 | while ( pack ) |
216 | { | 216 | { |
217 | packageList.insert( pack->name(), pack ); | 217 | packageList.insert( pack->name(), pack ); |
218 | ++filterIter; | 218 | ++filterIter; |
219 | pack = filterIter.current(); | 219 | pack = filterIter.current(); |
220 | } | 220 | } |
221 | } | 221 | } |
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index b42cfdd..deb8a6d 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp | |||
@@ -1,45 +1,45 @@ | |||
1 | 1 | ||
2 | #include "packagelistdoclnk.h" | 2 | #include "packagelistdoclnk.h" |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | 7 | ||
8 | #include "package.h" | 8 | #include "package.h" |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | 10 | ||
11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent=0, const char *name=0) | 11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) |
12 | : PackageList(s) | 12 | : PackageList(s) |
13 | { | 13 | { |
14 | PackageListDocLnk(parent, name); | 14 | PackageListDocLnk(parent, name); |
15 | } | 15 | } |
16 | 16 | ||
17 | PackageListDocLnk::PackageListDocLnk(QObject *parent=0, const char *name=0) | 17 | PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) |
18 | : PackageList(parent, name) | 18 | : PackageList(parent, name) |
19 | { | 19 | { |
20 | Config cfg( "oipkg", Config::User ); | 20 | Config cfg( "oipkg", Config::User ); |
21 | cfg.setGroup( "Common" ); | 21 | cfg.setGroup( "Common" ); |
22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); | 22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); |
23 | pvDebug(2,"opening DocLnkSet "+docLnkDir); | 23 | pvDebug(2,"opening DocLnkSet "+docLnkDir); |
24 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); | 24 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); |
25 | } | 25 | } |
26 | 26 | ||
27 | PackageListDocLnk::~PackageListDocLnk() | 27 | PackageListDocLnk::~PackageListDocLnk() |
28 | { | 28 | { |
29 | Config cfg( "oipkg", Config::User ); | 29 | Config cfg( "oipkg", Config::User ); |
30 | cfg.setGroup( "Common" ); | 30 | cfg.setGroup( "Common" ); |
31 | cfg.writeEntry( "docLnkDir", docLnkDir ); | 31 | cfg.writeEntry( "docLnkDir", docLnkDir ); |
32 | delete doclnkset; | 32 | delete doclnkset; |
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | void PackageListDocLnk::update() | 37 | void PackageListDocLnk::update() |
38 | { | 38 | { |
39 | pvDebug(2,"PackageListDocLnk::update "); | 39 | pvDebug(2,"PackageListDocLnk::update "); |
40 | QList<DocLnk> packlist = doclnkset->children(); | 40 | QList<DocLnk> packlist = doclnkset->children(); |
41 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) | 41 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) |
42 | { | 42 | { |
43 | insertPackage( new Package(pack->file(), settings ) ); | 43 | insertPackage( new Package(pack->file(), settings ) ); |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 0c9c676..7c54441 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -114,53 +114,53 @@ QPixmap PackageListItem::statePixmap() const | |||
114 | } | 114 | } |
115 | else | 115 | else |
116 | { | 116 | { |
117 | if (verinstalled) return *pm_uninstalled_installed_old; | 117 | if (verinstalled) return *pm_uninstalled_installed_old; |
118 | else return *pm_uninstalled; | 118 | else return *pm_uninstalled; |
119 | } | 119 | } |
120 | else | 120 | else |
121 | if (old) return *pm_installed_old; | 121 | if (old) return *pm_installed_old; |
122 | else return *pm_installed; | 122 | else return *pm_installed; |
123 | } else { //toProcess() == true | 123 | } else { //toProcess() == true |
124 | if ( !installed ) | 124 | if ( !installed ) |
125 | return *pm_install; | 125 | return *pm_install; |
126 | else | 126 | else |
127 | return *pm_uninstall; | 127 | return *pm_uninstall; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | QString PackageListItem::key( int column, bool ascending ) const | 131 | QString PackageListItem::key( int column, bool ascending ) const |
132 | { | 132 | { |
133 | if ( column == 2 ) { | 133 | if ( column == 2 ) { |
134 | QString t = text(2); | 134 | QString t = text(2); |
135 | double bytes=t.toDouble(); | 135 | double bytes=t.toDouble(); |
136 | if ( t.contains('M') ) bytes*=1024*1024; | 136 | if ( t.contains('M') ) bytes*=1024*1024; |
137 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; | 137 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; |
138 | if ( !ascending ) bytes=999999999-bytes; | 138 | if ( !ascending ) bytes=999999999-bytes; |
139 | return QString().sprintf("%09d",(int)bytes); | 139 | return QString().sprintf("%09d",(int)bytes); |
140 | } else { | 140 | } else { |
141 | return QListViewItem::key(column,ascending); | 141 | return QListViewItem::key(column,ascending); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | void PackageListItem::setOn( bool b ) | 145 | void PackageListItem::setOn( bool b ) |
146 | { | 146 | { |
147 | QCheckListItem::setOn( b ); | 147 | QCheckListItem::setOn( b ); |
148 | package->toggleProcess(); | 148 | package->toggleProcess(); |
149 | package->setLink( settings->createLinks() ); | 149 | package->setLink( settings->createLinks() ); |
150 | displayDetails(); | 150 | displayDetails(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void PackageListItem::displayDetails() | 153 | void PackageListItem::displayDetails() |
154 | { | 154 | { |
155 | QString sod; | 155 | QString sod; |
156 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); | 156 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); |
157 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); | 157 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); |
158 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); | 158 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); |
159 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); | 159 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); |
160 | setText(0, package->name()+sod ); | 160 | setText(0, package->name()+sod ); |
161 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); | 161 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); |
162 | linkItem->setText( 0, QObject::tr("Link: ")+package->link()?QObject::tr("Yes"):QObject::tr("No")); | 162 | linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); |
163 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | 163 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); |
164 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); | 164 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); |
165 | repaint(); | 165 | repaint(); |
166 | } | 166 | } |
diff --git a/noncore/unsupported/qpdf/fixed.h b/noncore/unsupported/qpdf/fixed.h index d073421..ec0e696 100644 --- a/noncore/unsupported/qpdf/fixed.h +++ b/noncore/unsupported/qpdf/fixed.h | |||
@@ -124,68 +124,68 @@ private: | |||
124 | friend long int lrint ( const fixed &f ); | 124 | friend long int lrint ( const fixed &f ); |
125 | friend fixed sqrt ( const fixed &f ); | 125 | friend fixed sqrt ( const fixed &f ); |
126 | friend fixed fabs ( const fixed &f ); | 126 | friend fixed fabs ( const fixed &f ); |
127 | #endif | 127 | #endif |
128 | }; | 128 | }; |
129 | 129 | ||
130 | 130 | ||
131 | template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); } | 131 | template <unsigned int SH> inline fixed<SH> operator + ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) + f. m_f, true ); } |
132 | template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); } | 132 | template <unsigned int SH> inline fixed<SH> operator - ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f( i ) - f. m_f, true ); } |
133 | template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); } | 133 | template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); } |
134 | template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::div ( fixed<SH>::i2f( i ), f. m_f ), true ); } | 134 | template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::div ( fixed<SH>::i2f( i ), f. m_f ), true ); } |
135 | //template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f ( i / fixed<SH>::f2i ( f. m_f )), true ); } | 135 | //template <unsigned int SH> inline fixed<SH> operator / ( int i, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::i2f ( i / fixed<SH>::f2i ( f. m_f )), true ); } |
136 | 136 | ||
137 | template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); } | 137 | template <unsigned int SH> inline fixed<SH> operator + ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) + f. m_f, true ); } |
138 | template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); } | 138 | template <unsigned int SH> inline fixed<SH> operator - ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::d2f( d ) - f. m_f, true ); } |
139 | template <unsigned int SH> inline fixed<SH> operator * ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } | 139 | template <unsigned int SH> inline fixed<SH> operator * ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } |
140 | template <unsigned int SH> inline fixed<SH> operator / ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } | 140 | template <unsigned int SH> inline fixed<SH> operator / ( double d, const fixed<SH> &f ) { return fixed<SH> ( fixed<SH>::mul ( fixed<SH>::d2f( d ), f. m_f ), true ); } |
141 | 141 | ||
142 | template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; } | 142 | template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; } |
143 | template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; } | 143 | template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; } |
144 | template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; } | 144 | template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; } |
145 | template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; } | 145 | template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; } |
146 | template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; } | 146 | template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; } |
147 | template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; } | 147 | template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; } |
148 | 148 | ||
149 | template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; } | 149 | template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; } |
150 | template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; } | 150 | template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; } |
151 | template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; } | 151 | template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; } |
152 | template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; } | 152 | template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; } |
153 | template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; } | 153 | template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; } |
154 | template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; } | 154 | template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; } |
155 | 155 | ||
156 | template <unsigned int SH> inline long int lrint ( const fixed<SH> &f ) | 156 | template <unsigned int SH> inline long int lrint ( const fixed<SH> &f ) |
157 | { | 157 | { |
158 | return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 ))); | 158 | return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 ))); |
159 | } | 159 | } |
160 | 160 | ||
161 | template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f ) | 161 | template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f ) |
162 | { | 162 | { |
163 | return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f; | 163 | return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f; |
164 | } | 164 | } |
165 | 165 | ||
166 | // roughly from QPE / qmath.h | 166 | // roughly from QPE / qmath.h |
167 | template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f ) | 167 | template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f ) |
168 | { | 168 | { |
169 | if ( f. m_f <= 0 ) | 169 | if ( f. m_f <= 0 ) |
170 | return fixed<SH> ( 0, true ); | 170 | return fixed<SH> ( 0, true ); |
171 | 171 | ||
172 | fixed<SH>::fix_t a0 = 0; | 172 | typename fixed<SH>::fix_t a0 = 0; |
173 | fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation | 173 | typename fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation |
174 | 174 | ||
175 | do { | 175 | do { |
176 | a0 = a1; | 176 | a0 = a1; |
177 | a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1; | 177 | a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1; |
178 | } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 ); | 178 | } while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 ); |
179 | 179 | ||
180 | return fixed<SH> ( a1, true ); | 180 | return fixed<SH> ( a1, true ); |
181 | } | 181 | } |
182 | 182 | ||
183 | #if 0 // no std::ostream needed in OPIE | 183 | #if 0 // no std::ostream needed in OPIE |
184 | template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) | 184 | template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f ) |
185 | { | 185 | { |
186 | o << double( f ); | 186 | o << double( f ); |
187 | return o; | 187 | return o; |
188 | } | 188 | } |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | #endif | 191 | #endif |