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

danielwilms 2010-01-04 13:15

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by juxxxer (Post 452433)
Hi, do you know any information about the logo size (in pixels). I could be interested to do something :)

Find the information here. But please be aware that, even though the icon sizes have been changed, the field in the control file ("Maemo-Icon-26") stays the same.

Cheers Daniel

Sasler 2010-01-04 13:29

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by danielwilms (Post 452428)
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

OK, this is how my src.pro file looks like now:
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)

# 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 =


unix {
    #VARIABLES
    isEmpty(PREFIX) {
        PREFIX = /usr/local
  }

BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share

DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\"

#MAKE INSTALL

INSTALLS += target desktop

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += $${TARGET}.desktop

}

But I get the following error when trying to mad dpkg-buildpackage:
Code:

make: *** [configure-stamp] Error 1
dpkg-buildpackage: failure: debian/rules build gave error exit status 2


krk969 2010-01-04 13:33

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 452454)
OK, this is how my src.pro file looks like now:
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)

# 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 =


unix {
    #VARIABLES
    isEmpty(PREFIX) {
        PREFIX = /usr/local
  }

BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share

DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\"

#MAKE INSTALL

INSTALLS += target desktop

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += $${TARGET}.desktop

}

But I get the following error when trying to mad dpkg-buildpackage:
Code:

make: *** [configure-stamp] Error 1
dpkg-buildpackage: failure: debian/rules build gave error exit status 2


not a 100% sure but maybe due to the spaces prefixing these lines

target.path =$$BINDIR

desktop.path = $$DATADIR/applications/hildon
desktop.files += $${TARGET}.desktop

Sasler 2010-01-04 13:42

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 452458)
not a 100% sure but maybe due to the spaces prefixing these lines

target.path =$$BINDIR

desktop.path = $$DATADIR/applications/hildon
desktop.files += $${TARGET}.desktop

No, that did not change anything. Same result.

Sasler 2010-01-04 13:44

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by juxxxer (Post 452433)
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

Thanks, I would really appreciate it. :) I think it should be 48 x 48 pixels, but I'm not sure.

juxxxer 2010-01-04 14:47

Re: Qt Project: Countdown timer
 
2 Attachment(s)
Hi,

ok, first try.

I made first 64x64pix version and after that 48x48, but kind of cheated on 48x48 :)

But do you think this 'sporty' clock tells what this counter is? is the functionality similar? So is my analogy correct?

And of course all the other comments are welcome also (should I change the 'time' in a clock to something else?)

Are there any restrictions how to use Maemo logo? (so can we use this minimalized version I made?). Or is it stupid idea to use this almost-Maemo-logo-text there?

I'm happy to make changes...

Cheers,

Jux

Sasler 2010-01-04 15:29

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by juxxxer (Post 452545)
Hi,

ok, first try.

I made first 64x64pix version and after that 48x48, but kind of cheated on 48x48 :)

But do you think this 'sporty' clock tells what this counter is? is the functionality similar? So is my analogy correct?

And of course all the other comments are welcome also (should I change the 'time' in a clock to something else?)

Are there any restrictions how to use Maemo logo? (so can we use this minimalized version I made?). Or is it stupid idea to use this almost-Maemo-logo-text there?

I'm happy to make changes...

Cheers,

Jux

Thanks, this looks really cool. :cool:

I have no idea about the restrictions using the Maemo logo. Maybe someone else can answer that. :)

Could the 48 x 48 version also show the entire "clock"... But it looks really cool. :)

I just wonder if that icon would mislead people to think that it's also a normal timer and not just countdown timer? :confused: Hmm... Still, it's such a nice icon that maybe I should simply add the normal timer function. It shouldn't be that difficult. :D

juxxxer 2010-01-04 16:19

Re: Qt Project: Countdown timer
 
>Still, it's such a nice icon that maybe I should simply add the normal timer function.

Logo is creating new feature requests :D.

>Could the 48 x 48 version also show the entire "clock".

I can try. But the Maemo letters are so small already so not sure I can make them any more smaller. But maybe I'll just make the clock smaller and try to adjust the 'original' Maemo letters.

juxxxer 2010-01-04 16:57

Re: Qt Project: Countdown timer
 
1 Attachment(s)
Hi,

Is png ok? I think the transparency is better with png. But here is 48x48 version with full clock.

I'll make 64x64 png version also when you know which size you need.

