maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Qt Project: Countdown timer (https://talk.maemo.org/showthread.php?t=39202)

Sasler 2010-01-04 09:25

Qt Project: Countdown timer
 
1 Attachment(s)
Here is a little project of mine which I did for two reasons. I wanted to learn C++/Qt and I needed a countdown timer. Initially I had no intentions to release this app, but now that it's almost ready, I thought someone else mind find it useful too. ;)

Basically it is a simple countdown timer with 1 second precision that can countdown all the way from 60 minutes (60 minutes and 59 seconds to be precise :D). It has 4 customisable buttons for preset times in addition to the normal + and - dials.

I still have some issues and I would appreciate any help. :)

1. SOLVED Sound doesn't work. EDIT: Using Phonon instead of QSound now.


2. SOLVED EDIT: This issue is only present when doing a run with MADDE. Once the app is properly installed there is no issue.
I can't access the /home/user/MyDocs/.sounds directory with native dialog. With the following setting it works, but that dialog is not very finger friendly:
Code:

QFileDialog::DontUseNativeDialog
3. SOLVED I still have not figured out how to make a Debian package which includes a shortcut to the app.

4. SOLVED How to optify this app.

5. DONE Thanks to Juxxxer! And finally, could someone please make an icon for this app. I absolutely stink with anything that requires even only very basic drawing skills. :D

Countdwon Timer is now available in Extras-Devel. :)

Here are the source files.

Sasler 2010-01-04 09:35

Re: Qt Project: Countdown timer
 
OK, here is some more info about the sound problem:

I'm using QSound::play(fileName). This works fine in Windows, but I get no sound in N900.

I'm also trying to test Phonon::MediaObject, but I don't seem to have the necessary libraries on my 64 bit Windows 7 for it to work.

danielwilms 2010-01-04 10:04

Re: Qt Project: Countdown timer
 
Hi,

Quote:

Originally Posted by Sasler (Post 452252)
2. I can't access the /home/user/MyDocs/.sounds directory with native dialog. With the following setting it works, but that dialog is not very finger friendly:

Code:

QFileDialog::DontUseNativeDialog

There should be a directory called "Audio clips" in the file dialog, which is actually the MyDocs/.sounds directory.

Quote:

Originally Posted by Sasler (Post 452252)
3. I still have not figured out how to make a Debian package which includes a shortcut to the app.

You have to create a desktop-file and place it correctly. Have a look here how to do it. On the same page you will find a Qt packaging guide as well.

Quote:

Originally Posted by Sasler (Post 452252)
4. How to optify this app.

Haven't tried it yet, but in general you could try to add a debian/optify file and put "auto" there. No guarantee that this will work ;)

Quote:

Originally Posted by Sasler (Post 452252)
5. And finally, could someone please make an icon for this app. I absolutely stink with anything that requires even only very basic drawing skills. :D

Same problem here ;)

Daniel

krk969 2010-01-04 10:45

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by danielwilms (Post 452286)
Hi,



There should be a directory called "Audio clips" in the file dialog, which is actually the MyDocs/.sounds directory.



You have to create a desktop-file and place it correctly. Have a look here how to do it. On the same page you will find a Qt packaging guide as well.



Haven't tried it yet, but in general you could try to add a debian/optify file and put "auto" there. No guarantee that this will work ;)



Same problem here ;)

Daniel

if the auto in the debian/optify file doesnt work, just make sure your libs and binaries are installed in the /opt :D
thats what Ive done at the moment for a QT app I created.
Read about this debian/optify in the maemo mailing list as Daniel has mentioned, need to try it out.

cheers

Sasler 2010-01-04 12:20

Re: Qt Project: Countdown timer
 
1 Attachment(s)
Quote:

Originally Posted by danielwilms (Post 452286)
You have to create a desktop-file and place it correctly. Have a look here how to do it. On the same page you will find a Qt packaging guide as well.

OK, the this seems a bit too complicated for my limited brain capacity. :rolleyes:

This is what I did now (with no success so far):

I created the CountdownTimer.desktop file in the /src directory (I also tried without the Icon line, since I don't have any icons yet):
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Name=Countdown Timer
Exec=/usr/bin/timer
Icon=myapp
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

This is how my pro looks:
Code:

TARGET = timer
HEADERS += src/form.h \
    src/settings.h
SOURCES += qtmain.cpp \
    src/form.cpp \
    src/settings.cpp
FORMS += src/form.ui \
    src/settings.ui

# LEXS#
LEXSOURCES +=

# YACCS#
YACCSOURCES +=
INCLUDEPATH +=
LIBS +=
DEFINES +=

# All generated files goes same directory
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
DESTDIR = build
TEMPLATE = app
DEPENDPATH +=
VPATH += src \
    uis
CONFIG -=
CONFIG += debug
QT = core \
    gui
MY_BIN_PATH = /usr/bin/

# Default installation overwritten because qmake and debian both
# uses DESTDIR in different purposes
install.commands = -$(INSTALL_PROGRAM) \
    $(TARGET) \
    \"$(DESTDIR)\"$$MY_BIN_PATH$(QMAKE_TARGET)
install.depends = $(TARGET)
desktop.path = $$DATADIR/applications/hildon
  desktop.files += $${TARGET}.desktop

iconxpm.path = $$DATADIR/pixmap
  iconxpm.files += ../data/maemo/$${TARGET}.xpm

  icon26.path = $$DATADIR/icons/hicolor/26x26/apps
  icon26.files += ../data/26x26/$${TARGET}.png

  icon40.path = $$DATADIR/icons/hicolor/40x40/apps
  icon40.files += ../data/40x40/$${TARGET}.png

  icon64.path = $$DATADIR/icons/hicolor/64x64/apps
  icon64.files += ../data/64x64/$${TARGET}.png

# Targets for debian source and binary package creation
debian-src.commands = dpkg-buildpackage \
    -S \
    -r \
    -us \
    -uc \
    -d
debian-bin.commands = dpkg-buildpackage \
    -b \
    -r \
    -uc \
    -d
debian-all.depends = debian-src \
    debian-bin

# Clean all but Makefile
compiler_clean.commands = -$(DEL_FILE) \
    $(TARGET)
QMAKE_EXTRA_TARGETS += debian-all \
    debian-src \
    debian-bin \
    install \
    compiler_clean
RESOURCES =

I use the following command in MADDE to make the package:
Code:

mad dpkg-buildpackage
I can install it, but it won't create the shortcut. Writing timer in the terminal runs the app just fine. I included the package here if someone wants to test it out. :)

krk969 2010-01-04 12:23

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 452398)
OK, the this seems a bit too complicated for my limited brain capacity. :rolleyes:

