Skip to content

Commit

Permalink
- Added *.desktop file parser
Browse files Browse the repository at this point in the history
- Added QLauncher proto, which parser desktop files and creates items
to the menu from them.
- Deleted old icons
- Added example desktop files
- Added icons for example desktop files
  • Loading branch information
zchydem committed Jan 6, 2009
1 parent 8c39b8a commit 6b664f0
Show file tree
Hide file tree
Showing 305 changed files with 683 additions and 75 deletions.
17 changes: 17 additions & 0 deletions config/example-menu/0300_osso_rss_feed_reader.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Desktop Entry]
Encoding=UTF-8
Version=0.1
Type=Application
Name=rss news reader
Comment=rss_ap_news_reader_thumb
Exec=/usr/bin/osso_rss_feed_reader.sh
Icon=qgn_list_rss
Categories=osso-news-reader
MimeType=application/news_reader
X-Icon-path=/usr/local/share/pixmaps/
X-Window-Icon=tn-bookmarks-link
X-Window-Icon-Dimmed=tn-bookmarks-link-dimmed
X-HildonDesk-ShowInToolbar=true
X-Osso-Service=osso_rss_feed_reader
X-Osso-Type=application/x-executable
StartupWMClass=osso_rss_feed_reader
13 changes: 13 additions & 0 deletions config/example-menu/0301_osso-xterm.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=X Terminal
Comment=Terminal Emulator
Exec=/usr/bin/osso-xterm
Icon=terminal
Terminal=false
Type=Application
Categories=System;TerminalEmulator;
X-HildonDesk-ShowInToolbar=true
X-Osso-Service=xterm
X-Osso-Type=application/x-executable
13 changes: 13 additions & 0 deletions config/example-menu/0500_osso_pdfviewer.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.2.26
Type=Application
Name=pdf viewer
Comment=pdvi_ap_application_title_thumb
Exec=/usr/bin/osso_pdfviewer
Icon=qgn_list_pdf_viewer
Categories=Office;Viewer
MimeType=application/pdf;
X-HildonDesk-ShowInToolbar=true
X-Osso-Service=osso_pdfviewer
X-Osso-Type=application/x-executable
32 changes: 32 additions & 0 deletions config/example-menu/0600_osso-addressbook.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=address book
Comment=addr_ap_address_book_thumb
Exec=/usr/bin/osso-addressbook
X-Osso-Service=osso_addressbook
Icon=qgn_list_addressbook
StartupWMClass=osso-addressbook
X-Osso-URI-Actions=mailto;xmpp;sipto;sip;
MimeType=text/x-vcard

[X-Osso-URI-Action Handler mailto]
Method=add_account
Name=addr_me_cs_addtocontacts
TranslationDomain=osso-addressbook

[X-Osso-URI-Action Handler xmpp]
Method=add_account
Name=addr_me_cs_addtocontacts
TranslationDomain=osso-addressbook

[X-Osso-URI-Action Handler sipto]
Method=add_account
Name=addr_me_cs_addtocontacts
TranslationDomain=osso-addressbook

[X-Osso-URI-Action Handler sip]
Method=add_account
Name=addr_me_cs_addtocontacts
TranslationDomain=osso-addressbook
14 changes: 14 additions & 0 deletions config/example-menu/1100_filemanager.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=file manager
Comment=sfil_ap_file_manager_thumb
Exec=/usr/bin/ossofilemanager
Icon=qgn_list_filemanager
X-Window-Icon=qgn_list_filemanager
X-Window-Icon-Dimmed=qgn_list_filemanager
X-Osso-Service=osso_filemanager
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
StartupWMClass=ossofilemanager
15 changes: 15 additions & 0 deletions config/example-menu/2300_osso-global-search.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
StartupNotify=false
StartupWMClass=osso-global-search
Name=global search
Comment=srch_ap_search_thumb
Exec=/usr/bin/osso-global-search
Icon=qgn_list_find
X-Window-Icon=qgn_list_find
X-Window-Icon-Dimmed=qgn_list_find
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable
X-Osso-Service=osso_global_search
11 changes: 11 additions & 0 deletions config/example-menu/2400_osso_help.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=help application
Comment=help_ap_help_application_thumb
Exec=/usr/bin/osso_help
Icon=qgn_list_help
X-HildonDesk-ShowInToolbar=true
X-Osso-Service=osso_help
X-Osso-Type=application/x-executable
7 changes: 7 additions & 0 deletions config/qtablet.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Device]
resolution=800x480

[paths]
desktopfiles=../config/example-menu
icons=../images/example-menu
images=../images:../images/backgrounds
5 changes: 3 additions & 2 deletions core/comchannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ namespace qtablet{

}

void sendMessage( QString const & message, QByteArray const & data ){

void ComChannel::sendMessage( QString const & message, QByteArray const & data ){
Q_UNUSED( message );
Q_UNUSED( data );
}

}
1 change: 1 addition & 0 deletions core/comchannel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace qtablet{
private:
//! Private member
ComChannelPrivate * d_ptr;
Q_DISABLE_COPY( ComChannel );
};
}
#endif
19 changes: 10 additions & 9 deletions core/core.pro
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
######################################################################
# #####################################################################
# Automatically generated by qmake (2.01a) Sat Jan 3 00:46:03 2009
######################################################################
# #####################################################################
include(../qtablet.pri)
TEMPLATE = lib
TARGET = QTabletCore
DEPENDPATH += .
TEMPLATE = lib
TARGET = QTabletCore
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += dll
CONFIG += dll
OBJECTS_DIR = $$BUILDDIR/core/obj
MOC_DIR = $$BUILDDIR/core/moc
DESTDIR = $$BUILDDIR/core/lib