marionegroponzi 2010-01-04 22:16

Re: Qt Project: Countdown timer
 
Funny, I've made the same kind of app with Qt and I've managed to package it with the instructions described here:
http://wiki.forum.nokia.com/index.ph...plication_menu

Now I would like to upload my package to the extras repository and I've found some instructions here:
http://wiki.maemo.org/Uploading_to_Extras

However it seems to require files I don't have (.changes and others).

I've managed to have the sound working (although with a little hack) using Phonon, so if you still need help let me know.

Sasler 2010-01-05 06:53

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by marionegroponzi (Post 453185)
Funny, I've made the same kind of app with Qt and I've managed to package it with the instructions described here:
http://wiki.forum.nokia.com/index.ph...plication_menu

Thanks. :) You probably meant this link. Unfortunately there are instructions that seem to apply only to ScratchBox. I'm trying to use Windows only without a virtual Linux box. But I'm starting to wonder if this is even possible yet. :confused:

Quote:

Originally Posted by marionegroponzi (Post 453185)
Now I would like to upload my package to the extras repository and I've found some instructions here:
http://wiki.maemo.org/Uploading_to_Extras

However it seems to require files I don't have (.changes and others).

Let me know how that goes, because as soon as I get the other things working, I want to upload my project too. :)

Quote:

Originally Posted by marionegroponzi (Post 453185)
I've managed to have the sound working (although with a little hack) using Phonon, so if you still need help let me know.

Yeah, I tried Phonon, but I seem to be missing that from my Windows 7 PC. I still haven't figured out how to set it up. All the instructions talk about Microsoft SDK v6.1 but I have the v7.0A and it won't install the older, because it already sees the newer one. So if anyone knows how to set it up in a 64 bit Windows 7, I would appreciate the help. :)

danielwilms 2010-01-05 08:51

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 452461)
No, that did not change anything. Same result.

Hi,

do you have your latest sources anywhere, that I could have a look, what's going wrong?!?

Quote:

Originally Posted by Sasler (Post 453557)
Unfortunately there are instructions that seem to apply only to ScratchBox. I'm trying to use Windows only without a virtual Linux box. But I'm starting to wonder if this is even possible yet.

You are using MADDE right?!? Sure it is possible. Maybe I should add a more complex example to the wiki there.

@marionegroponzi:
Have a look in the maemo.org wiki. There is a guide how to make a debian package of a Qt application.

Daniel

Sasler 2010-01-05 10:03

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

Originally Posted by danielwilms (Post 453646)
Hi,

do you have your latest sources anywhere, that I could have a look, what's going wrong?!?



You are using MADDE right?!? Sure it is possible. Maybe I should add a more complex example to the wiki there.

Here are the latest sources. Thank you for your help. :)

juxxxer 2010-01-05 11:18

Re: Qt Project: Countdown timer
 
1 Attachment(s)
Hi,

New 64x64 version (sorry my way of working is quite iterative) - but some colors added (+ transparency for 64x64). Opinions? comments? I think it would be nice to see those in action in N900 when you are getting there.

Sasler 2010-01-05 13:09

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

Originally Posted by juxxxer (Post 453766)
Hi,

New 64x64 version (sorry my way of working is quite iterative) - but some colors added (+ transparency for 64x64). Opinions? comments? I think it would be nice to see those in action in N900 when you are getting there.

Thanks. Now I just need to figure out how to make a Debian package which includes the shortcut with MADDE... ;) Here is a package which does not include it:

Sasler 2010-01-06 06:35

Re: Qt Project: Countdown timer
 
For this shortcut issue, I wonder if I could manually edit the makefile? I noticed the following section in it:

Code:

install: $(TARGET)
        -$(INSTALL_PROGRAM) $(TARGET) "$(DESTDIR)"/usr/bin/$(QMAKE_TARGET)

If I got it right, I should have all the files I want to install listed in this section, including the .desktop and icon files. Am I correct? Could I add those lines manually and how should they look like? :confused:

I also wonder if I could manually change the install path here to /opt?

Sasler 2010-01-06 13:56

Re: Qt Project: Countdown timer
 
5 Attachment(s)
I got a strange new problem. After I install the Debian package, it looks like this and I get these errors. But when I reboot my device, it looks normal and I get no errors. Any idea why it's doing this? :confused:

I've attached the Debian package and the source files here.

