|
#1
|
||||
|
||||
|
Hi there,
I have a scenario like this: - I've drawn a simple UI in Nokia QT Designer: ![]() - I have a shell script wich does various file manipulations based on variables given What I would like to do: - convert that UI to native app which would launch my shell script with variables based on what's been chosen from drop down list's at the UI when hitting the "Apply changes" -button. In this case the command to be launched from the button would be: /path/to/my/script/script.sh "Enable custom transitions" "Droid Sans" "Black" I have zero knowledge on coding with anything else than PHP. I would highly appreciate if someone is intrested in helping me with the project ![]() I think this could be done with Python(?) so I could later on easily edit the python "source" if I needed to add more options to the drop down lists? Edit: and as bonus: this app should be launchable from N900's settings "application", not from program launcher menu.
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P 80's style stadium rock is back - FIRENOTE Hi-Octane heavy metal - FORCE MAJEURE Last edited by d-iivil; 2010-07-16 at 08:09. |
| The Following User Says Thank You to d-iivil For This Useful Post: | ||
|
#2
|
||||
|
||||
|
Hello,
At the moment I can't write all the code for you, but I can give you some pointers about how to do it.
I know this was a very dense description, but I hope it will help!
__________________
You should follow me on Twitter! Apps: Puzzle Master, IRC Chatter for Harmattan, IRC for Sailfish Last edited by Venemo; 2010-07-16 at 08:39. |
|
#3
|
||||
|
||||
|
Quote:
![]() Already got mad developer working with QT Creator.
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P 80's style stadium rock is back - FIRENOTE Hi-Octane heavy metal - FORCE MAJEURE |
|
#4
|
||||
|
||||
|
Heh, well, got it running on the device.
Now the hardest part: how to make the buttons actually to do something :-P
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P 80's style stadium rock is back - FIRENOTE Hi-Octane heavy metal - FORCE MAJEURE |
| The Following User Says Thank You to d-iivil For This Useful Post: | ||
|
#5
|
||||
|
||||
|
Not sure whether I should post this, as right now I'm trying to blow the "embrace the future - develop with QT" - but coming from PHP, using Python and PyQt might indeed be the easier way to do it.
That would require to:
Again, if you want to be future prove, go with C++ and Qt, but if you want to keep it easy (and maemo-only), Python and PyQt would do the trick without much hassle, especially when you're coming from a PHP background. |
| The Following User Says Thank You to Nathraiben For This Useful Post: | ||
|
#6
|
||||
|
||||
|
Quote:
Good thing seems to be that I can use the .ui -file with QT Creator and PyQT4.
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P 80's style stadium rock is back - FIRENOTE Hi-Octane heavy metal - FORCE MAJEURE |
|
#7
|
||||
|
||||
|
Quote:
In the constructor of your window widget, connect the "clicked" event of your button: Code:
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(hello())); "ui" is the... well, UI defined by "ui(new Ui::MyWindowName)" in the constructor"pushButton" is the name of your button "hello()" is the name of a slot created in the next step In the header file of the window widget, add the definition for a new slot (inside the class definition) : Code:
protected slots:
void hello();
Back in the implementation file of your window widget, define a function for that slot: Code:
void MainWindow::hello()
{
//Do whatever should be done when pressing the button
}
Just don't call the spot hello - that was obviously taken from my inevitable first Hello World app.
|
|
#8
|
||||
|
||||
|
True, .ui files being usable with any of the Qt bindings is quite the blessing. And I was astonished how easy it is to work with them both in Eric (simply right-click and choose "Compile Form" to generate the .py file, then right-click and choose "Generate Dialog Code" to automatically generate everything you need for even-handling with a nice choose-your-events dialog) and in the QT SDK (no generating of event handlers, as far as I know, but at least fully automatic generation of the .cpp and .h upon saving the .ui file).
|
|
#9
|
|||
|
|||
|
If you want to run your shell script in the button handler, you need to use function int QProcess::execute ( const QString & program, const QStringList & arguments ).
In above example from Nathraiben you would call it in function hello like this: Code:
void MainWindow::hello()
{
QStringList arguments;
arguments << "Enable custom transitions" << "Droid Sans" << "Black";
QProcess::execute("/path/to/my/script/script.sh", arguments);
}
__________________
My Maemo5 projects: mSpede - Speed testing game | Them Bloody Ducks - 2D duck hunting game | Maetronome - A simple metronome app | CuteMPC - MPD client |
|
#10
|
||||
|
||||
|
Quote:
And in which part of my project I should put these: Code:
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(hello())); Code:
void MainWindow::hello()
{
QStringList arguments;
arguments << "Enable custom transitions" << "Droid Sans" << "Black";
QProcess::execute("/path/to/my/script/script.sh", arguments);
}
Forms: - mainwindow-ui Headers. - mainwindow.h Sources: - main.cpp - mainwindow.cpp
__________________
If you're rich and you think I deserve a cold beer, you may donate one or two :-P 80's style stadium rock is back - FIRENOTE Hi-Octane heavy metal - FORCE MAJEURE |
| The Following User Says Thank You to d-iivil For This Useful Post: | ||
![]() |
|
|