summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/cardmon/cardmon.cpp4
-rw-r--r--core/applets/vmemo/vmemo.cpp1
-rw-r--r--libopie/ofileselector.cc4
-rw-r--r--noncore/net/opieftp/opieftp.cpp8
-rw-r--r--noncore/settings/sound/soundsettings.cpp4
-rw-r--r--noncore/tools/opie-sh/fviewer.cpp2
-rw-r--r--noncore/tools/opie-sh/inputdialog.cpp3
-rw-r--r--noncore/tools/opie-sh/mbox.cpp2
-rw-r--r--noncore/tools/opie-sh/opie-sh.cpp3
-rw-r--r--noncore/tools/remote/buttondialog.cpp10
-rw-r--r--noncore/tools/remote/channelgroup.cpp2
-rw-r--r--noncore/tools/remote/channelgroupconf.cpp2
-rw-r--r--noncore/tools/remote/configtab.cpp2
-rw-r--r--noncore/tools/remote/dvdgroup.cpp2
-rw-r--r--noncore/tools/remote/dvdgroupconf.cpp2
-rw-r--r--noncore/tools/remote/learntab.cpp2
-rw-r--r--noncore/tools/remote/mainview.cpp2
-rw-r--r--noncore/tools/remote/remotetab.cpp8
-rw-r--r--noncore/tools/remote/topgroup.cpp2
-rw-r--r--noncore/tools/remote/topgroupconf.cpp2
-rw-r--r--noncore/tools/remote/vcrgroup.cpp2
-rw-r--r--noncore/tools/remote/vcrgroupconf.cpp2
-rw-r--r--noncore/unsupported/mail2/libmail/imaphandler.cpp2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp2
-rw-r--r--noncore/unsupported/oipkg/package.cpp10
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp4
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp4
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp2
-rw-r--r--noncore/unsupported/qpdf/fixed.h4
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 * ) {
QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
QSize s = menu->sizeHint ( );
int opt = menu->exec( QPoint (
p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
p. y ( ) - s. height ( ) ), 0);
if ( opt == 1 ) {
cmd = "/sbin/cardctl eject 0";
err = system( (const char *) cmd );
if ( ( err == 127 ) || ( err < 0 ) ) {
qDebug("Could not execute `/sbin/cardctl eject 0'! err=%d", err);
popUp( tr("CF/PCMCIA card eject failed!"));
}
} else if ( opt == 0 ) {
cmd = "/etc/sdcontrol compeject";
err = system( (const char *) cmd );
if ( ( err != 0 ) ) {
qDebug("Could not execute `/etc/sdcontrol comeject'! err=%d", err);
popUp( tr("SD/MMC card eject failed!"));
}
} else if ( opt == 2 ) {
cmd = "/sbin/cardctl eject 1";
err = system( (const char *) cmd );
if ( ( err == 127 ) || ( err < 0 ) ) {
qDebug("Could not execute `/sbin/cardctl eject 1'! err=%d", err);
popUp( tr("CF/PCMCIA card eject failed!"));
}
}
delete menu;
}
void CardMonitor::cardMessage( const QCString &msg, const QByteArray & ) {
if ( msg == "stabChanged()" ) {
// qDebug("Pcmcia: stabchanged");
if ( getStatusPcmcia() ) {
repaint(FALSE);
}
} else if ( msg == "mtabChanged()" ) {
// qDebug("Pcmcia: mtabchanged");
if ( getStatusSd() ) {
repaint(FALSE);
}
}
}
-bool CardMonitor::getStatusPcmcia( int showPopUp = FALSE ) {
+bool CardMonitor::getStatusPcmcia( int showPopUp ) {
bool cardWas0 = cardInPcmcia0; // remember last state
bool cardWas1 = cardInPcmcia1;
QString fileName;
// one of these 3 files should exist
if (QFile::exists("/var/run/stab")) {
fileName = "/var/run/stab";
} else if (QFile::exists("/var/state/pcmcia/stab")) {
fileName="/var/state/pcmcia/stab";
} else {
fileName="/var/lib/pcmcia/stab";
}
QFile f(fileName);
if ( f.open(IO_ReadOnly) ) {
QStringList list;
QTextStream stream ( &f);
QString streamIn;
streamIn = stream.read();
list = QStringList::split("\n", streamIn);
for(QStringList::Iterator line=list.begin(); line!=list.end(); line++) {
if( (*line).startsWith("Socket 0:") ){
if( (*line).startsWith("Socket 0: empty") && cardInPcmcia0 ){
cardInPcmcia0 = FALSE;
} else if ( !(*line).startsWith("Socket 0: empty") && !cardInPcmcia0 ){
cardInPcmcia0Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 );
cardInPcmcia0Name.stripWhiteSpace();
cardInPcmcia0 = TRUE;
show();
}
}
if( (*line).startsWith("Socket 1:") ){
if( (*line).startsWith("Socket 1: empty") && cardInPcmcia1 ){
cardInPcmcia1 = FALSE;
} else if ( !(*line).startsWith("Socket 1: empty") && !cardInPcmcia1 ){
cardInPcmcia1Name = (*line).mid(((*line).find(':')+1), (*line).length()-9 );
cardInPcmcia1Name.stripWhiteSpace();
cardInPcmcia1 = TRUE;
show();
}
}
}
} else {
// no file found
qDebug("no file found");
cardInPcmcia0 = FALSE;
cardInPcmcia1 = FALSE;
return FALSE;
}
if(!cardInPcmcia0 && !cardInPcmcia1) {
qDebug("Pcmcia: no cards");
}
if( !showPopUp && (cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1)) {
QString text = "";
if(cardWas0 != cardInPcmcia0) {
if(cardInPcmcia0) { text += tr("New card: "); }
else { text += tr("Ejected: "); }
text += cardInPcmcia0Name;
}
if(cardWas0 != cardInPcmcia0 && cardWas1 != cardInPcmcia1) {
text += "\n";
}
if(cardWas1 != cardInPcmcia1) {
if(cardInPcmcia1) { text += tr("New card: "); }
else { text += tr("Ejected: "); }
text += cardInPcmcia1Name;
}
popUp( text );
}
f.close();
return ((cardWas0 == cardInPcmcia0 || cardWas1 == cardInPcmcia1) ? FALSE : TRUE);
}
-bool CardMonitor::getStatusSd( int showPopUp = FALSE ) {
+bool CardMonitor::getStatusSd( int showPopUp ) {
bool cardWas=cardInSd; // remember last state
cardInSd=false;
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
struct mntent *me;
FILE *mntfp = setmntent( "/etc/mtab", "r" );
if ( mntfp ) {
while ( (me = getmntent( mntfp )) != 0 ) {
QString fs = me->mnt_fsname;
if ( fs.left(7)=="/dev/sd" || fs.left(9) == "/dev/mmcd" ) {
cardInSd=true;
}
}
endmntent( mntfp );
}
if(!showPopUp && cardWas != cardInSd) {
QString text = "";
if(cardInSd) { text += "SD Inserted"; }
else { text += "SD Removed"; }
popUp( text );
}
#else
#error "Not on Linux"
#endif
return ((cardWas == cardInSd) ? FALSE : TRUE);
}
void CardMonitor::paintEvent( QPaintEvent * ) {
QPainter p( this );
if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) {
p.drawPixmap( 0, 0, pm );
show();
} else {
p.eraseRect( rect() );
hide();
}
}
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)
::close(dsp);
fileName = fileName.left(fileName.length()-4);
// if(useAlerts)
// QMessageBox::message("Vmemo"," Done1 recording\n"+ fileName);
qDebug("done recording "+fileName);
QSound::play(Resource::findSound("vmemoe"));
Config cfg("qpe");
cfg.setGroup("Volume");
QString foo = cfg.readEntry("Mute","TRUE");
if(foo.find("TRUE",0,TRUE) != -1)
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute
}
int VMemo::setToggleButton(int tog) {
for( int i=0; i < 10;i++) {
switch (tog) {
case 0:
return -1;
break;
case 1:
return 0;
break;
case 2:
return Key_Escape;
break;
case 3:
return Key_Space;
break;
case 4:
return Key_F12;
break;
case 5:
return Key_F9;
break;
case 6:
return Key_F10;
break;
case 7:
return Key_F11;
break;
case 8:
return Key_F13;
break;
};
}
+ return -1;
}
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 {
}
bool isDir()const{
return dir;
}
QString path()const{
return text(1 );
}
QString key(int id, bool )const {
QString ke;
if( id == 0 || id == 1 ){ // name
if( dir ){
ke.append("0" );
ke.append( text(1) );
}else{
ke.append("1" );
ke.append( text(1) );
}
}else if( id == 2 ){ // size
return text(2);
}else if( id == 3 ){ // date
return text(3);
}
return ke;
};
private:
bool mLocked:1;
bool dir:1;
QString m_dir;
};
};
OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
const QString &dirName,
const QString &fileName,
const QStringList &mimeTypes )
: QWidget( wid, "OFileSelector")
{
m_mimetypes = mimeTypes;
initVars();
m_mode = mode;
m_selector = selector;
m_currentDir = dirName;
init();
QTimer::singleShot(6*1000, this, SLOT( slotTest() ) );
}
OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
- const char *name, bool newVisible = TRUE,
- bool closeVisible = FALSE )
+ const char *name, bool newVisible,
+ bool closeVisible )
: QWidget( parent, name )
{
m_mimetypes = QStringList::split(";", mimeFilter );
initVars();
m_currentDir = QPEApplication::documentDir();
m_mode = OPEN;
m_selector = NORMAL;
m_shClose = closeVisible;
m_shNew = newVisible;
m_shLne = false;
m_shPerm = false;
m_shYesNo = false;
init();
}
OFileSelector::~OFileSelector()
{
}
void OFileSelector::setNewVisible( bool visible )
{
m_shNew = visible;
if( m_selector == NORMAL ){
delete m_select;
// we need to initialize but keep the selected mimetype
QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ;
m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") ,
m_stack, "fileselector",
m_shNew, m_shClose);
connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
//connect to close me and other signals as well
m_stack->addWidget( m_select, NORMAL );
}else{
m_new->show();
}
}
void OFileSelector::setCloseVisible( bool visible )
{
m_shClose = visible;
if( m_selector == NORMAL ){
setNewVisible( m_shNew ); // yeah baby
}else{
m_close->show();
}
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()
void OpieFtp::localUpload()
{
int fsz;
// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
QListViewItemIterator it( Local_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
QFileInfo fi(localFile);
if( !fi.isDir()) {
fsz=fi.size();
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
} else {
QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
} //end currentSelected
}
for ( ; it.current(); ++it ) {
Local_View->clearSelection();
}
Local_View->clearFocus();
TabWidget->setCurrentPage(1);
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::nullifyCallBack()
{
- FtpOptions(FTPLIB_CALLBACK, NULL, conn);
- FtpOptions(FTPLIB_IDLETIME, NULL, conn);
- FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
- FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
+ FtpOptions(FTPLIB_CALLBACK, 0, conn);
+ FtpOptions(FTPLIB_IDLETIME, 0, conn);
+ FtpOptions(FTPLIB_CALLBACKARG, 0, conn);
+ FtpOptions(FTPLIB_CALLBACKBYTES, 0, conn);
}
void OpieFtp::remoteDownload()
{
// qApp->processEvents();
int fsz;
// QCopEnvelope ( "QPE/System", "busy()" );
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
// strItem=strItem.right(strItem.length()-1);
QString localFile = currentDir.canonicalPath();
if(localFile.right(1).find("/",0,TRUE) == -1)
localFile += "/";
localFile += strItem;
// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
fsz = 0;
QString temp;
temp.sprintf( remoteFile+" "+" %dkb", fsz);
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
}
}
for ( ; it.current(); ++it ) {
Remote_View->clearSelection();
}
Remote_View->setFocus();
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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "soundsettings.h"
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/storage.h>
#include <qapplication.h>
#include <qslider.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <sys/utsname.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
-SoundSettings::SoundSettings( QWidget* parent, const char* name, WFlags fl )
- : SoundSettingsBase( parent, name, TRUE, fl )
+SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl )
+ : SoundSettingsBase( parent, objname, TRUE, fl )
{
keyReset=FALSE;
Config config( "qpe");
config.setGroup( "Volume" );
volume->setValue(100-config.readNumEntry("VolumePercent"));
mic->setValue(100-config.readNumEntry("Mic"));
// touchsound->setChecked(config.readBoolEntry("TouchSound"));
// keysound->setChecked(config.readBoolEntry("KeySound"));
Config cfg("Vmemo");
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
AlertCheckBox->setChecked(cfg.readBoolEntry("Alert"));
cfg.setGroup("Record");
int rate=config.readNumEntry("SampleRate", 22050);
if(rate == 8000)
sampleRate->setCurrentItem(0);
else if(rate == 11025)
sampleRate->setCurrentItem(1);
else if(rate == 22050)
sampleRate->setCurrentItem(2);
else if(rate == 33075)
sampleRate->setCurrentItem(3);
else if(rate==44100)
sampleRate->setCurrentItem(4);
stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); //TODO hide if zaurus- mono only
struct utsname name; /* check for embedix kernel running on the zaurus*/
if (uname(&name) != -1) {
QString release=name.release;
if( release.find("embedix",0,TRUE) !=-1)
stereoCheckBox->hide();
}
// else
// stereoCheckBox->hide();
sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1));
cfg.setGroup("Defaults");
keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") );
updateStorageCombo();
connect(volume, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
connect(mic, SIGNAL(valueChanged(int)), this, SLOT(setMic(int)));
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 @@
/*
Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts)
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "fviewer.h"
-FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name)
+FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent, const char*name):QWidget(parent, name)
{
QVBoxLayout *layout = new QVBoxLayout(this);
setIcon(Resource::loadPixmap("opie-sh"));
textView = new QTextBrowser(this, "textview");
layout->addWidget(textView);
QString string;
if(title.isNull())
{
setCaption(filename);
}
else
{
setCaption(title);
}
file = new QFile();
if(!filename.isNull())
{
file->setName(filename);
file->open(IO_ReadOnly);
}
else
{
file->open(IO_ReadOnly, 0);
}
stream = new QTextStream(file);
string = stream->read();
textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/");
textView->setText(string, QDir::currentDirPath()+"/");
printf("%s\n", QDir::currentDirPath().latin1());
file->close();
}
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 @@
/*
Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts)
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "inputdialog.h"
-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)
+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)
{
type = newtype;
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addStrut(32);
QLabel *label = new QLabel(labelString, this, "label");
setCaption(title);
int x, y;
layout->addSpacing(5);
layout->addWidget(label);
layout->addSpacing(5);
switch(type)
{
case 0:
lineEdit = new QLineEdit(this, "line edit");
layout->addWidget(lineEdit);
break;
case 1:
comboBox = new QComboBox(edit, this, "combo box");
layout->addWidget(comboBox);
if(!filename.isNull())
{
QFile file(filename);
file.open(IO_ReadOnly);
QTextStream stream(&file);
QString string = stream.read();
comboBox->insertStringList(QStringList::split('\n', string));
}
else
{
QFile file;
file.open(IO_ReadOnly, 0);
QTextStream stream(&file);
QString string = stream.read();
comboBox->insertStringList(QStringList::split('\n', string));
}
break;
case 2:
listBox = new QListBox(this, "list box");
listBox->setSelectionMode(QListBox::Multi);
layout->addWidget(listBox);
if(!filename.isNull())
{
QFile file(filename);
file.open(IO_ReadOnly);
@@ -69,49 +69,50 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString
listBox->insertStringList(QStringList::split('\n', string));
}
else
{
QFile file;
file.open(IO_ReadOnly, 0);
QTextStream stream(&file);
QString string = stream.read();
listBox->insertStringList(QStringList::split('\n', string));
}
break;
}
layout->addSpacing(5);
x=(w/2)-(width()/2);
y=(h/2)-(height()/2);
move(x,y);
}
QString InputDialog::getString()
{
switch (type)
{
case 0:
return ((QLineEdit *)child("line edit"))->text();
break;
case 1:
return ((QComboBox *)child("combo box"))->currentText();
break;
case 2:
QString string;
int i;
for(i = 0; i < listBox->count(); i++)
{
if(listBox->isSelected(i))
{
string+=listBox->text(i)+'\n';
}
}
if(string[string.length()-1] == '\n')
{
string.truncate(string.length()-1);
}
return string;
}
+ return QString::null;
}
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 @@
/*
Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts)
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mbox.h"
-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)
+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)
{
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *hlayout1 = new QHBoxLayout(this);
QHBoxLayout *hlayout2 = new QHBoxLayout(this);
int x, y;
layout->addLayout(hlayout1);
layout->addLayout(hlayout2);
setCaption(title);
QLabel *image = new QLabel(this, "image");
QLabel *text = new QLabel(message, this, "text");
switch (type)
{
case 0:
image->setPixmap(Resource::loadPixmap("opie-sh/info"));
break;
case 1:
image->setPixmap(Resource::loadPixmap("opie-sh/warning"));
break;
case 2:
image->setPixmap(Resource::loadPixmap("opie-sh/error"));
break;
}
hlayout1->addWidget(image);
hlayout1->addSpacing(5);
hlayout1->addWidget(text);
if(!btext0->isNull())
{
QPushButton *button0 = new QPushButton((const QString)*btext0, this, "button0");
hlayout2->addSpacing(5);
hlayout2->addWidget(button0);
hlayout2->addSpacing(5);
connect(button0, SIGNAL(clicked()), this, SLOT(b0pressed()) );
}
else
{
QPushButton *button0 = new QPushButton("Ok", this, "button0");
hlayout2->addSpacing(5);
hlayout2->addWidget(button0);
hlayout2->addSpacing(5);
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)
button1Text = args[i+1];
}
if(args[i] == "-2")
{
button2Text = args[i+1];
}
if(args[i] == "-I")
{
type=0;
}
if(args[i] == "-w")
{
type = 1;
}
if(args[i] == "-e")
{
type = 2;
}
if(args[i] == "-g")
{
full = false;
}
}
MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox");
if(full)
{
w->setCaption(title);
w->showMaximized();
}
// mbox->show();
switch(mbox->exec() )
{
case 0:
return -1;
case 1:
return -1;
case 2:
return 0;
case 3:
return 1;
case 4:
return 2;
+ default: return -1;
}
}
void printusage()
{
printf("Usage instructions for Opie-sh\n");
printf("Usage: opie-sh [dialog type] [type specific options]\n");
printf("Types:\n");
printf(" -m Message Box\n");
printf(" -f [filename] View file [Default = stdin]\n");
printf(" -i Input dialog\n");
printf(" -h --help These instructions\n");
printf(" -t [title] The window/dialog title\n");
printf("Message box options:\n");
printf(" -M [message] The message to display\n");
printf(" -I Use information icon\n");
printf(" -w Use the warning icon\n");
printf(" -e Use the error icon\n");
printf(" -0 [text] First button text [Default = OK]\n");
printf(" -1 [text] Second button text\n");
printf(" -2 [text] Third button text\n");
printf(" -g Disable fullscreen\n");
printf("Input Dialog options:\n");
printf(" -s A single line of input (output to console)\n");
printf(" -l List input (newline separated list read in from file)\n");
printf(" -b A list box, enabling multiple selections (input same as -l)\n");
printf(" -L [label] The label for the input field\n");
printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n");
printf(" -E Makes list input editable\n");
- printf(" -g Disable fullscreen\n\0");
+ printf(" -g Disable fullscreen\n");
}
int fileviewer(QPEApplication *a, int argc, QStringList args)
{
int i;
QString filename, title, icon;
bool update=false;
for(i=0; i < argc; i++)
{
if(args[i] == "-f")
{
if(args[i+1][0] != '-')
{
filename = args[i+1];
}
}
if(args[i] == "-I")
{
icon=args[i+1];
}
if(args[i] == "-t")
{
title = args[i+1];
}
}
FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer");
a->setMainWidget(fview);
fview->showMaximized();
return a->exec();
}
int input(int wi, int h, QWidget *w, int argc, QStringList args)
{
int i, type = 0;
QString title, label, filename;
bool edit=false, full=true;
for(i=0; i < argc; i++)
{
if(args[i] == "-s")
{
type = 0;
}
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "buttondialog.h"
-ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0):QDialog(parent, name, modal, f)
+ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f)
{
setCaption(tr(buttonName));
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *hlayout1 = new QHBoxLayout(this);
QHBoxLayout *hlayout2 = new QHBoxLayout(this);
QHBoxLayout *hlayout3 = new QHBoxLayout(this);
layout->addSpacing(5);
layout->addLayout(hlayout1);
layout->addSpacing(5);
layout->addLayout(hlayout2);
layout->addSpacing(5);
layout->addLayout(hlayout3);
layout->addSpacing(5);
remote = new QComboBox(false, this, "remote");
QLabel *remoteLabel = new QLabel(remote, "Remote: ", this, "remoteLabel");
hlayout1->addSpacing(5);
hlayout1->addWidget(remoteLabel);
hlayout1->addSpacing(5);
hlayout1->addWidget(remote);
hlayout1->addSpacing(5);
remote->insertItem("Remote ");
remote->insertStringList(getRemotes());
connect(remote, SIGNAL(activated(const QString &)), this, SLOT(remoteSelected(const QString&)) );
button = new QComboBox(false, this, "button");
QLabel *buttonLabel = new QLabel(remote, "Button: ", this, "buttonLabel");
hlayout2->addSpacing(5);
hlayout2->addWidget(buttonLabel);
hlayout2->addSpacing(5);
hlayout2->addWidget(button);
hlayout2->addSpacing(5);
button->insertItem("Button ");
connect(button, SIGNAL(activated(const QString &)), this, SLOT(buttonSelected(const QString&)) );
label = new QLineEdit(this, "label");
label->setText(buttonName);
QLabel *labelLabel = new QLabel(label, "Label: ", this, "labelLabel");
hlayout3->addSpacing(5);
hlayout3->addWidget(labelLabel);
hlayout3->addSpacing(5);
hlayout3->addWidget(label);
hlayout3->addSpacing(5);
}
void ButtonDialog::remoteSelected(const QString &string)
{
button->insertStringList(getButtons(string.latin1()) );
list="SEND_ONCE";
list+=string;
}
void ButtonDialog::buttonSelected(const QString &string)
{
list+=string;
}
QStringList ButtonDialog::getList()
{
return list;
}
QString ButtonDialog::getLabel()
{
return label->text();
}
QStringList ButtonDialog::getRemotes()
{
const char write_buffer[] = "LIST\n";
const char *readbuffer;
int i, numlines;
QStringList list;
addr.sun_family=AF_UNIX;
strcpy(addr.sun_path,"/dev/lircd");
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetRemotes");
return NULL;
}
- if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
+ if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetRemotes");
return NULL;
}
write(fd, write_buffer, strlen(write_buffer));
for(i=0; i<5; i++)
{
printf("%d\n", i);
readbuffer = readPacket();
printf("%s", readbuffer);
printf("%d\n", i);
}
numlines = atoi(readbuffer);
for(i=0; i<numlines; i++)
{
list+=readPacket();
}
if(strcasecmp(readPacket(), "END") != 0)
{
QMessageBox *mb = new QMessageBox("Error!",
"bad packet",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetRemotes");
return NULL;
}
- std::close(fd);
+ ::close(fd);
return list;
}
QStringList ButtonDialog::getButtons(const char *remoteName)
{
QString write_buffer = "LIST ";
const char *readbuffer;
int i, j, numlines;
QStringList list;
QString string;
write_buffer += remoteName;
write_buffer += '\n';
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetButtons");
return NULL;
}
- if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
+ if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetButtons");
return NULL;
}
write(fd, write_buffer.latin1(), strlen(write_buffer) );
for(i=0; i<5; i++)
{
readbuffer = readPacket();
}
numlines = atoi(readbuffer);
for(i=0; i<numlines; i++)
{
list+=readPacket();
for(j=0; j<list[i].length(); j++)
{
if(list[i][j] == ' ')
break;
}
list[i].remove(0, j+1);
}
if(strcasecmp(readPacket(), "END") != 0)
{
QMessageBox *mb = new QMessageBox("Error!",
"bad packet",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("ButtonDialog::GetButtons");
return NULL;
}
- std::close(fd);
+ ::close(fd);
return list;
}
//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
const char *ButtonDialog::readPacket()
{
static char buffer[PACKET_SIZE+1]="";
char *end;
static int ptr=0,end_len=0;
ssize_t ret;
timeout = 0;
if(ptr>0)
{
memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1);
ptr=strlen(buffer);
end=strchr(buffer,'\n');
}
else
{
end=NULL;
}
alarm(TIMEOUT);
while(end==NULL)
{
if(PACKET_SIZE<=ptr)
{
fprintf(stderr,"bad packet\n");
ptr=0;
return(NULL);
}
ret=read(fd,buffer+ptr,PACKET_SIZE-ptr);
if(ret<=0 || timeout)
{
if(timeout)
{
fprintf(stderr,"timeout\n");
}
else
{
alarm(0);
}
ptr=0;
return(NULL);
}
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "channelgroup.h"
-ChannelGroup::ChannelGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+ChannelGroup::ChannelGroup(QWidget *parent, const char *name):QWidget(parent,name)
{
QGridLayout *layout = new QGridLayout(this);
QVBoxLayout *volLayout = new QVBoxLayout(this);
QVBoxLayout *chanLayout = new QVBoxLayout(this);
layout->addRowSpacing(1,1);
layout->addRowSpacing(3,1);
layout->addRowSpacing(5,1);
layout->addColSpacing(1,1);
layout->addColSpacing(3,1);
layout->addColSpacing(5,1);
layout->addColSpacing(7,1);
QPushButton *one = new QPushButton("1", this, "one");
layout->addWidget(one, 0, 2, 0);
connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *two = new QPushButton("2", this, "two");
layout->addWidget(two, 0, 4, 0);
connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *three = new QPushButton("3", this, "three");
layout->addWidget(three, 0, 6, 0);
connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *four = new QPushButton("4", this, "four");
layout->addWidget(four, 2, 2, 0);
connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *five = new QPushButton("5", this, "five");
layout->addWidget(five, 2, 4, 0);
connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *six = new QPushButton("6", this, "six");
layout->addWidget(six, 2, 6, 0);
connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *seven = new QPushButton("7", this, "seven");
layout->addWidget(seven, 4, 2, 0);
connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *eight = new QPushButton("8", this, "eight");
layout->addWidget(eight, 4, 4, 0);
connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *nine = new QPushButton("9", this, "nine");
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "channelgroupconf.h"
-ChannelGroupConf::ChannelGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+ChannelGroupConf::ChannelGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
QGridLayout *layout = new QGridLayout(this);
QVBoxLayout *volLayout = new QVBoxLayout(this);
QVBoxLayout *chanLayout = new QVBoxLayout(this);
layout->addRowSpacing(1,5);
layout->addRowSpacing(3,5);
layout->addRowSpacing(5,5);
layout->addColSpacing(1,1);
layout->addColSpacing(3,1);
layout->addColSpacing(5,1);
layout->addColSpacing(7,1);
QPushButton *one = new QPushButton("1", this, "one");
layout->addWidget(one, 0, 2, 0);
connect(one, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *two = new QPushButton("2", this, "two");
layout->addWidget(two, 0, 4, 0);
connect(two, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *three = new QPushButton("3", this, "three");
layout->addWidget(three, 0, 6, 0);
connect(three, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *four = new QPushButton("4", this, "four");
layout->addWidget(four, 2, 2, 0);
connect(four, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *five = new QPushButton("5", this, "five");
layout->addWidget(five, 2, 4, 0);
connect(five, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *six = new QPushButton("6", this, "six");
layout->addWidget(six, 2, 6, 0);
connect(six, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *seven = new QPushButton("7", this, "seven");
layout->addWidget(seven, 4, 2, 0);
connect(seven, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *eight = new QPushButton("8", this, "eight");
layout->addWidget(eight, 4, 4, 0);
connect(eight, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *nine = new QPushButton("9", this, "nine");
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "configtab.h"
-ConfigTab::ConfigTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+ConfigTab::ConfigTab(QWidget *parent, const char *name):QWidget(parent,name)
{
QVBoxLayout *layout = new QVBoxLayout(this);
topGroupConf = new TopGroupConf(this, "topGroupConf");
layout->addWidget(topGroupConf, 1);
layout->addSpacing(1);
dvdGroupConf = new DVDGroupConf(this, "dvdGroupConf");
layout->addWidget(dvdGroupConf, 1);
layout->addSpacing(1);
vcrGroupConf = new VCRGroupConf(this, "vcrGroupConf");
layout->addWidget(vcrGroupConf, 1);
layout->addSpacing(1);
channelGroupConf = new ChannelGroupConf(this, "channelGroupConf");
layout->addWidget(channelGroupConf, 1);
}
void ConfigTab::setConfig(Config *newCfg)
{
cfg = newCfg;
cfg->setGroup("Remotes");
topGroupConf->updateRemotes(cfg->readListEntry("remoteList", ',') );
cfg->setGroup("Default");
const QObject *obj;
const QObjectList *objList = topGroupConf->children();
for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
{
if(obj->inherits("QPushButton"))
{
if(!cfg->hasKey((QString)obj->name()+"Label"))
{
cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
}
}
}
objList = dvdGroupConf->children();
for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
{
if(obj->inherits("QPushButton"))
{
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dvdgroup.h"
-DVDGroup::DVDGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+DVDGroup::DVDGroup(QWidget *parent, const char *name):QWidget(parent,name)
{
QGridLayout *layout = new QGridLayout(this);
//put rows between the buttons of size 1
layout->addRowSpacing(1,1);
layout->addRowSpacing(3,1);
//put collumns between the buttons of size 5
layout->addColSpacing(1,5);
layout->addColSpacing(3,5);
layout->addColSpacing(5,5);
layout->addColSpacing(7,5);
//make sure that the collumns with the buttons in them stretch before the filler collumns do
//since there is so little room, there is no need to do this for the rows
layout->setColStretch(4,1);
layout->setColStretch(2,1);
layout->setColStretch(6,1);
layout->setColStretch(8,1);
layout->setColStretch(0,1);
//add the menu navigation buttons, and connect them to the RemoteTab slots...
QPushButton *up = new QPushButton("Up", this,"up");
layout->addWidget(up, 0, 4, 0);
connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *down = new QPushButton("Down",this,"down");
layout->addWidget(down, 4, 4, 0);
connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *left = new QPushButton("Left",this,"left");
layout->addWidget(left, 2, 2, 0);
connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *right = new QPushButton("Right", this, "right");
layout->addWidget(right, 2, 6, 0);
connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *enter = new QPushButton("Enter",this,"enter");
layout->addWidget(enter, 2, 4, 0);
connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
//add some other buttons
QPushButton *eject = new QPushButton("Eject", this, "eject");
layout->addWidget(eject, 0, 0, 0);
connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dvdgroupconf.h"
-DVDGroupConf::DVDGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+DVDGroupConf::DVDGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
QGridLayout *layout = new QGridLayout(this);
//put rows between the buttons of size 1
layout->addRowSpacing(1,1);
layout->addRowSpacing(3,1);
//put collumns between the buttons of size 5
layout->addColSpacing(1,5);
layout->addColSpacing(3,5);
layout->addColSpacing(5,5);
layout->addColSpacing(7,5);
//make sure that the collumns with the buttons in them stretch before the filler collumns do
//since there is so little room, there is no need to do this for the rows
layout->setColStretch(4,1);
layout->setColStretch(2,1);
layout->setColStretch(6,1);
layout->setColStretch(8,1);
layout->setColStretch(0,1);
//add the menu navigation buttons, and connect them to the RemoteTab slots...
QPushButton *up = new QPushButton("Up",this,"up");
layout->addWidget(up, 0, 4, 0);
connect(up, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *down = new QPushButton("Down",this,"down");
layout->addWidget(down, 4, 4, 0);
connect(down, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *left = new QPushButton("Left",this,"left");
layout->addWidget(left, 2, 2, 0);
connect(left, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *right = new QPushButton("Right", this, "right");
layout->addWidget(right, 2, 6, 0);
connect(right, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *enter = new QPushButton("Enter",this,"enter");
layout->addWidget(enter, 2, 4, 0);
connect(enter, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
//add some other buttons
QPushButton *eject = new QPushButton("Eject", this, "eject");
layout->addWidget(eject, 0, 0, 0);
connect(eject, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "learntab.h"
-LearnTab::LearnTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+LearnTab::LearnTab(QWidget *parent, const char *name):QWidget(parent,name)
{
QVBoxLayout *layout = new QVBoxLayout(this);
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>");
QTextView *textView = new QTextView(*string, 0, this);
layout->addWidget(textView);
}
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mainview.h"
-MainView::MainView(QWidget *parent, const char *name=0) : QWidget(parent, name)
+MainView::MainView(QWidget *parent, const char *name) : QWidget(parent, name)
{
setIcon( Resource::loadPixmap( "remote" ) );
setCaption(tr("Remote") );
QVBoxLayout *layout = new QVBoxLayout(this);
QTabWidget *tabs = new QTabWidget(this);
layout->addWidget(tabs);
printf("MainView: 1\n");
remote = new RemoteTab(tabs);
printf("MainView: 2\n");
learn = new LearnTab(tabs);
printf("MainView: 3\n");
config = new ConfigTab(tabs);
printf("MainView: 4\n");
connect(config, SIGNAL(remotesChanged()), this, SLOT(updateRemotesList()) );
printf("MainView: 5\n");
remote->setIRSocket(fd);
tabs->addTab(remote, tr("Remote") );
tabs->addTab(learn,tr("Learn") );
tabs->addTab(config,tr("Config") );
printf("1\n");
cfg = new Config("Remote");
printf("2\n");
remote->setConfig(cfg);
config->setConfig(cfg);
}
int MainView::getIRSocket()
{
return fd;
}
void MainView::setIRSocket(int newfd)
{
fd = newfd;
remote->setIRSocket(fd);
}
void MainView::updateRemotesList()
{
remote->updateRemotesList();
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "remotetab.h"
-RemoteTab::RemoteTab(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+RemoteTab::RemoteTab(QWidget *parent, const char *name):QWidget(parent,name)
{
QVBoxLayout *layout = new QVBoxLayout(this);
topGroup = new TopGroup(this);
// topGroup->setMaximumHeight(22);
layout->addWidget(topGroup, 0, 0);
printf("%d %d", topGroup->width(), topGroup->height());
layout->addSpacing(1);
dvdGroup = new DVDGroup(this);
// dvdGroup->setMaximumHeight(68);
layout->addWidget(dvdGroup, 0, 0);
layout->addSpacing(1);
vcrGroup = new VCRGroup(this);
layout->addWidget(vcrGroup, 0, 0);
// vcrGroup->setMaximumHeight(45);
layout->addSpacing(1);
channelGroup = new ChannelGroup(this);
// channelGroup->setMaximumHeight(91);
layout->addWidget(channelGroup, 0, 0);
this->setMaximumWidth(240);
timeout = 0;
addr.sun_family=AF_UNIX;
strcpy(addr.sun_path,"/dev/lircd");
}
int RemoteTab::sendIR()
{
const QObject *button = sender();
QString string = cfg->readEntry(button->name());
string+='\n';
const char *write_buffer = string.latin1();
const char *read_buffer;
bool done=false;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("RemoteTab::SendIR");
- return NULL;
+ return 0;
}
- if(std::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
+ if(::connect(fd,(struct sockaddr *) &addr, sizeof(addr) ) == -1)
{
QMessageBox *mb = new QMessageBox("Error!",
"couldnt connect to socket",
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
mb->exec();
perror("RemoteTab::SendIR");
}
printf("fd2: %d\n", fd);
printf("%s", write_buffer);
printf("1\n");
printf("%d\n", write(fd, write_buffer, strlen(write_buffer) ) );
printf("2\n");
while(!done)
{
read_buffer=readPacket();
printf("%s\n", read_buffer);
if(strcasecmp(read_buffer, "END") == 0)
{
printf("done reading packet\n");
done=true;
}
}
- std::close(fd);
+ ::close(fd);
}
// printf("%s\n", readPacket());
// printf("%d\n", read(fd, read_buffer,sizeof(read_buffer)) );
// printf("%s", read_buffer);
//this function was ripped for rc.c in xrc, it is available here: http://www.lirc.org/software.html
const char *RemoteTab::readPacket()
{
static char buffer[PACKET_SIZE+1]="";
char *end;
static int ptr=0,end_len=0;
ssize_t ret;
if(ptr>0)
{
memmove(buffer,buffer+ptr,strlen(buffer+ptr)+1);
ptr=strlen(buffer);
end=strchr(buffer,'\n');
}
else
{
end=NULL;
}
alarm(TIMEOUT);
while(end==NULL)
{
if(PACKET_SIZE<=ptr)
{
// fprintf(stderr,"%s: bad packet\n",progname);
ptr=0;
return(NULL);
}
ret=read(fd,buffer+ptr,PACKET_SIZE-ptr);
if(ret<=0 || timeout)
{
if(timeout)
{
// fprintf(stderr,"%s: timeout\n",progname);
}
else
{
alarm(0);
}
ptr=0;
return(NULL);
}
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "topgroup.h"
-TopGroup::TopGroup(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+TopGroup::TopGroup(QWidget *parent, const char *name):QWidget(parent,name)
{
QHBoxLayout *layout = new QHBoxLayout(this, 0, -1, 0);
QPushButton *power = new QPushButton("Power",this,"power");
layout->addWidget(power);
connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
// power->setGeometry(5, 5,40, 20);
layout->addSpacing(5);
QPushButton *source = new QPushButton("Source",this,"source");
layout->addWidget(source);
connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
// source->setGeometry(50,5,40,20);
remotes = new QComboBox(false, this, "remotes");
connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
remotes->insertItem("Select Remote");
// remotes->setGeometry(135,5,95,20);
QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
// remoteLabel->setGeometry(90,5,40,20);
remoteLabel->setAlignment(AlignRight | AlignVCenter);
layout->addWidget(remoteLabel);
layout->addWidget(remotes);
}
void TopGroup::updateRemotes(Config *cfg)
{
remotes->clear();
remotes->insertItem(QString("SelectRemote"));
cfg->setGroup("Remotes");
remotes->insertStringList(cfg->readListEntry("remoteList", ',') );
}
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "topgroupconf.h"
-TopGroupConf::TopGroupConf(QWidget *parent=0, const char *name=0):QWidget(parent,name)
+TopGroupConf::TopGroupConf(QWidget *parent, const char *name):QWidget(parent,name)
{
QHBoxLayout *layout = new QHBoxLayout(this);
QPushButton *power = new QPushButton("Power",this,"power");
layout->addWidget(power);
connect(power, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
// power->setGeometry(5, 5,40, 20);
layout->addSpacing(5);
QPushButton *source = new QPushButton("Source",this,"source");
layout->addWidget(source);
connect(source, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
// source->setGeometry(50,5,40,20);
remotes = new QComboBox(true, this, "remotes");
remotes->insertItem(QString("Remotes"));
layout->addWidget(remotes);
layout->setStretchFactor(remotes, 1);
connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
QPushButton *newrem = new QPushButton("New", this, "new");
layout->addWidget(newrem);
connect(newrem, SIGNAL(pressed()), this->parentWidget(), SLOT(newPressed()) );
/* remotes = new QComboBox(false, this, "remotes");
connect(remotes, SIGNAL(activated(const QString &)), this->parentWidget(), SLOT(remoteSelected(const QString &)) );
remotes->insertItem("Select Remote");
// remotes->setGeometry(135,5,95,20);
QLabel *remoteLabel = new QLabel(remotes, "Remote: ",this,"remoteLabel");
// remoteLabel->setGeometry(90,5,40,20);
remoteLabel->setAlignment(AlignRight | AlignVCenter);
layout->addWidget(remoteLabel);
layout->addWidget(remotes);
*/
}
void TopGroupConf::updateRemotes(QStringList list)
{
remotes->insertStringList(list);
}
QString TopGroupConf::getRemotesText()
{
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "vcrgroup.h"
-VCRGroup::VCRGroup(QWidget *parent=0, const char *name=0) : QWidget(parent,
+VCRGroup::VCRGroup(QWidget *parent, const char *name) : QWidget(parent,
name)
{
QVBoxLayout *vlayout = new QVBoxLayout(this);
QHBoxLayout *hlayout1 = new QHBoxLayout(this);
QHBoxLayout *hlayout2 = new QHBoxLayout(this);
vlayout->addLayout(hlayout1);
vlayout->addSpacing(1);
vlayout->addLayout(hlayout2);
QPushButton *play = new
QPushButton("Play",this, "play");
hlayout1->addWidget(play);
connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
hlayout1->addSpacing(5);
QPushButton *pause = new
QPushButton("Pause",this, "pause");
hlayout1->addWidget(pause);
connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
hlayout1->addSpacing(5);
QPushButton *stop = new
QPushButton("Stop",this, "stop");
hlayout1->addWidget(stop);
connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
hlayout1->addSpacing(5);
QPushButton *record = new
QPushButton("Record",this, "record");
hlayout1->addWidget(record);
connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
QPushButton *back = new
QPushButton("Back",this, "back");
hlayout2->addWidget(back);
connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(sendIR()) );
hlayout2->addSpacing(5);
QPushButton *rewind = new
QPushButton("Rewind",this, "rewind");
hlayout2->addWidget(rewind);
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 @@
/*
Opie-Remote. emulates remote controlls on an iPaq (and maybe a Zaurus) in Opie.
Copyright (C) 2002 Thomas Stephens
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "vcrgroupconf.h"
-VCRGroupConf::VCRGroupConf(QWidget *parent=0, const char *name=0) : QWidget(parent, name)
+VCRGroupConf::VCRGroupConf(QWidget *parent, const char *name) : QWidget(parent, name)
{
QVBoxLayout *vlayout = new QVBoxLayout(this);
QHBoxLayout *hlayout1 = new QHBoxLayout(this);
QHBoxLayout *hlayout2 = new QHBoxLayout(this);
vlayout->addLayout(hlayout1);
vlayout->addSpacing(1);
vlayout->addLayout(hlayout2);
QPushButton *play = new QPushButton("Play",this, "play");
hlayout1->addWidget(play);
connect(play, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
hlayout1->addSpacing(5);
QPushButton *pause = new QPushButton("Pause",this, "pause");
hlayout1->addWidget(pause);
connect(pause, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
hlayout1->addSpacing(5);
QPushButton *stop = new QPushButton("Stop",this, "stop");
hlayout1->addWidget(stop);
connect(stop, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
hlayout1->addSpacing(5);
QPushButton *record = new QPushButton("Record",this, "record");
hlayout1->addWidget(record);
connect(record, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
QPushButton *back = new QPushButton("Back",this, "back");
hlayout2->addWidget(back);
connect(back, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
hlayout2->addSpacing(5);
QPushButton *rewind = new QPushButton("Rewind",this, "rewind");
hlayout2->addWidget(rewind);
connect(rewind, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
hlayout2->addSpacing(5);
QPushButton *ff = new QPushButton("FF",this, "ff");
hlayout2->addWidget(ff);
connect(ff, SIGNAL(pressed()), this->parentWidget(), SLOT(buttonPressed()) );
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)
.arg(tag())
.arg(escape(mailbox)));
return tag(false);
}
QString IMAPHandler::iUnsubscribe(const QString &mailbox)
{
doLogin();
_ibase->sendCommand(QString("%1 UNSUBSCRIBE \"%2\"\r\n")
.arg(tag())
.arg(escape(mailbox)));
return tag(false);
}
QString IMAPHandler::iList(const QString &reference, const QString &mailbox)
{
doLogin();
_ibase->sendCommand(QString("%1 LIST \"%2\" \"%3\"\r\n")
.arg(tag())
.arg(escape(reference))
.arg(escape(mailbox)));
return tag(false);
}
QString IMAPHandler::iLsub(const QString &reference, const QString &mailbox)
{
doLogin();
_ibase->sendCommand(QString("%1 LSUB \"%2\" \"%3\"\r\n")
.arg(tag())
.arg(escape(reference))
.arg(escape(mailbox)));
return tag(false);
}
QString IMAPHandler::iStatus(const QString &mailbox, const QString &items)
{
doLogin();
_ibase->sendCommand(QString("%1 STATUS \"%2\" (%3)\r\n")
.arg(tag())
.arg(escape(mailbox))
.arg(escape(items)));
return tag(false);
}
-QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime = 0)
+QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime)
{
doLogin();
_ibase->sendCommand(QString("%1 APPEND \"%2\" (%3) \"%4\" {%5}\r\n%6\r\n")
.arg(tag())
.arg(escape(mailbox))
.arg(flags)
.arg(escape(datetime))
.arg(literal.length())
.arg(literal));
return tag(false);
}
QString IMAPHandler::iCheck()
{
doLogin();
_ibase->sendCommand(QString("%1 CHECK\r\n")
.arg(tag()));
return tag(false);
}
QString IMAPHandler::iClose()
{
doLogin();
_ibase->sendCommand(QString("%1 CLOSE\r\n")
.arg(tag()));
return tag(false);
}
QString IMAPHandler::iExpunge()
{
doLogin();
_ibase->sendCommand(QString("%1 EXPUNGE\r\n")
.arg(tag()));
return tag(false);
}
QString IMAPHandler::iSearch(const QString &search, const QString &charset)
{
doLogin();
_ibase->sendCommand(QString("%1 SEARCH %2 %3\r\n")
.arg(tag())
.arg(charset.isEmpty() ? QString(0) : escape(charset))
.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 @@
// adadpted form qpe/qipkg
#include "mainwindow.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
-MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
+MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
QMainWindow( parent, name, f )
// packageListServers( QObject(parent), name ),
// packageListSearch( parent, name ),
// packageListDocLnk( parent, name )
{
setCaption( tr("Package Manager") );
settings = new PackageManagerSettings(this,0,TRUE);
listViewPackages = new PackageListView( this,"listViewPackages",settings );
setCentralWidget( listViewPackages );
listViewPackages->addList( tr("feeds"), &packageListServers );
listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
//listViewPackages->addList( tr("documents"), &packageListDocLnk );
ipkg = new PmIpkg( settings, this );
packageListServers.setSettings( settings );
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
pvDebug(9,"packageListServers.update");
packageListServers.update();
pvDebug(9,"packageListDocLnk.update");
pvDebug(0,"no UPDATE of DocLnk");
// packageListDocLnk.update();
pvDebug(9,"makeMenu");
makeMenu();
makeChannel();
//opie is hardcoded default ;)
// pvDebug(9,"section->setCurrentItem");
// for (int i=0;i<section->count();i++)
// if (section->text(i)=="opie")
// section->setCurrentItem(i);
// sectionChanged();
connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
pvDebug(9,"displayList");
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
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 @@
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
-Package::Package( QObject *parent=0, const char *name=0 )
+Package::Package( QObject *parent, const char *name )
: QObject(parent,name)
{
}
Package::~Package()
{
}
-Package::Package( PackageManagerSettings *s, QObject *parent=0, const char *name=0 )
+Package::Package( PackageManagerSettings *s, QObject *parent, const char *name )
: QObject(parent,name)
{
Package(parent,name);
init(s);
}
void Package::init( PackageManagerSettings *s )
{
settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_useFileName = false;
_old = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
_versions=0;
_version="";
}
-Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent=0, const char *name=0 )
+Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name )
: QObject(parent,name)
{
init(s);
parsePackage( pack );
}
-Package::Package( QString n, PackageManagerSettings *s, QObject *parent=0, const char *name=0 )
+Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name )
{
init(s);
if ( !QFile::exists( n ) )
{
_name = QString( n );
}else{
pvDebug(4,"remote file: "+n);
parseIpkgFile( n );
_useFileName = true;
_fileName = QString( n );
}
}
-Package::Package( Package *pi, QObject *parent=0, const char *name=0 )
+Package::Package( Package *pi, QObject *parent, const char *name )
{
init(pi->settings);
copyValues( pi );
}
void Package::setValue( QString n, QString t )
{
if ( n == "Package" )
{
_name = QString( t );
}else if ( n == "Installed-Size" )
{
_size = t;
// }else if ( n == "Priority")
// {
}else if ( n == "Section")
{
setSection( t );
// }else if ( n == "Maintainer")
// {
//
// }else if ( n == "Architecture")
// {
}else if ( n == "Version")
{
_version = t;
// }else if ( n == "Pre-Depends")
// {
//
// }else if ( n == "Depends")
// {
}else if ( n == "Filename")
{
_fileName = t;
// }else if ( n == "Size")
// {
//
// }else if ( n == "MD5Sum")
// {
}else if ( n == "Description")
{
setDesc( t );
}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 @@
#include "packagelist.h"
#include <assert.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include "debug.h"
static QDict<Package> *packageListAll;
static int packageListAllRefCount = 0;
-PackageList::PackageList(QObject *parent=0, const char *name=0)
+PackageList::PackageList(QObject *parent, const char *name)
: QObject(parent,name), packageIter( packageList )
{
empty=true;
if (!packageListAll) packageListAll = new QDict<Package>();
packageListAllRefCount++;
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
aktSection = "All";
aktSubSection = "All";
}
PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name)
: QObject(parent,name), packageIter( packageList )
{
settings = s;
PackageList(parent, name);
}
PackageList::~PackageList()
{
if (--packageListAllRefCount < 1 ) delete packageListAll;
}
/** Inserts a package into the list */
void PackageList::insertPackage( Package* pack )
{
if (!pack) return;
Package* p = packageListAll->find( pack->name() );
if ( p )
{
if ( (p->version() == pack->version())
// && (p->dest() == pack->dest())
)
{
p->copyValues( pack );
delete pack;
pack = p;
} else {
QDict<Package> *packver = p->getOtherVersions();
// p->setName( pack->name()+"["+p->version()+"]" );
if (!packver)
{
packver = new QDict<Package>();
packver->insert( pack->name(), p );
p->setOtherVersions( packver );
}
@@ -152,70 +152,70 @@ void PackageList::updateSections( Package* pack )
*subsecs += "All";
}
QStringList *subsecs = subSections[s];
*subsecs += ss;
if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
subsecs = subSections["All"];
*subsecs += ss;
}
void PackageList::readFileEntries( QString filename, QString dest )
{
pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
QStringList packEntry;
QFile f( filename );
if ( !f.open(IO_ReadOnly) ) return;
QTextStream *statusStream = new QTextStream( &f );
while ( !statusStream ->eof() )
{
QString line = statusStream->readLine();
if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
{
//end of package
if ( ! packEntry.isEmpty() )
{
Package *p = new Package( packEntry, settings );
if ( p )
{
p->setDest( dest );
insertPackage( p );
packEntry.clear();
}
}
}else{
packEntry << line;
};
}
delete statusStream;
return;
}
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )
{
- origPackageList[n];
+ return origPackageList[n];
}
void PackageList::clear()
{
origPackageList.clear();
packageList.clear();
}
void PackageList::allPackages()
{
packageList.clear();
QDictIterator<Package> filterIter( origPackageList );
filterIter.toFirst();
Package *pack= filterIter.current() ;
while ( pack )
{
packageList.insert( pack->name(), pack );
++filterIter;
pack = filterIter.current();
}
}
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 @@
#include "packagelistdoclnk.h"
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qlist.h>
#include "package.h"
#include "pksettings.h"
-PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent=0, const char *name=0)
+PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name)
: PackageList(s)
{
PackageListDocLnk(parent, name);
}
-PackageListDocLnk::PackageListDocLnk(QObject *parent=0, const char *name=0)
+PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name)
: PackageList(parent, name)
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
pvDebug(2,"opening DocLnkSet "+docLnkDir);
doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
}
PackageListDocLnk::~PackageListDocLnk()
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
cfg.writeEntry( "docLnkDir", docLnkDir );
delete doclnkset;
}
void PackageListDocLnk::update()
{
pvDebug(2,"PackageListDocLnk::update ");
QList<DocLnk> packlist = doclnkset->children();
for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
{
insertPackage( new Package(pack->file(), settings ) );
}
}
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
}
else
{
if (verinstalled) return *pm_uninstalled_installed_old;
else return *pm_uninstalled;
}
else
if (old) return *pm_installed_old;
else return *pm_installed;
} else { //toProcess() == true
if ( !installed )
return *pm_install;
else
return *pm_uninstall;
}
}
QString PackageListItem::key( int column, bool ascending ) const
{
if ( column == 2 ) {
QString t = text(2);
double bytes=t.toDouble();
if ( t.contains('M') ) bytes*=1024*1024;
else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
if ( !ascending ) bytes=999999999-bytes;
return QString().sprintf("%09d",(int)bytes);
} else {
return QListViewItem::key(column,ascending);
}
}
void PackageListItem::setOn( bool b )
{
QCheckListItem::setOn( b );
package->toggleProcess();
package->setLink( settings->createLinks() );
displayDetails();
}
void PackageListItem::displayDetails()
{
QString sod;
sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
//sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
setText(0, package->name()+sod );
nameItem->setText( 0, QObject::tr("Name: ")+package->name());
- linkItem->setText( 0, QObject::tr("Link: ")+package->link()?QObject::tr("Yes"):QObject::tr("No"));
+ linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
repaint();
}
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:
friend long int lrint ( const fixed &f );
friend fixed sqrt ( const fixed &f );
friend fixed fabs ( const fixed &f );
#endif
};
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 ); }
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 ); }
template <unsigned int SH> inline fixed<SH> operator * ( int i, const fixed<SH> &f ) { return fixed<SH> ( i * f. m_f, true ); }
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 ); }
//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 ); }
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 ); }
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 ); }
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 ); }
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 ); }
template <unsigned int SH> inline bool operator < ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) < f. m_f; }
template <unsigned int SH> inline bool operator > ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) > f. m_f; }
template <unsigned int SH> inline bool operator <= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) <= f. m_f; }
template <unsigned int SH> inline bool operator >= ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) >= f. m_f; }
template <unsigned int SH> inline bool operator == ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) == f. m_f; }
template <unsigned int SH> inline bool operator != ( double d, const fixed<SH> &f ) { return fixed<SH>::d2f( d ) != f. m_f; }
template <unsigned int SH> inline bool operator < ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) < f. m_f; }
template <unsigned int SH> inline bool operator > ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) > f. m_f; }
template <unsigned int SH> inline bool operator <= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) <= f. m_f; }
template <unsigned int SH> inline bool operator >= ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) >= f. m_f; }
template <unsigned int SH> inline bool operator == ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) == f. m_f; }
template <unsigned int SH> inline bool operator != ( int i, const fixed<SH> &f ) { return fixed<SH>::i2f( i ) != f. m_f; }
template <unsigned int SH> inline long int lrint ( const fixed<SH> &f )
{
return fixed<SH>::f2i (( f. m_f < 0 ) ? f. m_f - ( 1 << ( SH - 1 )) : f. m_f + ( 1 << ( SH - 1 )));
}
template <unsigned int SH> inline fixed<SH> fabs ( const fixed<SH> &f )
{
return ( f. m_f < 0 ) ? fixed<SH> ( -f. m_f, true ) : f;
}
// roughly from QPE / qmath.h
template <unsigned int SH> inline fixed<SH> sqrt ( const fixed<SH> &f )
{
if ( f. m_f <= 0 )
return fixed<SH> ( 0, true );
- fixed<SH>::fix_t a0 = 0;
- fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation
+ typename fixed<SH>::fix_t a0 = 0;
+ typename fixed<SH>::fix_t a1 = f. m_f; // take value as first approximation
do {
a0 = a1;
a1 = ( a0 + fixed<SH>::div ( f. m_f, a0 )) >> 1;
} while ( abs ( fixed<SH>::div ( a1 - a0, a1 )) > 1 );
return fixed<SH> ( a1, true );
}
#if 0 // no std::ostream needed in OPIE
template <unsigned int SH> inline std::ostream &operator << ( std::ostream &o, const fixed<SH> &f )
{
o << double( f );
return o;
}
#endif
#endif