This is what I did now (with no success so far):

I created the CountdownTimer.desktop file in the /src directory (I also tried without the Icon line, since I don't have any icons yet):
Code:

[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Name=Countdown Timer
Exec=/usr/bin/timer
Icon=myapp
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

This is how my pro looks:
Code:

TARGET = timer
HEADERS += src/form.h \
    src/settings.h
SOURCES += qtmain.cpp \
    src/form.cpp \
    src/settings.cpp
FORMS += src/form.ui \
    src/settings.ui

# LEXS#
LEXSOURCES +=

# YACCS#
YACCSOURCES +=
INCLUDEPATH +=
LIBS +=
DEFINES +=

# All generated files goes same directory
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
DESTDIR = build
TEMPLATE = app
DEPENDPATH +=
VPATH += src \
    uis
CONFIG -=
CONFIG += debug
QT = core \
    gui
MY_BIN_PATH = /usr/bin/

# Default installation overwritten because qmake and debian both
# uses DESTDIR in different purposes
install.commands = -$(INSTALL_PROGRAM) \
    $(TARGET) \
    \"$(DESTDIR)\"$$MY_BIN_PATH$(QMAKE_TARGET)
install.depends = $(TARGET)
desktop.path = $$DATADIR/applications/hildon
  desktop.files += $${TARGET}.desktop

iconxpm.path = $$DATADIR/pixmap
  iconxpm.files += ../data/maemo/$${TARGET}.xpm

  icon26.path = $$DATADIR/icons/hicolor/26x26/apps
  icon26.files += ../data/26x26/$${TARGET}.png

  icon40.path = $$DATADIR/icons/hicolor/40x40/apps
  icon40.files += ../data/40x40/$${TARGET}.png

  icon64.path = $$DATADIR/icons/hicolor/64x64/apps
  icon64.files += ../data/64x64/$${TARGET}.png

# Targets for debian source and binary package creation
debian-src.commands = dpkg-buildpackage \
    -S \
    -r \
    -us \
    -uc \
    -d
debian-bin.commands = dpkg-buildpackage \
    -b \
    -r \
    -uc \
    -d
debian-all.depends = debian-src \
    debian-bin

# Clean all but Makefile
compiler_clean.commands = -$(DEL_FILE) \
    $(TARGET)
QMAKE_EXTRA_TARGETS += debian-all \
    debian-src \
    debian-bin \
    install \
    compiler_clean
RESOURCES =

I use the following command in MADDE to make the package:
Code:

mad dpkg-buildpackage
I can install it, but it won't create the shortcut. Writing timer in the terminal runs the app just fine. I included the package here if someone wants to test it out. :)

did you copy the .desktop file to /usr/share/applications/hildon/ ?
thats where it should be.
And, Ive still not managed to add this as a widget, but I can add it as a shortcut to app on the home desktop.

Sasler 2010-01-04 12:26

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 452401)
did you copy the .desktop file to /usr/share/applications/hildon/ ?
thats where it should be.
And, Ive still not managed to add this as a widget, but I can add it as a shortcut to app on the home desktop.

No I did not. What I want is to create a .deb package which would automatically install the shortcut. Isn't this possible? :confused:

krk969 2010-01-04 12:44

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 452403)
No I did not. What I want is to create a .deb package which would automatically install the shortcut. Isn't this possible? :confused:

yes its possible :)
this can be configured in the .pro file.

something like

desktop.files = <<your .desktop file>
desktop.path = /usr/share/applications/hildon
INSTALLS += desktop

EDIT::

oops I read between the lines.
No the shortcut wont appear automatically after installing your app using dpkg.
You need to manually create a shortcut from the home screen.
This is the info I have with my limited knowledge.

danielwilms 2010-01-04 12:49

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 452403)
No I did not. What I want is to create a .deb package which would automatically install the shortcut. Isn't this possible? :confused:

I have once created a small Qt application. Look at the sources. There, in the "src" directory you will find the src.pro and the desktop file. In this example it works ;)

Daniel

juxxxer 2010-01-04 12:56

Re: Qt Project: Countdown timer
 
Hi, do you know any information about the logo size (in pixels). I could be interested to do something :)

Edit: Or are those svg pics? Should I look Hildon documentation or QT documentation about what kind of format etc this logo needs to be? Are there any examples around?

Jux


All times are GMT. The time now is 15:01.

vBulletin® Version 3.8.8