danielwilms 2010-01-07 11:02

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 455531)
I got a strange new problem. After I install the Debian package, it looks like this and I get these errors. But when I reboot my device, it looks normal and I get no errors. Any idea why it's doing this?

You are running it as root I guess?!? You should run it as normal user and then it should work. I haven't looked at your latest sources, but the one you have posted here follow these steps and it should work:

1. create a folder <package-name>-<version-number> like countdowntimer-0.1

2. copy the sources into that folder

3. create in the folder a file named countdowntimer.pro with this content:
Code:

TEMPLATE = subdirs
SUBDIRS  = src

4. go into the src folder and create a file called src.pro with the following content:

Code:

TARGET = countdowntimer
TEMPLATE = app
SOURCES += qtmain.cpp \
    settings.cpp \
    form.cpp
HEADERS += settings.h \
    form.h
FORMS += settings.ui \
    form.ui
PREFIX = ../debian/countdowntimer/usr

unix {
BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share

DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\"

#MAKE INSTALL

INSTALLS += target desktop

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += countdowntimer.desktop

}

5. go back to the main-folder and run:

Code:

mad dh_make --createorig --single -e <your email> -c gpl
press enter. This command creates the basic files in a new folder called debian. To find out more about the meaning of the different files, please read the documentation about debian packages.

6. run:

Code:

mad qmake
7. run:

Code:

mad dpkg-buildpackage
That should do it to get a really basic package done for testing, which includes the entry in the task launcher. I don't know, which editor you used for the .desktop file, but there was a special character in the first line, which avoid reading it correctly. After rewriting it, it worked perfectly fine.

hope this helped and sorry for the delay.

Daniel

Sasler 2010-01-07 14:07

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

Originally Posted by danielwilms (Post 457064)
hope this helped and sorry for the delay.

Daniel

Thanks a lot. I finally got a shortcut! :D

Now if I only would get the icon working too.. ;)

Here is what I've done:
Code:

QT += phonon
TARGET = countdowntimer
TEMPLATE = app
SOURCES += qtmain.cpp \
    settings.cpp \
    form.cpp
HEADERS += settings.h \
    form.h
FORMS += settings.ui \
    form.ui
PREFIX = ../debian/countdowntimer/usr

unix {
BINDIR = $$PREFIX/bin
DATADIR =$$PREFIX/share

DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\"

#MAKE INSTALL

INSTALLS += target desktop

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += countdowntimer.desktop

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

}

I got the countdowntimer.png in <app root>\data\64x64\ directory. But I only get the default blue icon.

Anyway, here is the Debian package with the shortcut: :)

danielwilms 2010-01-07 14:44

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 457318)
I got the countdowntimer.png in <app root>\data\64x64\ directory. But I only get the default blue icon.

Hmmm...the icon is not in the package. try to add "icon64" under INSTALLS and write the name of the png instead of using the variable, which gives you more control. This should do it. At least it adds it to the package. I haven't tested it if it shows up or not. But anyway, here are the changes:

Code:

INSTALLS += target desktop icon64

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += countdowntimer.desktop

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

Further there is a bug, so that the icon-cache is not updated correctly. So try a restart as well if it does not show up ;)

Daniel

Sasler 2010-01-08 09:22

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by danielwilms (Post 457366)
Hmmm...the icon is not in the package. try to add "icon64" under INSTALLS and write the name of the png instead of using the variable, which gives you more control. This should do it. At least it adds it to the package. I haven't tested it if it shows up or not. But anyway, here are the changes:

Code:

INSTALLS += target desktop icon64

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += countdowntimer.desktop

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

Further there is a bug, so that the icon-cache is not updated correctly. So try a restart as well if it does not show up ;)

Daniel

Thanks, I got it working now with icons and all. :D I put the the new Debian package and source files in the first post.

Now I wonder if by changing the BINDIR and DATADIR I could optify this? After I've done this, I could try to upload this to Extras Devel. :)

krk969 2010-01-08 09:47

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 458855)
Thanks, I got it working now with icons and all. :D I put the the new Debian package and source files in the first post.

Now I wonder if by changing the BINDIR and DATADIR I could optify this? After I've done this, I could try to upload this to Extras Devel. :)

yes that would do it. best thing is to check the makefiles that the .pro file generates and see if its installing your app into /opt.
the icons stay in /usr/share itself as u configured AFAIK

danielwilms 2010-01-08 11:34

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 458879)
the icons stay in /usr/share itself as u configured