# Input
HEADERS += comchannel.hh
SOURCES += comchannel.cc

HEADERS += comchannel.hh \
settings.hh
SOURCES += comchannel.cc \
settings.cc
target.path = $$INSTALLDIR/lib
headers.files = $$HEADERS
headers.path = $$INSTALLDIR/include
Expand Down
123 changes: 123 additions & 0 deletions core/settings.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#include "settings.hh"

#include <QSettings>
#include <QDir>
#include <QtDebug>

#ifdef Q_WS_QWS
// Nothing here yet. Add if needed
#endif

#ifdef Q_WS_X11
#include <QDesktopWidget>
#include <QDesktopServices>
#endif

namespace qtablet{

class SettingsPrivate{
public:
SettingsPrivate(){

QSettings settings( "config:qtablet.conf", QSettings::IniFormat );

if ( settings.status() != QSettings::NoError ){
qWarning() << "Settings: Failed to parse configuration file!";
return;
}

// Parse group contents
parseGroup( "device", settings );
parseGroup( "paths", settings );

}

void parseGroup( QString const & group, QSettings & settings ){
settings.beginGroup( group );
QStringList keys = settings.childKeys();


foreach ( QString key, keys ){
m_values.insert( key, settings.value( key, "" ).toString() );
}

settings.endGroup();
}



QHash <QString, QString> m_values;
};


////// BEGIN Settings CLASS ///////
Settings * Settings::instance(){
static Settings instance;
return &instance;
}

Settings::~Settings(){
delete d_ptr;
}

QSize Settings::screenResolution() const{
// If using X11 just get the resolution from the desktop widget.
#ifdef Q_WS_X11
QDesktopWidget widget;
return widget.screenGeometry().size();
#endif

// Read resolition from the configuration file.
QString resolution = d_ptr->m_values.value( resolution );
QStringList values = resolution.split("x");
QSize size;

if ( values.size() != 2 ){
qWarning() << "Check configuration file. Resolution wrong!";
return size;
}

size.setWidth ( values.at(0).toInt() );
size.setHeight( values.at(1).toInt() );
return size;
}


QStringList Settings::desktopFilePaths() const{
return d_ptr->m_values.value( "desktopfiles" ).split(":");
}

QStringList Settings::desktopFiles() const{
// Get the paths to desktop files
QStringList paths = desktopFilePaths();

// Get the actual files from the paths
QStringList files;
foreach( QString path, paths ){
QDir dir( path );
files << dir.entryList( QStringList("*.desktop"), QDir::Files );
}

return files;
}


QStringList Settings::iconPaths() const{
return d_ptr->m_values.value( "icons" ).split(":");
}

QStringList Settings::imagePaths() const{
return d_ptr->m_values.value( "images" ).split(":");
}


Settings::Settings():
d_ptr( new SettingsPrivate )
{
// Set global search paths for the framework level.
QDir::setSearchPaths( "desktop", desktopFilePaths() );
QDir::setSearchPaths( "icon", iconPaths() );
QDir::setSearchPaths( "image", imagePaths() );
}

}
36 changes: 36 additions & 0 deletions core/settings.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef SETTINGS_H
#define SETTINGS_H

#include <QSize>
#include <QString>
#include <QtGlobal>

namespace qtablet{

class SettingsPrivate;

class Settings
{
public:
static Settings * instance();

~Settings();

QSize screenResolution() const;

QStringList desktopFilePaths() const;

QStringList desktopFiles() const;

QStringList iconPaths() const;

QStringList imagePaths() const;

private:
Settings();
SettingsPrivate * d_ptr;
Q_DISABLE_COPY( Settings );
};

}
#endif // SETTINGS_H
10 changes: 10 additions & 0 deletions gui/abstractitem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QtDebug>
#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <QHash>

namespace qtablet{

Expand All @@ -15,6 +16,7 @@ class AbstractItemPrivate{
}

qreal m_currentRotation;
QHash <QString, QVariant> m_attributes;
};

// AbstractItem class
Expand All @@ -41,4 +43,12 @@ void AbstractItem::setRotationZ(qreal rr){
}


void AbstractItem::addItemAttribute( QString const & key, QVariant const & value ){
d_ptr->m_attributes.insert( key, value );
}

QVariant AbstractItem::itemAttribute( QString const & key ) const{
return d_ptr->m_attributes.value( key );
}

}
4 changes: 4 additions & 0 deletions gui/abstractitem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class AbstractItem : public QGraphicsWidget

virtual void setRotationZ(qreal rr);

virtual void addItemAttribute( QString const & key, QVariant const & value );

virtual QVariant itemAttribute( QString const & key ) const;

private:
AbstractItemPrivate * d_ptr;
Q_DISABLE_COPY( AbstractItem );
Expand Down
1 change: 1 addition & 0 deletions gui/gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOURCES += pannableview.cc \
abstractitem.cc \
pannableviewitem.cc \
labelitem.cc

target.path = $$INSTALLDIR/lib
headers.files = $$HEADERS
headers.path = $$INSTALLDIR/include
Expand Down
Loading

0 comments on commit 6b664f0

Please sign in to comment.