gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS: zphone main.cpp, NONE, 1.1 mainwin.ui, NONE, 1.1 mainwin.ui.cpp, NO


From: Pavel Machek <address@hidden>
Subject: CVS: zphone main.cpp, NONE, 1.1 mainwin.ui, NONE, 1.1 mainwin.ui.cpp, NONE, 1.1 mainwin.ui.h, NONE, 1.1 mkit, NONE, 1.1
Date: Mon, 14 Jul 2003 16:59:11 -0400

Update of /cvsroot/gnokii/zphone
In directory subversions:/tmp/cvs-serv5931

Added Files:
        main.cpp mainwin.ui mainwin.ui.cpp mainwin.ui.h mkit 
Log Message:
First working version


--- NEW FILE ---
/*
 * Copyright 2003 Pavel Machek <address@hidden>,
 *
 * Distribute under GPLv2
 */

#include <qpe/qpeapplication.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qvariant.h>
#include <qprogressbar.h>
#include <qdialog.h>
#include <qtimer.h>

#include "gnokii.h"
#include "mainwin.ui.h"

static struct gn_statemachine state;

void mainwin::refresh()
{
        float rflevel = -1, batterylevel = -1;
        gn_rf_unit rfunit = GN_RF_Arbitrary;
        gn_battery_unit battunit = GN_BU_Arbitrary;
        gn_data data;
        char buf[10240];

        gn_data_clear(&data);
        data.rf_unit = &rfunit;
        data.rf_level = &rflevel;
        data.battery_unit = &battunit;
        data.battery_level = &batterylevel;

        if (gn_sm_functions(GN_OP_GetRFLevel, &data, &state) == GN_ERR_NONE) {
                sprintf(buf, "Signal: %d", (int) rflevel);
                signal_label->setText(buf);
                signal_bar->setProgress((int) rflevel);
        }

        if (gn_sm_functions(GN_OP_GetBatteryLevel, &data, &state) == 
GN_ERR_NONE) {
                battery_label->setText("Battery:");
                battery_bar->setProgress((int) batterylevel);
        }
}

int main(int argc, char **argv)
{
        static char *bindir;

        QPEApplication a( argc, argv );

        if (gn_cfg_read(&bindir) >= 0)
                if (gn_cfg_phone_load("", &state))
                        if (gn_gsm_initialise(&state) == GN_ERR_NONE)
                                {}

        mainwin *d = new mainwin();
        a.setMainWidget( d ); d->show(); d->refresh(); return a.exec();

}
    

--- NEW FILE ---
<!DOCTYPE UI><UI>
<class>mainwin</class>
<widget>
    <class>QDialog</class>
    <property stdset="1">
        <name>name</name>
        <cstring>mainwin</cstring>
    </property>
    <property stdset="1">
        <name>geometry</name>
        <rect>
            <x>0</x>
            <y>0</y>
            <width>241</width>
            <height>150</height>
        </rect>
    </property>
    <property stdset="1">
        <name>caption</name>
        <string>ZGnokii</string>
    </property>
    <widget>
        <class>QProgressBar</class>
        <property stdset="1">
            <name>name</name>
            <cstring>battery_bar</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>100</x>
                <y>70</y>
                <width>130</width>
                <height>26</height>
            </rect>
        </property>
    </widget>
    <widget>
        <class>QPushButton</class>
        <property stdset="1">
            <name>name</name>
            <cstring>refresh_button</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>130</x>
                <y>110</y>
                <width>101</width>
                <height>21</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string>Refresh</string>
        </property>
    </widget>
    <widget>
        <class>QProgressBar</class>
        <property stdset="1">
            <name>name</name>
            <cstring>signal_bar</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>100</x>
                <y>40</y>
                <width>130</width>
                <height>26</height>
            </rect>
        </property>
    </widget>
    <widget>
        <class>QLabel</class>
        <property stdset="1">
            <name>name</name>
            <cstring>signal_label</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>10</x>
                <y>40</y>
                <width>80</width>
                <height>21</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string>Signal: ERR</string>
        </property>
    </widget>
    <widget>
        <class>QLabel</class>
        <property stdset="1">
            <name>name</name>
            <cstring>battery_label</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>10</x>
                <y>70</y>
                <width>81</width>
                <height>21</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string>Battery: ERR</string>
        </property>
    </widget>
    <widget>
        <class>QLabel</class>
        <property stdset="1">
            <name>name</name>
            <cstring>operator_label</cstring>
        </property>
        <property stdset="1">
            <name>geometry</name>
            <rect>
                <x>10</x>
                <y>10</y>
                <width>220</width>
                <height>21</height>
            </rect>
        </property>
        <property stdset="1">
            <name>text</name>
            <string>ERROR</string>
        </property>
    </widget>
