-rw-r--r-- | noncore/tools/calculator/calculator.pro | 4 | ||||
-rw-r--r-- | noncore/tools/calculator/calculatorimpl.cpp | 56 | ||||
-rw-r--r-- | noncore/tools/calculator/calculatorimpl.h | 4 | ||||
-rw-r--r-- | noncore/tools/calculator/main.cpp | 13 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 3 | ||||
-rw-r--r-- | noncore/tools/clock/clock.pro | 5 | ||||
-rw-r--r-- | noncore/tools/clock/main.cpp | 11 | ||||
-rw-r--r-- | noncore/tools/euroconv/euroconv.pro | 5 | ||||
-rw-r--r-- | noncore/tools/euroconv/main.cpp | 30 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.h | 3 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.pro | 4 | ||||
-rw-r--r-- | noncore/tools/formatter/main.cpp | 10 | ||||
-rw-r--r-- | noncore/tools/opie-sh/opie-sh.control | 2 | ||||
-rw-r--r-- | noncore/tools/remote/opie-remote.control | 2 |
15 files changed, 90 insertions, 64 deletions
diff --git a/noncore/tools/calculator/calculator.pro b/noncore/tools/calculator/calculator.pro index 0fe5bb2..8a5fcfe 100644 --- a/noncore/tools/calculator/calculator.pro +++ b/noncore/tools/calculator/calculator.pro @@ -1,33 +1,31 @@ -DESTDIR = $(OPIEDIR)/bin -TEMPLATE = app -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = calculatorimpl.h SOURCES = calculatorimpl.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe INTERFACES = calculator.ui TARGET = calculator TRANSLATIONS = ../../../i18n/de/calculator.ts \ ../../../i18n/nl/calculator.ts \ ../../../i18n/xx/calculator.ts \ ../../../i18n/en/calculator.ts \ ../../../i18n/es/calculator.ts \ ../../../i18n/fr/calculator.ts \ ../../../i18n/hu/calculator.ts \ ../../../i18n/ja/calculator.ts \ ../../../i18n/ko/calculator.ts \ ../../../i18n/no/calculator.ts \ ../../../i18n/pl/calculator.ts \ ../../../i18n/pt/calculator.ts \ ../../../i18n/pt_BR/calculator.ts \ ../../../i18n/sl/calculator.ts \ ../../../i18n/zh_CN/calculator.ts \ ../../../i18n/zh_TW/calculator.ts \ ../../../i18n/da/calculator.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/tools/calculator/calculatorimpl.cpp b/noncore/tools/calculator/calculatorimpl.cpp index 8d11132..163b4da 100644 --- a/noncore/tools/calculator/calculatorimpl.cpp +++ b/noncore/tools/calculator/calculatorimpl.cpp @@ -1,472 +1,524 @@ /********************************************************************** ** 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. ** **********************************************************************/ /* * 01/14/2002 Charles-Edouard Ruault <ce@ruault.com> * Added support for Temperature conversions. */ // Sat 03-09-2002 L.J. Potter added the inlined pixmaps here #include "calculatorimpl.h" #include <qpe/resource.h> #include <qpe/qmath.h> #include <qpe/qpeapplication.h> #include <qpushbutton.h> #include <qcombobox.h> #include <qlabel.h> #include <qfont.h> #include <qlayout.h> #include <qstringlist.h> #include <qfile.h> #include <qtextstream.h> #include <qmessagebox.h> #include <math.h> /* XPM */ static char *oneoverx_xpm[] = { /* width height num_colors chars_per_pixel */ " 13 11 2 1", /* colors */ ". c None", "# c #000000", /* pixels */ "......#......", ".....##......", "......#......" ".....###.....", ".............", "..#########..", ".............", "....##.##....", "......#......", "......#......", "....##.##....", }; /* XPM */ static char *ythrootofx_xpm[] = { /* width height num_colors chars_per_pixel */ " 13 11 2 1", /* colors */ ". c None", "# c #000000", /* pixels */ "#.#..........", "#.#..........", "###...#######", "..#..#.......", "###..#.......", ".....#.#...#.", ".#..#...#.#..", "#.#.#....#...", "..#.#...#.#..", "...#...#...#.", "...#........." }; /* XPM */ static char *xtopowerofy_xpm[] = { /* width height num_colors chars_per_pixel */ " 9 8 2 1", /* colors */ ". c None", "# c #000000", /* pixels */ "......#.#", "......#.#", "......###", "#...#...#", ".#.#..###", "..#......", ".#.#.....", "#...#...." }; CalculatorImpl::CalculatorImpl( QWidget * parent, const char * name, WFlags f ) : Calculator( parent, name, f ) { // xtopowerofy = Resource::loadPixmap("xtopowerofy"); // ythrootofx = Resource::loadPixmap("ythrootofx"); // oneoverx = Resource::loadPixmap("oneoverx"); memMark = new QLabel( "m", LCD ); memMark->setFont( QFont( "helvetica", 12, QFont::Bold, TRUE ) ); memMark->resize( 12, 12 ); memMark->move( 4, 2 ); memMark->hide(); mem = 0; PushButtonMR->setEnabled( FALSE ); current_mode = max_mode = conversion_mode_count = 0; last_conversion = -1; + // translation trick mode - with this stuff parsed in from a file is translatable + QObject::tr("Standard"); + QObject::tr("Weight"); + QObject::tr("Distance"); + QObject::tr("Area"); + QObject::tr("Temperatures"); + QObject::tr("Volume"); + QObject::tr("acres"); + QObject::tr("°C"); + QObject::tr("carats"); + QObject::tr("cm"); + QObject::tr("cu cm"); + QObject::tr("cu ft"); + QObject::tr("cu in"); + QObject::tr("°F"); + QObject::tr("fl oz (US)"); + QObject::tr("ft"); + QObject::tr("g"); + QObject::tr("gal (US)"); + QObject::tr("hectares"); + QObject::tr("in"); + QObject::tr("kg"); + QObject::tr("km"); + QObject::tr("l"); + QObject::tr("lb"); + QObject::tr("Lg tons"); + QObject::tr("m"); + QObject::tr("mg"); + QObject::tr("mi"); + QObject::tr("ml"); + QObject::tr("mm"); + QObject::tr("naut. mi"); + QObject::tr("oz"); + QObject::tr("points"); + QObject::tr("pt"); + QObject::tr("qt"); + QObject::tr("sq cm"); + QObject::tr("sq ft"); + QObject::tr("sq in"); + QObject::tr("sq km"); + QObject::tr("sq m"); + QObject::tr("sq mi"); + QObject::tr("sq mm"); + QObject::tr("sq yd"); + QObject::tr("st"); + QObject::tr("St tons"); + QObject::tr("tblspoon"); + QObject::tr("teaspoons"); + QObject::tr("tonnes"); + QObject::tr("yd"); + + //bgr_command.insert( PushButtonFunction); bgr_command.insert( PushButtonMPlus); bgr_command.insert( PushButtonMR); bgr_command.insert( PushButtonMC); bgr_command.insert( PushButtonCE); connect( &bgr_command, SIGNAL(clicked(int) ), this, SLOT(command_buttons(int))); bgr_digits.insert(PushButton0); bgr_digits.insert(PushButton1); bgr_digits.insert(PushButton2); bgr_digits.insert(PushButton3); bgr_digits.insert(PushButton4); bgr_digits.insert(PushButton5); bgr_digits.insert(PushButton6); bgr_digits.insert(PushButton7); bgr_digits.insert(PushButton8); bgr_digits.insert(PushButton9); connect( &bgr_digits, SIGNAL(clicked(int) ), this, SLOT(enterNumber(int))); bgr_std.insert(PushButtonEquals); bgr_std.insert(PushButtonDecimal); bgr_std.insert(PushButtonAdd); bgr_std.insert(PushButtonMinus); bgr_std.insert(PushButtonDivide); bgr_std.insert(PushButtonTimes); connect( &bgr_std, SIGNAL(clicked(int) ), this, SLOT(std_buttons(int))); // change the / to a proper division signal PushButtonDivide->setText(QChar(0xF7)); func_buttons[0] = PushButtonF1; func_buttons[1] = PushButtonF2; func_buttons[2] = PushButtonF3; func_buttons[3] = PushButtonF4; func_buttons[4] = PushButtonF5; func_buttons[5] = PushButtonF6; func_buttons[6] = PushButtonF7; func_buttons[7] = PushButtonF8; func_buttons[8] = PushButtonF9; func_buttons[9] = PushButtonF10; func_buttons[10] = PushButtonF11; func_buttons[11] = PushButtonF12; for ( int x = 0 ; x < func_button_count ; x++ ) { QPushButton* tmpbutton = func_buttons[x]; faces << tmpbutton->text(); bgr_function.insert(tmpbutton); } connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(do_convert(int) ) ); connect( &bgr_function, SIGNAL(clicked(int) ) , this, SLOT(std_funcs (int) ) ); connect(ComboBoxFunction, SIGNAL(activated(int) ), this, SLOT(function_button(int) ) ); captions.append(tr("Standard")); ComboBoxFunction->insertItem(captions.last()); // now add in the conversion modes // when the menu gets done, these should be in a submenu QString tmp = QPEApplication::qpeDir(); tmp += "etc/unit_conversion.dat"; QFile myfile(tmp); if ( !myfile.open( IO_Translate | IO_ReadOnly ) ) { qDebug("Data file unit_conversion.dat not found\nNo conversion features will be available\n"+tmp); // disable the f button if no conv file available ComboBoxFunction->setEnabled(FALSE); } else { QString line, line2; QTextStream ts(&myfile); // first pass, see how many conversion types there are in order to allocate for them while ( ! ts.eof() ) { line = ts.readLine(); if ( line.contains ("STARTTYPE" ) ) conversion_mode_count++; } entry_list = new double[conversion_mode_count*func_button_count]; preoffset_list = new double[conversion_mode_count*func_button_count]; postoffset_list = new double[conversion_mode_count*func_button_count]; myfile.close(); myfile.open( IO_Translate | IO_ReadOnly ); QTextStream ts2(&myfile); // second pass, read in values int x = 0; while ( ! ts2.eof() ) { line = ts2.readLine(); if ( line.contains("STARTTYPE") ) { - captions << line.remove(0,10); + captions << tr( line.remove(0,10) ); ComboBoxFunction->insertItem(captions.last()); while ( !line.contains("ENDTYPE") ) { line = ts2.readLine(); if ( line.contains("NAME") ) { - faces << line.remove(0,5); + faces << tr( line.remove(0,5) ); line2 = ts2.readLine(); line2.remove(0,6); entry_list[x] = line2.toDouble(); line2 = ts2.readLine(); line2.remove(0,7); preoffset_list[x] = line2.toDouble(); line2 = ts2.readLine(); line2.remove(0,8); postoffset_list[x] = line2.toDouble(); x++; } } } } } myfile.close(); clear(); max_mode = pre_conv_modes_count + conversion_mode_count + post_conv_modes_count - 1; display_pixmap_faces(); qApp->installEventFilter( this ); } bool CalculatorImpl::eventFilter( QObject *o, QEvent *e ) { if ( e->type() == QEvent::KeyPress && state != sError ) { QKeyEvent *k = (QKeyEvent*)e; if ( k->key() >= Key_0 && k->key() <= Key_9 ) { enterNumber( k->key() - Key_0 ); return true; } else { switch ( k->key() ) { case Key_Equal: std_buttons(0); return true; case Key_Period: std_buttons(1); return true; case Key_Plus: std_buttons(2); return true; case Key_Minus: std_buttons(3); return true; case Key_Slash: std_buttons(4); return true; case Key_Asterisk: std_buttons(5); return true; case Key_Percent: execOp( oPercent ); return true; case Key_ParenLeft: if ( current_mode < pre_conv_modes_count ) execOp( oOpenBrace ); return true; case Key_ParenRight: if ( current_mode < pre_conv_modes_count ) execOp( oCloseBrace ); return true; default: break; } } } return Calculator::eventFilter( o, e ); } void CalculatorImpl::do_convert(int button) { if ( state == sError ) return; if ( current_mode >= pre_conv_modes_count && current_mode <= (max_mode - post_conv_modes_count) && button < changeable_func_button_count ) { if ( last_conversion > -1 ) { if( state == sNewNumber ){ acc = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) +postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button]; num = acc; LCD->display( acc ); } else { state = sNewNumber; num = (num+ preoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) / (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + last_conversion]) * (entry_list[(current_mode - pre_conv_modes_count) * func_button_count + button]) + postoffset_list[(current_mode - pre_conv_modes_count) * func_button_count + button];; LCD->display( num ); acc = num; } } last_conversion = button; } } void CalculatorImpl::function_button(int mode){ if ( state == sError ) clear(); // dont need the next line when using a popup menu current_mode = mode; // reset the last conv last_conversion = -1; // set the caption this->setCaption( captions[current_mode] ); reset_conv(); for ( int x = 0 ; x < changeable_func_button_count ; x++ ) { QPushButton* tmpbutton = func_buttons[x]; // if its a conversion , make it a toggle button if ( current_mode >= pre_conv_modes_count && current_mode <= (max_mode - post_conv_modes_count) ) { tmpbutton->setToggleButton(TRUE); } else { tmpbutton->setToggleButton(FALSE); } tmpbutton->setText( faces[current_mode * func_button_count + x] ); } if ( current_mode == 0 ) display_pixmap_faces(); if ( current_mode >= pre_conv_modes_count && current_mode <= (max_mode - post_conv_modes_count) ) { bgr_function.setExclusive(TRUE); } else { bgr_function.setExclusive(FALSE); } } void CalculatorImpl::display_pixmap_faces() { QPixmap image0( ( const char** ) xtopowerofy_xpm); QPushButton* tmpbutton = func_buttons[5]; tmpbutton->setPixmap(image0); QPixmap image1( ( const char** ) ythrootofx_xpm); tmpbutton = func_buttons[6]; tmpbutton->setPixmap(image1); QPixmap image2( ( const char** ) oneoverx_xpm); tmpbutton = func_buttons[3]; tmpbutton->setPixmap(image2); } void CalculatorImpl::clear() { acc = num = 0; operationStack.clear(); state = sStart; numDecimals = 0; numOpenBraces = 0; flPoint = FALSE; LCD->display( 0 ); fake = QString::null; reset_conv(); } void CalculatorImpl::reset_conv() { for ( int x = 0 ; x < changeable_func_button_count ; x++ ) { QPushButton* tmpbutton = func_buttons[x]; // dont carry any selections into the next mode if ( tmpbutton->state() == QPushButton::On ) { tmpbutton->toggle(); } } last_conversion = -1; } void CalculatorImpl::std_buttons(int button) { if ( state == sError ) return; execOp( (Operation)(button + oSum) ); } void CalculatorImpl::std_funcs(int button) { if ( state == sError ) return; if ( current_mode < pre_conv_modes_count || button > changeable_func_button_count-1 ) { Operation op; if ( button < 10 ) op = (Operation)(button + oSin); else if ( button == 10 ) op = oOpenBrace; else op = oCloseBrace; execOp( op ); } } void CalculatorImpl::execOp( Operation i ) { switch (i) { // these operators only affect the current number. case oDivX: case oLog: case oLn: case oSin: case oCos: case oTan: num = evalExpr(i); break; case oAdd: case oSub: { processStack( oAdd ); Op op( num, i ); operationStack.push( op ); break; } case oDiv: case oMult: case oRoot: case oXsquared: { processStack( oDiv ); Op op( num, i ); operationStack.push( op ); break; } case oChSign: num = -num; LCD->display(num); return; case oOpenBrace: { Op op( 0, oOpenBrace ); operationStack.push( op ); numOpenBraces++; state = sNewNumber; return; } case oCloseBrace: { if ( numOpenBraces == 0 ) return; processStack( oAdd ); if ( operationStack.top().operation != oOpenBrace ) qDebug( "Calculator: internal Error" ); operationStack.pop(); state = sNewNumber; numOpenBraces--; break; } case oPoint: flPoint = TRUE; return; case oPercent: processStack( oPercent ); break; diff --git a/noncore/tools/calculator/calculatorimpl.h b/noncore/tools/calculator/calculatorimpl.h index f0180c9..06ec829 100644 --- a/noncore/tools/calculator/calculatorimpl.h +++ b/noncore/tools/calculator/calculatorimpl.h @@ -1,137 +1,139 @@ /********************************************************************** ** 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. ** **********************************************************************/ #ifndef CALCULATORIMPL_H #define CALCULATORIMPL_H #include <qlcdnumber.h> #include "calculator.h" #include <qpushbutton.h> #include <qbuttongroup.h> #include <qvaluestack.h> // mode x functions enum Operation { oNop, oOpenBrace, oCloseBrace, oSum, oPoint, oAdd, oSub, oDiv, oMult, // mode 0 functions oSin, oCos, oTan, oDivX, oPercent, oXsquared, oRoot, oLog, oLn, oChSign }; // states #define sStart 0 #define sNewNumber 1 #define sError 2 struct Op { Op() { number = 0; operation = oNop; } Op( double num, Operation op ) { number = num; operation = op; } double number; Operation operation; }; class QLabel; class CalculatorImpl : public Calculator { Q_OBJECT public: CalculatorImpl( QWidget * parent = 0, const char * name = 0, - WFlags f = 0 ); + WFlags f = 0 ); + static QString appName() { return QString::fromLatin1("calculator"); } + public slots: void command_buttons(int); void enterNumber(int i); void std_buttons(int); void std_funcs(int); void do_convert(int); void function_button(int); protected: virtual bool eventFilter( QObject *o, QEvent *e ); private: void clear(); void reset_conv(); void processStack( int op ); QValueStack<Op> operationStack; int state; double acc, num, mem; int numDecimals; bool flPoint; int numOpenBraces; void execOp( Operation i ); double evalExpr( int op ); QLabel * memMark; QString fake; // useful values for conversion stuff int current_mode, max_mode, conversion_mode_count, last_conversion; // make adding new modes easier for ourselves static const int pre_conv_modes_count = 1; static const int post_conv_modes_count = 0; // an array of pointers to the func buttons static const int func_button_count = 12; // this is an abomination static const int changeable_func_button_count = 10; QPushButton* func_buttons[func_button_count]; QButtonGroup bgr_function, bgr_digits, bgr_std, bgr_command; QStringList faces, captions; // an array of doubles holding the conversion ratios double* entry_list; double* preoffset_list; double* postoffset_list; QPixmap xtopowerofy; QPixmap ythrootofx; QPixmap oneoverx; void display_pixmap_faces(void); }; #endif diff --git a/noncore/tools/calculator/main.cpp b/noncore/tools/calculator/main.cpp index 74cd5d3..c4d00b1 100644 --- a/noncore/tools/calculator/main.cpp +++ b/noncore/tools/calculator/main.cpp @@ -1,35 +1,26 @@ /********************************************************************** ** 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 "calculatorimpl.h" #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main( int argc, char ** argv ) -{ - QPEApplication a( argc, argv ); - - CalculatorImpl mw; - QPEApplication::setInputMethodHint( &mw, QPEApplication::AlwaysOff ); - mw.setCaption( CalculatorImpl::tr("Calculator") ); - a.showMainWidget( &mw ); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<CalculatorImpl> ) diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index fa12b61..00d097d 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h @@ -1,109 +1,112 @@ /********************************************************************** ** 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. ** **********************************************************************/ #ifndef CLOCK_H #define CLOCK_H #include <qdatetime.h> #include <qvbox.h> #include <qpixmap.h> class QLCDNumber; class QLabel; class QTimer; class QRadioButton; class QPushButton; class QDateTime; class AnalogClock : public QFrame { Q_OBJECT public: AnalogClock( QWidget * parent = 0, const char * name = 0 ); QSizePolicy sizePolicy() const; void display( const QTime& time ); + protected: void drawContents( QPainter *p ); private: QPixmap bg; QTime currTime; QTime prevTime; bool clear; QPoint rotate( QPoint center, QPoint p, int angle ); void drawPointers ( QPainter *, const QRect &r, const QColor &c, const QTime &t, const QTime *t2 = 0 ); }; class Clock : public QVBox { Q_OBJECT public: Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); ~Clock(); QDateTime when; bool bSound; int hour, minute, snoozeTime; + static QString appName() { return QString::fromLatin1("clock"); } + private slots: void slotSet(); void slotReset(); void modeSelect(int); void updateClock(); void changeClock( bool ); void slotSetAlarm(); void slotSnooze(); void slotToggleAlarm(); void alarmOn(); void alarmOff(); void appMessage(const QCString& msg, const QByteArray& data); void timerEvent( QTimerEvent *e ); void slotAdjustTime(); void slotStartTimer(); void slotStopTimer(); void slotResetTimer(); void setSwatchMode( int ); private: bool alarmBool; QTimer *t; QLCDNumber *lcd; QLabel *date; QLabel *ampmLabel; QPushButton *set, *reset, *alarmBtn, *snoozeBtn, *alarmOffBtn; QRadioButton *clockRB, *swatchRB; AnalogClock *aclock; QTime swatch_start; int swatch_totalms; bool swatch_running; bool ampm; void clearClock(); void clearTimer(); void startSWatch(); void stopSWatch(); }; #endif diff --git a/noncore/tools/clock/clock.pro b/noncore/tools/clock/clock.pro index 38ce2f8..9890b3a 100644 --- a/noncore/tools/clock/clock.pro +++ b/noncore/tools/clock/clock.pro @@ -1,33 +1,30 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG = qt warn_on release quick-app HEADERS = clock.h setAlarm.h SOURCES = clock.cpp setAlarm.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -lpthread -INTERFACES = TARGET = clock TRANSLATIONS = ../../../i18n/de/clock.ts \ ../../../i18n/nl/clock.ts \ ../../../i18n/xx/clock.ts \ ../../../i18n/en/clock.ts \ ../../../i18n/es/clock.ts \ ../../../i18n/fr/clock.ts \ ../../../i18n/hu/clock.ts \ ../../../i18n/ja/clock.ts \ ../../../i18n/ko/clock.ts \ ../../../i18n/no/clock.ts \ ../../../i18n/pl/clock.ts \ ../../../i18n/pt/clock.ts \ ../../../i18n/pt_BR/clock.ts \ ../../../i18n/sl/clock.ts \ ../../../i18n/zh_CN/clock.ts \ ../../../i18n/zh_TW/clock.ts \ ../../../i18n/da/clock.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/tools/clock/main.cpp b/noncore/tools/clock/main.cpp index cbfb73b..4a5e523 100644 --- a/noncore/tools/clock/main.cpp +++ b/noncore/tools/clock/main.cpp @@ -1,34 +1,27 @@ /********************************************************************** ** 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 "clock.h" #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main( int argc, char ** argv ) -{ - QPEApplication a( argc, argv ); - Clock mw; - mw.setCaption( Clock::tr("Clock") ); - a.showMainWidget( &mw ); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<Clock> ) diff --git a/noncore/tools/euroconv/euroconv.pro b/noncore/tools/euroconv/euroconv.pro index d817dd3..2b732da 100644 --- a/noncore/tools/euroconv/euroconv.pro +++ b/noncore/tools/euroconv/euroconv.pro @@ -1,14 +1,13 @@ -TEMPLATE = app -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = calcdisplay.h \ calckeypad.h SOURCES = calcdisplay.cpp \ calckeypad.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -DESTDIR = $(OPIEDIR)/bin INTERFACES = TARGET = euroconv + include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/tools/euroconv/main.cpp b/noncore/tools/euroconv/main.cpp index 7d69535..b765a5e 100644 --- a/noncore/tools/euroconv/main.cpp +++ b/noncore/tools/euroconv/main.cpp @@ -1,39 +1,37 @@ /**************************************************************************** * * File: main.cpp * * Description: main file for OPIE Euroconv aapp * * * Authors: Eric Santonacci <Eric.Santonacci@talc.fr> * * Requirements: Qt * - * $Id$ * ***************************************************************************/ #include <qpe/qpeapplication.h> #include <qvbox.h> -//#include <qapplication.h> #include "calcdisplay.h" #include "calckeypad.h" +#include <opie/oapplicationfactory.h> - -int main( int argc, char **argv ) { - - QPEApplication app( argc, argv ); - - QVBox *layout = new QVBox(0, "fond"); +struct Layout : QVBox{ + static QString appName() { return QString::fromLatin1("euroconv"); } + Layout(QWidget *p, const char* n, WFlags) + :QVBox(0,"fond" ) + { + LCDDisplay *lcd = new LCDDisplay(this, "lcd"); + KeyPad *num = new KeyPad(lcd, this, "keypad"); - LCDDisplay lcd (layout, "lcd"); - KeyPad num(&lcd, layout, "keypad"); - app.setMainWidget(layout); - layout->setCaption( QObject::tr("Euroconv") ); - layout->showMaximized (); - layout->show(); - return app.exec(); -} + setCaption( QObject::tr("Euroconv") ); + }; + +}; + +OPIE_EXPORT_APP( OApplicationFactory<Layout> ) diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index 49f6355..a8dd11c 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp @@ -1,313 +1,313 @@ /**************************************************************************** ** formatter.cpp ** ** Copyright: Thu Apr 11 11:01:13 2002 ** by: L. J. Potter ** ****************************************************************************/ #include "formatter.h" #include "inputDialog.h" #include "output.h" #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/storage.h> #include <qmultilineedit.h> #include <qstring.h> #include <qlist.h> #include <qstringlist.h> #include <qdir.h> #include <qfile.h> #include <qtstream.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qregexp.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qtabwidget.h> #include <qwidget.h> #include <qlayout.h> #include <qvariant.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/vfs.h> #include <mntent.h> #include <string.h> #include <errno.h> #define BLANK ' ' #define DELIMITER '#' /* Blah blah blah blah */ -FormatterApp::FormatterApp( QWidget* parent, const char* name, bool , WFlags fl ) +FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool modal ) : QMainWindow( parent, name, fl ) // : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "FormatterApp" ); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); setCaption( tr( "Formatter" ) ); FormatterAppLayout = new QGridLayout( this ); FormatterAppLayout->setSpacing( 2); FormatterAppLayout->setMargin( 2 ); TabWidget = new QTabWidget( this, "TabWidget" ); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 3); tabLayout->setMargin( 2); storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); storageComboBox->setMaximumWidth(220); tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); TextLabel4 = new QLabel( tab, "TextLabel4" ); TextLabel4->setText( tr( "Storage Type" ) ); tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1); TextLabel2 = new QLabel( tab, "TextLabel2" ); TextLabel2->setText( tr( "File Systems" ) ); tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); fileSystemsCombo->setMaximumWidth(220); tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); tabLayout->addItem( spacer, 2, 0 ); formatPushButton = new QPushButton( tab, "formatPushButton" ); formatPushButton->setText( tr( "Format" ) ); formatPushButton->setMaximumWidth(170); tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); tabLayout->addItem( spacer_2, 5, 0 ); TabWidget->insertTab( tab, tr( "Main" ) ); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); tabLayout_2->setSpacing(3); tabLayout_2->setMargin(2); mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); TextLabel5 = new QLabel( tab_2, "TextLabel5" ); TextLabel5->setText( tr( "CAUTION:\n" "Changing parameters on this\n" "page may cause your system\n" "to stop functioning properly!" ) );//idiot message tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); editPushButton = new QPushButton( tab_2, "editPushButton" ); editPushButton->setText( tr( "Edit fstab" ) ); editPushButton->setMaximumWidth(100); tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); fsckButton = new QPushButton( tab_2, "fsckPushButton" ); fsckButton->setText( tr( "Check Disk" ) ); fsckButton->setMaximumWidth(100); tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); TextLabel3 = new QLabel( tab_2, "TextLabel3" ); TextLabel3->setText( tr( "Device" ) ); tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_2->addItem( spacer_3, 5, 0 ); TextLabel1 = new QLabel( tab_2, "TextLabel1" ); TextLabel1->setText( tr( "Mount Point" ) ); tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); tabLayout_2->addItem( spacer_4, 2, 1 ); TabWidget->insertTab( tab_2, tr( "Advanced" ) ); FormatterAppLayout->addWidget( TabWidget, 0, 1 ); connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); fillCombos(); } FormatterApp::~FormatterApp() { } void FormatterApp::doFormat() { int err=0; Output *outDlg; QString umountS, remountS; QString text = storageComboBox->currentText(); QString currentText = storageComboBox->currentText(); QString cmd; QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); QString fs = fileSystemsCombo->currentText(); #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap #else currentText = diskDevice = "/dev/fd0"; umountS = "umount -v /floppy 2>&1"; remountS = "mount -v /floppy 2>&1"; #endif if( currentText.find("CF",0,TRUE) != -1) { umountS = "umount "; remountS = "mount "; // umountS = "/sbin/cardctl eject"; // remountS = "/sbin/cardctl insert"; } if( currentText.find("SD",0,TRUE) != -1) { umountS = "umount "; remountS = "mount "; // umountS = "/etc/sdcontrol compeject"; // remountS = "/etc/sdcontrol insert"; } switch ( QMessageBox::warning(this,tr("Format?") , tr("Really format\n") +diskName+" "+ currentText + tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) ,tr("Yes") ,tr("No") ,0 ,1 ,1) ) { case 0: { if(fs == "vfat") cmd = "mkdosfs -v " + diskDevice+" 2>&1"; else if(fs == "ext2") cmd = "mke2fs -v " + diskDevice+" 2>&1"; else { QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); break; } // cmd = "ls -l"; outDlg = new Output(this, tr("Formatter Output"),FALSE); outDlg->showMaximized(); outDlg->show(); qApp->processEvents(); FILE *fp; char line[130]; outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); sleep(1); qDebug("Command is "+umountS); fp = popen( (const char *) umountS, "r"); // qDebug("%d", fp); if ( !fp ) { qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); pclose(fp); return; } else { // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("busy",0,TRUE) != -1) { qDebug("Could not find '" + umountS); QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); pclose(fp); return; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } } pclose(fp); qDebug("Command would be: "+cmd); outDlg->OutputEdit->append( tr("Trying to format.") ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); fp = popen( (const char *) cmd, "r"); while ( fgets( line, sizeof line, fp)) { if( ((QString)line).find("No such device",0,TRUE) != -1) { qDebug("No such device '" + umountS); QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); pclose(fp); // outDlg->OutputEdit->append("No such device"); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); return; } else { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); pclose(fp); outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); fp = popen( (const char *) remountS, "r"); if ( !fp) { qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); } else { outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); while ( fgets( line, sizeof line, fp)) { QString lineStr = line; lineStr=lineStr.left(lineStr.length()-1); outDlg->OutputEdit->append(lineStr); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); } } pclose(fp); sleep(1); outDlg->OutputEdit->append(tr("You can now close the output window.")); outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); // outDlg->close(); // if(outDlg) // delete outDlg; } break; diff --git a/noncore/tools/formatter/formatter.h b/noncore/tools/formatter/formatter.h index 960a68a..faf0b30 100644 --- a/noncore/tools/formatter/formatter.h +++ b/noncore/tools/formatter/formatter.h @@ -1,65 +1,66 @@ /**************************************************************************** ** formatter.h ** ** Copyright: Thu Apr 11 11:01:01 2002 ** by: L.J. Potter ** ****************************************************************************/ #ifndef FORMATTERAPP_H #define FORMATTERAPP_H #include <qvariant.h> //#include <qdialog.h> #include <qmainwindow.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QComboBox; class QLabel; class QLineEdit; class QPushButton; class QTabWidget; class QWidget; class QStringList; class FormatterApp : public QMainWindow //public QDialog { Q_OBJECT public: - FormatterApp( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + static QString appName() { return QString::fromLatin1("formatter"); } + FormatterApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0, bool modal = FALSE ); ~FormatterApp(); QTabWidget *TabWidget; QWidget *tab, *tab_2;; QLabel *TextLabel1, *TextLabel2, *TextLabel3, *TextLabel4, *TextLabel5; QComboBox *storageComboBox, *fileSystemsCombo, *deviceComboBox; QPushButton *formatPushButton, *editPushButton, *fsckButton; QLineEdit* mountPointLineEdit; QStringList fileSystemTypeList, fsList, deviceList; protected: QGridLayout *FormatterAppLayout, *tabLayout, *tabLayout_2; QString getFileSystemType(const QString &); void fillCombos(); void parsetab(const QString &); bool doFdisk(); int formatCheck(const QString &); int runCommand(const QString &); protected slots: void cleanUp(); void doFormat(); void editFstab(); bool doFsck(); bool doFsckCheck(); void fsComboSelected(int); void storageComboSelected(int ); void deviceComboSelected(int ); }; #endif // FORMATTERAPP_H diff --git a/noncore/tools/formatter/formatter.pro b/noncore/tools/formatter/formatter.pro index baf6ace..17aab57 100644 --- a/noncore/tools/formatter/formatter.pro +++ b/noncore/tools/formatter/formatter.pro @@ -1,31 +1,29 @@ -TEMPLATE = app -CONFIG += qt warn_on release +CONFIG += qt warn_on release quick-app HEADERS = formatter.h inputDialog.h output.h SOURCES = formatter.cpp inputDialog.cpp output.cpp main.cpp TARGET = formatter -DESTDIR = $(OPIEDIR)/bin INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe TRANSLATIONS = ../../../i18n/de/formatter.ts \ ../../../i18n/nl/formatter.ts \ ../../../i18n/da/formatter.ts \ ../../../i18n/xx/formatter.ts \ ../../../i18n/en/formatter.ts \ ../../../i18n/es/formatter.ts \ ../../../i18n/fr/formatter.ts \ ../../../i18n/hu/formatter.ts \ ../../../i18n/ja/formatter.ts \ ../../../i18n/ko/formatter.ts \ ../../../i18n/no/formatter.ts \ ../../../i18n/pl/formatter.ts \ ../../../i18n/pt/formatter.ts \ ../../../i18n/pt_BR/formatter.ts \ ../../../i18n/sl/formatter.ts \ ../../../i18n/zh_CN/formatter.ts \ ../../../i18n/zh_TW/formatter.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/tools/formatter/main.cpp b/noncore/tools/formatter/main.cpp index f67c9f2..6228e55 100644 --- a/noncore/tools/formatter/main.cpp +++ b/noncore/tools/formatter/main.cpp @@ -1,25 +1,19 @@ /*************************************************************************** main.cpp - description ------------------- begin : March 10, 2002 copyright : (C) 2002 by llornkcor email : ljp@llornkcor.com * 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. * ***************************************************************************/ #include <qpe/qpeapplication.h> #include "formatter.h" -int main(int argc, char *argv[]) -{ - QPEApplication a(argc, argv); - - FormatterApp formatterApp; - a.showMainWidget( &formatterApp); - return a.exec(); -} +#include <opie/oapplicationfactory.h> +OPIE_EXPORT_APP( OApplicationFactory<FormatterApp> ) diff --git a/noncore/tools/opie-sh/opie-sh.control b/noncore/tools/opie-sh/opie-sh.control index a5619ce..f03e5ac 100644 --- a/noncore/tools/opie-sh/opie-sh.control +++ b/noncore/tools/opie-sh/opie-sh.control @@ -1,11 +1,11 @@ Package: opie-sh -Files: plugins/application/libopie-sh.so* bin/opie-sh bin/opie-sh-howto.sh apps/Opie-SH/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html +Files: bin/opie-sh apps/Opie-SH/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html Priority: optional Section: opie/applications Maintainer: Thomas Stephens <spiralman@softhome.net> Architecture: arm Version: 0.5-$SUB_VERSION Depends: task-opie-minimal License: GPL Description: a QDialog shell frontend A program to let you use various dialogs from the console (or a shell script) diff --git a/noncore/tools/remote/opie-remote.control b/noncore/tools/remote/opie-remote.control index 78bfbc9..d29bb06 100644 --- a/noncore/tools/remote/opie-remote.control +++ b/noncore/tools/remote/opie-remote.control @@ -1,11 +1,11 @@ Package: opie-remote -Files: plugins/application/libremote.so* bin/remote apps/Applications/remote.desktop pics/remote/*.png +Files: bin/remote apps/Applications/remote.desktop pics/remote/*.png Priority: optional Section: opie/applications Maintainer: Thomas Stephens <spiralman@softhome.net> Architecture: arm Version: $QPE_VERSION$EXTRAVERSION Depends: task-opie-minimal, lirc License: GPL Description: a remote control A remote control using irda. A frontend to lirc. |