that's right. And don't forget to configure your .dektop file correctly to the new path ;)

Daniel

Sasler 2010-01-08 11:38

Re: Qt Project: Countdown timer
 
Now I have the issue of missing libqt4-phonon package when trying to install this Debain package. By doing the following the install succeeds:

apt-get install libqt4-phonon

But does anyone know how it should be done so that it would install it automatically if missing?

krk969 2010-01-08 11:43

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 458974)
Now I have the issue of missing libqt4-phonon package when trying to install this Debain package. By doing the following the install succeeds:

apt-get install libqt4-phonon

But does anyone know how it should be done so that it would install it automatically if missing?

put it in your debian/control file
in the depends option :)

Sasler 2010-01-08 11:50

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 458981)
put it in your debian/control file
in the depends option :)

OK, here is my control file:

Code:

Source: countdowntimer
Section: user/other
Priority: extra
Maintainer: Sascha Makela <sascha.makela@gmail.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.3
Homepage: <insert the upstream URL, if relevant>

Package: countdowntimer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A simple countdown timer
 <insert long description, indented with spaces>

How should I fill in the libqt4-phonon? Is it like:

Code:

Depends: ${shlibs:Depends}, ${misc:Depends}, ${libqt4-phonon:Depends}

Sasler 2010-01-08 11:57

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 458879)
yes that would do it. best thing is to check the makefiles that the .pro file generates and see if its installing your app into /opt.
the icons stay in /usr/share itself as u configured AFAIK

Just to make sure. Would this be correct?
Code:

QT += phonon
TARGET = countdowntimer
TEMPLATE = app
SOURCES += qtmain.cpp \
    settings.cpp \
    form.cpp
HEADERS += settings.h \
    form.h
FORMS += settings.ui \
    form.ui
PREFIX = ../debian/countdowntimer/usr

unix {
BINDIR = $$PREFIX/opt
DATADIR =$$PREFIX/opt

DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\"

#MAKE INSTALL

INSTALLS += target desktop icon64

  target.path =$$BINDIR

  desktop.path = $$DATADIR/applications/hildon
  desktop.files += countdowntimer.desktop

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

}

Or would I need to remove/edit the $$PREFIX? What about DATADIR? Should that too be in /opt?

krk969 2010-01-08 12:04

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 458985)
OK, here is my control file:

Code:

Source: countdowntimer
Section: user/other
Priority: extra
Maintainer: Sascha Makela <sascha.makela@gmail.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.3
Homepage: <insert the upstream URL, if relevant>

Package: countdowntimer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A simple countdown timer
 <insert long description, indented with spaces>

How should I fill in the libqt4-phonon? Is it like:

Code:

Depends: ${shlibs:Depends}, ${misc:Depends}, ${libqt4-phonon:Depends}

Build-Depends: debhelper (>= 5), libqt4-phonon

Sasler 2010-01-08 12:26

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by krk969 (Post 459007)
Build-Depends: debhelper (>= 5), libqt4-phonon

Now my control file looks like this:
Code:

Source: countdowntimer
Section: user/other
Priority: extra
Maintainer: Sascha Makela <sascha.makela@gmail.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.3
Homepage: <insert the upstream URL, if relevant>

Package: countdowntimer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Build-Depends: debhelper (>= 5), libqt4-phonon
Description: A simple countdown timer
 <insert long description, indented with spaces>

But I get this result:

Code:

dpkg-genchanges: warning: unknown information field 'Build-Depends' in input data in package's section of control info file

krk969 2010-01-08 12:35

Re: Qt Project: Countdown timer
 
Quote:

Originally Posted by Sasler (Post 459029)
Now my control file looks like this:
Code:

Source: countdowntimer
Section: user/other
Priority: extra
Maintainer: Sascha Makela <sascha.makela@gmail.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.3
Homepage: <insert the upstream URL, if relevant>

Package: countdowntimer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Build-Depends: debhelper (>= 5), libqt4-phonon
Description: A simple countdown timer
 <insert long description, indented with spaces>

But I get this result:

Code:

dpkg-genchanges: warning: unknown information field 'Build-Depends' in input data in package's section of control info file

you dont need to add that line, the
Build-Depends: debhelper (>= 5)
exists on Source under the Maintener section just add your dependent packages there.


All times are GMT. The time now is 21:13.

vBulletin® Version 3.8.8