</widget>
<connections>
    <connection>
        <sender>refresh_button</sender>
        <signal>stateChanged(int)</signal>
        <receiver>mainwin</receiver>
        <slot>refresh()</slot>
    </connection>
    <slot access="public">refresh()</slot>
</connections>
</UI>

--- NEW FILE ---
/****************************************************************************
** Form implementation generated from reading ui file 'mainwin.ui'
**
** Created: Mon Jul 14 22:35:38 2003
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "mainwin.ui.h"

#include <qlabel.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/* 
 *  Constructs a mainwin which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
mainwin::mainwin( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
        setName( "mainwin" );
    resize( 241, 150 ); 
    setCaption( tr( "ZGnokii" ) );

    battery_bar = new QProgressBar( this, "battery_bar" );
    battery_bar->setGeometry( QRect( 100, 70, 130, 26 ) ); 

    refresh_button = new QPushButton( this, "refresh_button" );
    refresh_button->setGeometry( QRect( 130, 110, 101, 21 ) ); 
    refresh_button->setText( tr( "Refresh" ) );

    signal_bar = new QProgressBar( this, "signal_bar" );
    signal_bar->setGeometry( QRect( 100, 40, 130, 26 ) ); 

    signal_label = new QLabel( this, "signal_label" );
    signal_label->setGeometry( QRect( 10, 40, 80, 21 ) ); 
    signal_label->setText( tr( "Signal: ERR" ) );

    battery_label = new QLabel( this, "battery_label" );
    battery_label->setGeometry( QRect( 10, 70, 81, 21 ) ); 
    battery_label->setText( tr( "Battery: ERR" ) );

    operator_label = new QLabel( this, "operator_label" );
    operator_label->setGeometry( QRect( 10, 10, 220, 21 ) ); 
    operator_label->setText( tr( "ERROR" ) );

    // signals and slots connections
    connect( refresh_button, SIGNAL( clicked() ), this, SLOT( refresh() ) );
}

/*  
 *  Destroys the object and frees any allocated resources
 */
mainwin::~mainwin()
{
    // no need to delete child widgets, Qt does it all for us
}

--- NEW FILE ---
/****************************************************************************
** Form interface generated from reading ui file 'mainwin.ui'
**
** Created: Mon Jul 14 22:35:38 2003
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MAINWIN_H
#define MAINWIN_H

#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout; 
class QHBoxLayout; 
class QGridLayout; 
class QLabel;
class QProgressBar;
class QPushButton;

class mainwin : public QDialog
{ 
    Q_OBJECT

public:
    mainwin( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, 
WFlags fl = 0 );
    ~mainwin();

    QProgressBar* battery_bar;
    QPushButton* refresh_button;
    QProgressBar* signal_bar;
    QLabel* signal_label;
    QLabel* battery_label;
    QLabel* operator_label;

public slots:
    virtual void refresh();

};

#endif // MAINWIN_H

--- NEW FILE ---
#uic mainwin.ui > mainwin.ui.h
#uic -impl mainwin.ui.h mainwin.ui > mainwin.ui.cpp
moc mainwin.ui.h > mainwin.moc.cpp

g++ -c -L$QTDIR/lib -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 
-fno-default-inline -DNO_DEBUG -I$OPIEDIR/include -I$QTDIR/include 
-I/usr/include/qte2 -o mainwin.ui.o mainwin.ui.cpp

g++ -c -L$QTDIR/lib -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 
-fno-default-inline -DNO_DEBUG -I$OPIEDIR/include -I$QTDIR/include 
-I/usr/include/qte2 -o mainwin.moc.o mainwin.moc.cpp

g++ -c -L$QTDIR/lib -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 
-fno-default-inline -DNO_DEBUG -I$OPIEDIR/include -I$QTDIR/include 
-I/usr/include/qte2 -o main.o main.cpp

g++ -o main main.o mainwin.ui.o mainwin.moc.o  -L$QTDIR/lib -lqpe -lqte -lgnokii
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]