author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (side-by-side diff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /examples | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-0d59c780513da78033f4d9040475dee9db0256d4.zip opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2 |
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you
can check the diff (but it had compiled and run here)
-rw-r--r-- | examples/main-tab/simple.cpp | 2 | ||||
-rw-r--r-- | examples/simple-pim/simple.cpp | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/main-tab/simple.cpp b/examples/main-tab/simple.cpp index 69dd00f..c5a6d5a 100644 --- a/examples/main-tab/simple.cpp +++ b/examples/main-tab/simple.cpp @@ -11,65 +11,65 @@ #include <opie/oapplicationfactory.h> // a template + macro to save the main method and allow quick launching #include <opie/otabwidget.h> #include "simple.h" /* * implementation of simple */ /* * The factory is used for quicklaunching * It needs a constructor ( c'tor ) with at least QWidget, const char* and WFlags as parameter and a static QString appName() matching the TARGET of the .pro * * Depending on the global quick launch setting this will create * either a main method or one for our component plugin system */ OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { setCaption(tr("My MainWindow") ); initUI(); /* * Tab widget as central */ OTabWidget *tab = new OTabWidget(this); connect(tab, SIGNAL(currentChanged(QWidget*) ), - this, SLOT( slotCurrentChanged( QWidget* ) ) ); + this, SLOT( slotCurrentChanged(QWidget*) ) ); setCentralWidget( tab ); Simple1 *simple1 = new Simple1( this ); tab->addTab( simple1, "new", tr("Simple1") ); tab->setCurrentTab( tr("Simple1") ); Simple2 *simple2 = new Simple2( this ); tab->addTab( simple2, "trash", tr("Simple2") ); m_oldCurrent = simple1; connect(m_fire, SIGNAL(activated() ), simple1, SLOT(slotFire() ) ); } MainWindow::~MainWindow() { // again nothing to delete because Qt takes care } void MainWindow::setDocument( const QString& /*str*/ ) { } void MainWindow::slotCurrentChanged( QWidget *wid) { disconnect(m_fire, SIGNAL(activated() ), m_oldCurrent, SLOT(slotFire() ) ); connect(m_fire, SIGNAL(activated() ), wid, SLOT(slotFire() ) ); m_oldCurrent = wid; } void MainWindow::initUI() { diff --git a/examples/simple-pim/simple.cpp b/examples/simple-pim/simple.cpp index 3e9fcd3..029e71b 100644 --- a/examples/simple-pim/simple.cpp +++ b/examples/simple-pim/simple.cpp @@ -50,68 +50,68 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags fl ) /* * Tab widget as central */ m_tab = new OTabWidget(this); setCentralWidget( m_tab ); m_todoView = new PIMListView(m_tab, "Todo view" ); m_tab->addTab( m_todoView,"todo/TodoList", tr("Todos") ); m_dateView = new PIMListView(m_tab, "Datebook view" ); m_tab->addTab( m_dateView, "datebook/DateBook", tr("Events") ); /* now connect the actions */ /* * we connect the activated to our show * and on activation we will show a detailed * summary of the record */ connect(m_fire, SIGNAL(activated() ), this, SLOT(slotShow() ) ); /* * We will change the date */ connect(m_dateAction, SIGNAL(activated() ), this, SLOT(slotDate() ) ); /* * connect the show signal of the PIMListView * to a slot to show a dialog */ - connect(m_todoView, SIGNAL(showRecord(const OPimRecord& ) ), - this, SLOT(slotShowRecord(const OPimRecord& ) ) ); - connect(m_dateView, SIGNAL(showRecord(const OPimRecord& ) ), - this, SLOT(slotShowRecord(const OPimRecord& ) ) ); + connect(m_todoView, SIGNAL(showRecord(const OPimRecord&) ), + this, SLOT(slotShowRecord(const OPimRecord&) ) ); + connect(m_dateView, SIGNAL(showRecord(const OPimRecord&) ), + this, SLOT(slotShowRecord(const OPimRecord&) ) ); /* * Now comes the important lines of code for this example * We do not directly call load but delay loading until * all Events are dispatches and handled. * SO we will load once our window is mapped to screen * to achieve that we use a QTimer::singleShot * After 10 milli seconds the timer fires and on TimerEvent * out slot slotLoad will be called * Remember this a Constructor to construct your object and not * to load */ QTimer::singleShot( 10, this, SLOT(slotLoad() ) ); } MainWindow::~MainWindow() { // again nothing to delete because Qt takes care } void MainWindow::setDocument( const QString& /*str*/ ) { } void MainWindow::initUI() { setToolBarsMovable( false ); QToolBar *menuBarHolder = new QToolBar( this ); menuBarHolder->setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( menuBarHolder ); @@ -160,66 +160,66 @@ void MainWindow::slotLoad() { * the IPC system to get a current copy */ /* NOTES to QCOP: QCOP operates over channels and use QDataStream * to send data. You can check if a channel isRegistered or hook * yourself to that channel. A Channel is QCString and normally * prefix with QPE/ and then the system in example QPE/System, * QPE/Desktop a special channel is the application channel * it QPE/Application/appname this channel gets created on app * startup by QPEApplication. QCOP is asynchronous * * To send you'll use QCopEnevelope * */ /* * What we will do is first is get to know if either * datebook or todolist are running if so we will kindly * asked to save the data for us. * If neither are running we can load directly */ if (!QCopChannel::isRegistered("QPE/Application/todolist") && !QCopChannel::isRegistered("QPE/Application/datebook") ) { m_db.load(); m_tb.load(); return slotLoadForDay( QDate::currentDate() ); } /* * prepare our answer machine the QCopChannel * QPE/Desktop will send "flushDone(QString)" when * the flush is done it emits a signal on receive */ m_desktopChannel = new QCopChannel("QPE/Desktop"); - connect(m_desktopChannel, SIGNAL(received(const QCString&, const QByteArray& ) ), - this, SLOT(slotDesktopReceive(const QCString&, const QByteArray& ) ) ); + connect(m_desktopChannel, SIGNAL(received(const QCString&,const QByteArray&) ), + this, SLOT(slotDesktopReceive(const QCString&,const QByteArray&) ) ); /* the numberof synced channels will be set to zero */ m_synced = 0; /* * We use {} around the QCopEnvelope because it sends its * data on destruction of QCopEnvelope with */ /* check again if not present increment synced*/ if ( QCopChannel::isRegistered("QPE/Application/todolist") ) { QCopEnvelope env("QPE/Application/todolist", "flush()" ); // env << data; but we do not have any parameters here }else m_synced++; if ( QCopChannel::isRegistered("QPE/Application/datebook") ) { QCopEnvelope env("QPE/Application/datebook", "flush()" ); }else m_synced++; /* we will provide a wait scrren */ m_loading = new OWait(this, "wait screen" ); } void MainWindow::slotDesktopReceive(const QCString& cmd, const QByteArray& data ) { /* the bytearray was filled with the QDataStream now * we open it read only to get the value(s) */ QDataStream stream(data, IO_ReadOnly ); /* * we're only interested in the flushDone */ if ( cmd == "flushDone(QString)" ) { @@ -278,66 +278,66 @@ void MainWindow::slotShow() { /* as answer this slot will be called */ void MainWindow::slotShowRecord( const OPimRecord& rec) { /* got a parent but still is a toplevel MODAL dialog */ QDialog* dia = new QDialog(this,"dialog",TRUE ); QVBoxLayout *box = new QVBoxLayout( dia ); dia->setCaption( tr("View Record") ); QTextView *view = new QTextView(dia ); view->setText( rec.toRichText() ); box->addWidget( view ); /* * execute via QPEApplication * this allows QPEApplication to make a sane decision * on the size */ dia->showMaximized(); QPEApplication::execDialog( dia ); delete dia; } void MainWindow::slotDate() { /* * called by the action we will show a Popup * at the current mouse position with a DateChooser * to select the day */ qWarning("slot Date"); QPopupMenu *menu = new QPopupMenu(); /* A Month to select a date from TRUE for auto close */ DateBookMonth *month = new DateBookMonth(menu, 0, true ); - connect(month, SIGNAL(dateClicked(int, int, int) ), - this, SLOT(slotLoadForDay(int, int, int) ) ); + connect(month, SIGNAL(dateClicked(int,int,int) ), + this, SLOT(slotLoadForDay(int,int,int) ) ); menu->insertItem( month ); menu->exec( QCursor::pos() ); /* * we do not need to delete month because * we delete its parent menu */ delete menu; } /* * An anonymous namespace this symbol is only available here * so truely private */ namespace { /* not static cause namespace does that what static would do */ const int RTTI = 5050; /* * every ListView got Items. we've special pim items * holding ownership and the pointer to a pim record * it can't hold a pimrecord directly because this * would introduce slicing... any break */ /* * A struct is a special class. Everything is public by * default. */ struct PIMListViewItem : public QListViewItem { /* |