From: Micke Nordin Date: Sun, 10 Jan 2010 19:30:17 +0000 (+0100) Subject: fixing gui X-Git-Url: http://git.maemo.org/git/?p=mnenc;a=commitdiff_plain;h=431d292ff3a7f554f6ca854de1930f23924ed3ca fixing gui --- diff --git a/unlock/Makefile b/unlock/Makefile index 4869147..a37d79b 100644 --- a/unlock/Makefile +++ b/unlock/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: unlock -# Generated by qmake (2.01a) (Qt 4.6.0) on: sön jan 10 19:41:04 2010 +# Generated by qmake (2.01a) (Qt 4.6.0) on: sön jan 10 20:23:31 2010 # Project: unlock.pro # Template: app # Command: /usr/bin/qmake -unix -o Makefile unlock.pro @@ -169,8 +169,7 @@ mocables: compiler_moc_header_make_all compiler_moc_source_make_all compiler_moc_header_make_all: moc_unlock.cpp compiler_moc_header_clean: -$(DEL_FILE) moc_unlock.cpp -moc_unlock.cpp: ui_unlock.h \ - unlock.hpp +moc_unlock.cpp: unlock.hpp /usr/bin/moc $(DEFINES) $(INCPATH) unlock.hpp -o moc_unlock.cpp compiler_rcc_make_all: @@ -196,11 +195,10 @@ compiler_clean: compiler_moc_header_clean compiler_uic_clean ####### Compile -main.o: main.cpp unlock.hpp \ - ui_unlock.h +main.o: main.cpp unlock.hpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp -unlock.o: unlock.cpp +unlock.o: unlock.cpp unlock.hpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o unlock.o unlock.cpp moc_unlock.o: moc_unlock.cpp diff --git a/unlock/main.cpp b/unlock/main.cpp index 5e2f3c7..b45b401 100644 --- a/unlock/main.cpp +++ b/unlock/main.cpp @@ -19,12 +19,12 @@ #include - #include "unlock.hpp" +#include "unlock.hpp" int main(int argc, char *argv[]) { QApplication app(argc, argv); - Unlock *dialog = new Unlock; + unlock *dialog = new unlock; dialog->show(); return app.exec(); diff --git a/unlock/main.o b/unlock/main.o new file mode 100644 index 0000000..fb6bd49 Binary files /dev/null and b/unlock/main.o differ diff --git a/unlock/moc_unlock.cpp b/unlock/moc_unlock.cpp new file mode 100644 index 0000000..30a6935 --- /dev/null +++ b/unlock/moc_unlock.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'unlock.hpp' +** +** Created: Sun Jan 10 20:26:46 2010 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "unlock.hpp" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'unlock.hpp' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_unlock[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + // slots: signature, parameters, type, tag, flags + 8, 7, 7, 7, 0x08, + + 0 // eod +}; + +static const char qt_meta_stringdata_unlock[] = { + "unlock\0\0Close()\0" +}; + +const QMetaObject unlock::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_unlock, + qt_meta_data_unlock, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &unlock::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *unlock::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *unlock::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_unlock)) + return static_cast(const_cast< unlock*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int unlock::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: Close(); break; + default: ; + } + _id -= 1; + } + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/unlock/moc_unlock.o b/unlock/moc_unlock.o new file mode 100644 index 0000000..23022c9 Binary files /dev/null and b/unlock/moc_unlock.o differ diff --git a/unlock/ui_unlock.h b/unlock/ui_unlock.h index a2785f4..82b30ae 100644 --- a/unlock/ui_unlock.h +++ b/unlock/ui_unlock.h @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'unlock.ui' ** -** Created: Sun Jan 10 19:35:33 2010 +** Created: Sun Jan 10 20:23:33 2010 ** by: Qt User Interface Compiler version 4.6.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! @@ -14,58 +14,57 @@ #include #include #include -#include -#include #include #include #include +#include +#include +#include QT_BEGIN_NAMESPACE -class Ui_Dialog +class Ui_MainWindow { public: - QDialogButtonBox *buttonBox; + QWidget *centralwidget; QLineEdit *lineEdit; + QPushButton *pushButton; QLabel *label; - void setupUi(QDialog *Dialog) + void setupUi(QMainWindow *MainWindow) { - if (Dialog->objectName().isEmpty()) - Dialog->setObjectName(QString::fromUtf8("Dialog")); - Dialog->resize(255, 77); - buttonBox = new QDialogButtonBox(Dialog); - buttonBox->setObjectName(QString::fromUtf8("buttonBox")); - buttonBox->setGeometry(QRect(150, 10, 81, 301)); - buttonBox->setOrientation(Qt::Vertical); - buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); - lineEdit = new QLineEdit(Dialog); + if (MainWindow->objectName().isEmpty()) + MainWindow->setObjectName(QString::fromUtf8("MainWindow")); + MainWindow->resize(182, 66); + centralwidget = new QWidget(MainWindow); + centralwidget->setObjectName(QString::fromUtf8("centralwidget")); + lineEdit = new QLineEdit(centralwidget); lineEdit->setObjectName(QString::fromUtf8("lineEdit")); - lineEdit->setGeometry(QRect(30, 40, 113, 26)); - label = new QLabel(Dialog); + lineEdit->setGeometry(QRect(0, 30, 113, 26)); + pushButton = new QPushButton(centralwidget); + pushButton->setObjectName(QString::fromUtf8("pushButton")); + pushButton->setGeometry(QRect(120, 30, 51, 28)); + label = new QLabel(centralwidget); label->setObjectName(QString::fromUtf8("label")); - label->setGeometry(QRect(30, 10, 111, 20)); + label->setGeometry(QRect(0, 10, 171, 18)); + MainWindow->setCentralWidget(centralwidget); - retranslateUi(Dialog); - QObject::connect(buttonBox, SIGNAL(rejected()), Dialog, SLOT(reject())); - QObject::connect(buttonBox, SIGNAL(accepted()), Dialog, SLOT(accept())); + retranslateUi(MainWindow); - QMetaObject::connectSlotsByName(Dialog); + QMetaObject::connectSlotsByName(MainWindow); } // setupUi - void retranslateUi(QDialog *Dialog) + void retranslateUi(QMainWindow *MainWindow) { - Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0, QApplication::UnicodeUTF8)); -#ifndef QT_NO_WHATSTHIS - lineEdit->setWhatsThis(QString()); -#endif // QT_NO_WHATSTHIS - label->setText(QApplication::translate("Dialog", "Enter password", 0, QApplication::UnicodeUTF8)); + MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); + pushButton->setText(QApplication::translate("MainWindow", "Ok", 0, QApplication::UnicodeUTF8)); + label->setText(QApplication::translate("MainWindow", "Enter master password", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { - class Dialog: public Ui_Dialog {}; + class MainWindow: public Ui_MainWindow {}; } // namespace Ui QT_END_NAMESPACE diff --git a/unlock/unlock b/unlock/unlock new file mode 100755 index 0000000..4750475 Binary files /dev/null and b/unlock/unlock differ diff --git a/unlock/unlock.cpp b/unlock/unlock.cpp index 56755f4..b918e15 100644 --- a/unlock/unlock.cpp +++ b/unlock/unlock.cpp @@ -4,7 +4,7 @@ // // 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 3 of the License, or +// 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, @@ -18,25 +18,19 @@ // MA 02110-1301, USA. -#include -#include "unlock.h" - -// if we include there is no need to include every class used: , ,... - -Unlock::Unlock(QWidget *parent) { - setupUi(this); // this sets up GUI - - // signals/slots mechanism in action - connect( pushButton_browse, SIGNAL( clicked() ), this, SLOT( accepted() ) ); - connect( pushButton_do, SIGNAL( clicked() ), this, SLOT( rejected() ) ); -} - - -void Unlock::accepted() { -// +#include "unlock.hpp" + +unlock::unlock(QWidget *parent) : QMainWindow(parent) +{ + ui.setupUi( this ); + connect( ui.pushButton, SIGNAL(clicked()), this, SLOT(Close())); } - - -void Unlock::rejected() { - // + +void unlock::Close() +{ +// can also add any extra closedown code here before we actually do close the GUI + + +// now close for real + close(); } diff --git a/unlock/unlock.hpp b/unlock/unlock.hpp index 5f72a96..ca154a2 100644 --- a/unlock/unlock.hpp +++ b/unlock/unlock.hpp @@ -18,22 +18,17 @@ // MA 02110-1301, USA. -#ifndef _unlock_h_included_ -#define _unlock_h_included_ - +#include +#include #include "ui_unlock.h" - -class Unlock : public QWidget, private Ui::QDialog { - Q_OBJECT - -public: - Unlock(QWidget *parent = 0); - - -public slots: - void accepted(); - void rejected(); +class unlock : public QMainWindow +{ + Q_OBJECT + + public: + unlock(QWidget *parent = 0); + private: + Ui::MainWindow ui; + private slots: + void Close(); }; - - -#endif diff --git a/unlock/unlock.o b/unlock/unlock.o new file mode 100644 index 0000000..bae5591 Binary files /dev/null and b/unlock/unlock.o differ diff --git a/unlock/unlock.pro b/unlock/unlock.pro index 4f292f2..acd2839 100644 --- a/unlock/unlock.pro +++ b/unlock/unlock.pro @@ -1,5 +1,5 @@ ###################################################################### -# Automatically generated by qmake (2.01a) sön jan 10 19:35:11 2010 +# Automatically generated by qmake (2.01a) sön jan 10 20:13:10 2010 ###################################################################### TEMPLATE = app diff --git a/unlock/unlock.ui b/unlock/unlock.ui index f32f857..7b513b1 100644 --- a/unlock/unlock.ui +++ b/unlock/unlock.ui @@ -1,94 +1,57 @@ - Dialog - + MainWindow + 0 0 - 255 - 77 + 182 + 66 - Dialog + MainWindow - - - - 150 - 10 - 81 - 301 - - - - Qt::Vertical - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 30 - 40 - 113 - 26 - - - - - - - - - - 30 - 10 - 111 - 20 - - - - Enter password - + + + + + 0 + 30 + 113 + 26 + + + + + + + 120 + 30 + 51 + 28 + + + + Ok + + + + + + 0 + 10 + 171 + 18 + + + + Enter master password + + - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - +