1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

* Merged master into branch phonon.

This commit is contained in:
Christian Muehlhaeuser
2011-04-15 11:06:26 +02:00
577 changed files with 33717 additions and 6406 deletions

2
.gitignore vendored
View File

@@ -10,3 +10,5 @@ moc_*
*~
/tomahawk
thirdparty/qtweetlib/WARNING-twitter-api-keys
.kdev4
tomahawk.kdev4

16
AUTHORS Normal file
View File

@@ -0,0 +1,16 @@
Tomahawk is primarily authored by:
* Christian Muehlhaeuser <muesli@tomahawk-player.org>
Contributors include:
* Leo Franchi <lfranchi@kde.org>
* Dominik Schmidt <dev@dominik-schmidt.de>
* Jeff Mitchell <mitchell@kde.org>
* J Herskowitz <jherskow@gmail.com>
* Alejandro Wainzinger <aikawarazuni@gmail.com>
Thanks to:
* Harald Sitter <sitter@kde.org>
* Steve Robertson

View File

@@ -1,13 +1,17 @@
PROJECT( tomahawk )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
IF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
CMAKE_POLICY(SET CMP0017 NEW)
ENDIF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
###
### Tomahawk application info
###
SET( ORGANIZATION_NAME "Tomahawk" )
SET( ORGANIZATION_DOMAIN "tomahawk-player.org" )
SET( APPLICATION_NAME "Player" )
SET( VERSION "0.0.1" )
SET( APPLICATION_NAME "Tomahawk" )
SET( VERSION "0.0.3" )
# set paths
@@ -18,10 +22,10 @@ SET( THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/thirdparty )
IF( "${gui}" STREQUAL "no" )
ADD_DEFINITIONS( -DENABLE_HEADLESS )
MESSAGE( STATUS "Building in HEADLESS mode ***" )
FIND_PACKAGE( Qt4 4.6.0 COMPONENTS QtCore QtXml QtNetwork REQUIRED )
FIND_PACKAGE( Qt4 4.7.0 COMPONENTS QtCore QtXml QtNetwork REQUIRED )
ELSE()
MESSAGE( STATUS "Building full GUI version ***" )
FIND_PACKAGE( Qt4 4.6.0 COMPONENTS QtGui QtCore QtXml QtNetwork REQUIRED )
FIND_PACKAGE( Qt4 4.7.0 COMPONENTS QtGui QtCore QtXml QtNetwork REQUIRED )
ENDIF()
#deps
@@ -29,8 +33,10 @@ INCLUDE( MacroOptionalFindPackage )
INCLUDE( MacroLogFeature )
# required
macro_optional_find_package(LibLastFm 0.3.3)
macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
#While we distribute our own liblastfm2, don't need to look for it
#macro_optional_find_package(LibLastFm 0.3.3)
#macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
set(LIBLASTFM_FOUND true)
macro_optional_find_package(LibEchonest 1.1.1)
macro_log_feature(LIBECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest is needed for dynamic playlists and the infosystem")
@@ -47,36 +53,48 @@ macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://develo
# we need pthreads too
find_package(Threads)
FIND_PACKAGE( Taglib 1.6.0 REQUIRED )
find_package(KDE4)
IF(KDE4_FOUND)
#KDE4 adds and removes some compiler flags that we don't like
STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
ELSE()
SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} )
ENDIF()
include( CheckTagLibFileName )
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
# optional
macro_optional_find_package(Jreen)
IF( ENABLE_JREEN AND NOT LIBJREEN_FOUND )
IF( ENABLE_JREEN )
macro_optional_find_package(Jreen)
IF( LIBJREEN_FOUND )
macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP library" "http://gitorious.org/jreen" FALSE "" "Jreen is needed for the alternative/new Jabber SIP plugin. Built automatically inside Tomahawk, if not installed systemwide and ENABLE_JREEN is true")
ELSE( LIBJREEN_FOUND )
SET( OLD_C_FLAGS ${CMAKE_C_FLAGS} )
SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} )
ADD_SUBDIRECTORY( thirdparty/jreen )
SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include )
IF( UNIX AND NOT APPLE )
SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.so )
ENDIF( UNIX AND NOT APPLE )
IF( WIN32 )
SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.dll )
SET( LIBJREEN_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/libjreen.dll )
ENDIF( WIN32 )
SET( LIBJREEN_FOUND true )
MESSAGE(STATUS "Internal libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}")
ENDIF( ENABLE_JREEN AND NOT LIBJREEN_FOUND )
SET( CMAKE_C_FLAGS ${OLD_C_FLAGS} )
ENDIF( LIBJREEN_FOUND )
ELSE( LIBJREEN_FOUND )
macro_optional_find_package(Gloox 1.0)
macro_log_feature(GLOOX_FOUND "Gloox" "A portable high-level Jabber/XMPP library for C++" "http://camaya.net/gloox" FALSE "" "Gloox is needed for the Jabber SIP plugin and the XMPP-Bot")
ENDIF( ENABLE_JREEN )
IF( WIN32 )
find_library(QTSPARKLE_LIBRARIES qtsparkle)
ENDIF( WIN32 )
macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP library" "http://gitorious.org/jreen" FALSE "" "Jreen is needed for the alternative/new Jabber SIP plugin. Built automatically inside Tomahawk, if not installed systemwide and ENABLE_JREEN is true")
macro_optional_find_package(Gloox 1.0)
IF( ENABLE_JREEN )
set( GLOOX_FOUND false )
ENDIF( ENABLE_JREEN)
macro_log_feature(GLOOX_FOUND "Gloox" "A portable high-level Jabber/XMPP library for C++" "http://camaya.net/gloox" FALSE "" "Gloox is needed for the Jabber SIP plugin and the XMPP-Bot")
#show dep log
macro_display_feature_log()
MESSAGE("WARNING!")
@@ -85,6 +103,19 @@ MESSAGE("add checks for libmad, libvorbis and libflac. Make sure they are instal
MESSAGE("")
MESSAGE("-----------------------------------------------------------------------------")
SET( INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
# make uninstall support
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
# KDE4 defines an uninstall target for us automatically
IF( NOT KDE4_FOUND )
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
IF( NOT APPLE )
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
@@ -93,3 +124,4 @@ ENDIF( NOT APPLE )
ADD_SUBDIRECTORY( thirdparty )
ADD_SUBDIRECTORY( src/libtomahawk )
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( admin )

View File

@@ -13,7 +13,7 @@ INCLUDE(CheckSymbolExists)
INCLUDE(FindLibraryWithDebug)
if(NOT CLUCENE_MIN_VERSION)
set(CLUCENE_MIN_VERSION "0.9.19")
set(CLUCENE_MIN_VERSION "0.9.23")
endif(NOT CLUCENE_MIN_VERSION)
IF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
@@ -75,7 +75,14 @@ FIND_PATH(CLUCENE_LIBRARY_DIR
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
IF (CLUCENE_LIBRARY_DIR)
MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
# include CLuceneConfig/CLuceneConfig.cmake
IF(EXISTS ${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
ENDIF(EXISTS ${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
# include CLucene/CLuceneConfig.cmake
IF(EXISTS ${CLUCENE_LIBRARY_DIR}/CLucene/CLuceneConfig.cmake)
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLucene/CLuceneConfig.cmake)
ENDIF(EXISTS ${CLUCENE_LIBRARY_DIR}/CLucene/CLuceneConfig.cmake)
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
SET(CLUCENE_GOOD_VERSION FALSE)

View File

@@ -1,3 +1,51 @@
Version 0.1.0:
* You can now browse and play collections in a tree-view.
* Watch folders for changes and automatically update your collection. This
is on by default; you can turn it off on the Local Music tab in the
settings dialog. Note that this triggers only on files or folders being
added to or removed from folders; it is not watch individual files as
most OSes can't support enough file watches to handle a normal-sized
music collection.
Version 0.0.4:
* Fixed a crash situation caused by sources going on- or offline.
Version 0.0.3:
* Show spinner while resolving playlists.
* Go back to previous page visible when deleting a playlist.
* Fixed issue where automatic playlists and station summaries were not
updated in the playlist header.
* Fixed an issue which caused duplicate items when rescanning.
* Revert change introduced in 0.0.2 causing Twitter protocol to not try
to reconnect to a peer if it couldn't connect the first time the plugin
was connected. This caused confusing (and for most unwanted) behavior.
* Fix crashes in Twitter authentication.
* Properly honor the chosen port number if a static host and port are
marked as preferred.
* Don't automatically try to resolve all incoming playback logs. This
speeds up importing sources a lot.
* Faster painting of playlists with lots of unresolved tracks.
* Prefer local results when results' score is equal.
* (Windows) The tomahawk:// protocol handler works on Windows now.
* (Windows) Fixed launching Tomahawk from Windows installer with admin privileges.
* (Windows) Prevent launching a second instance on Windows.
Version 0.0.2:
* Don't reconnect to Jabber if the settings dialog is closed successfully
but the Jabber settings haven't changed.
* Don't run a rescan of the local collection if the settings dialog is
closed successfully but the path hasn't changed.
* Don't attempt to connect to unavailable Twitter peers over and over.
* Find Twitter peers if the peer's Got Tomahawk? tweet is not their latest
tweet.
* Got Tomahawk? tweets can now be sent directly to specific users or in
private direct messages.
* Display a helpful message when someone sends a normal instant message to
the Tomahawk XMPP presence.
* Incompatible change: Twitter SIP protocol has changed slightly. 0.0.1
clients will not be able to talk to newer clients.
* Don't let long playlist or summary names force a large Tomahawk window.
* Tomahawk now asks you to authorize new contacts.
Version 0.0.1:
Features:
* Knocks your socks off
* First public release.

19
README
View File

@@ -1,8 +1,8 @@
Quickstart on Ubuntu
--------------------
$ sudo apt-get install build-essential cmake libtag1c2a libtag1-dev liblastfm-dev libqt4-dev \
libqt4-sql-sqlite libboost-dev zlib1g-dev libgnutls-dev pkg-config
$ sudo apt-get install build-essential cmake libtag1c2a libtag1-dev libqt4-dev libqt4-sql-sqlite \
libboost-dev zlib1g-dev libgnutls-dev pkg-config
Gloox 1.0 (XMPP library)
@@ -29,7 +29,7 @@ QJson (Qt JSON library)
$ ./configure && make
$ sudo make install
libEchonest 1.1.1
libEchonest 1.1.4
---------------
See: http://projects.kde.org/projects/playground/libs/libechonest/
@@ -56,7 +56,7 @@ Quickstart on OS X
Install homebrew
$ ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
$ brew install cmake qt qjson gloox taglib boost liblastfm
$ brew install cmake qt qjson gloox taglib boost
Install libEchnoest & CLucene as per the above instructions.
@@ -89,23 +89,18 @@ Dependencies
TagLib 1.6.2 http://developer.kde.org/~wheeler/taglib.html
Boost 1.3x http://www.boost.org/
CLucene 0.9.23 (0.9.21 will fail) http://clucene.sourceforge.net/download.shtml
liblastfm 0.3.3 http://github.com/mxcl/liblastfm/
libechonest 1.1.1 http://projects.kde.org/projects/playground/libs/libechonest/
libechonest 1.1.4 http://projects.kde.org/projects/playground/libs/libechonest/
Third party libraries that we ship with our source:
MiniUPnP http://miniupnp.free.fr/
liblastfm 0.4.0 http://github.com/jonocole/liblastfm/
To build the app:
-----------------
$ mkdir build && cd build
Pick one of the following two choices. If uncertain pick the second one, you probably want a GUI.
$ cmake -Dgui=no .. # enables headless mode, build without GUI
$ cmake .. # normal build including GUI
$ cmake ..
$ make
To run the app:

3
admin/CMakeLists.txt Normal file
View File

@@ -0,0 +1,3 @@
IF(WIN32)
INSTALL(DIRECTORY win DESTINATION share/tomahawk/admin )
ENDIF(WIN32)

BIN
admin/mac/DS_Store.in Normal file

Binary file not shown.

View File

@@ -5,21 +5,21 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>tomahawk</string>
<string>Tomahawk</string>
<key>CFBundleIdentifier</key>
<string>org.tomahawk-player.org.Tomahawk</string>
<string>org.tomahawk-player.Tomahawk</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>0.0.1.0</string>
<string>TOMAHAWK_VERSION</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<string>TOMAHAWK_VERSION</string>
<key>CFBundleSignature</key>
<string>tomahawk</string>
<key>CFBundleIconFile</key>
<string>tomahawk.icns</string>
<string>Tomahawk.icns</string>
<key>CFBundleName</key>
<string>Tomahawk</string>
<key>LSMinimumSystemVersion</key>

View File

@@ -16,6 +16,11 @@ function die {
}
################################################################################
if [ -z $1 ]
then
echo This script expects the version number as a parameter, e.g. 1.0.0
exit 1
fi
ROOT=`pwd`
@@ -31,7 +36,7 @@ echo "Goes here: $QTDIR"
export QMAKESPEC='macx-g++'
export QTDIR
export VERSION
export QTVERSION='4.7.1'
export QTVERSION='4.7.2'
################################################################################
@@ -39,17 +44,34 @@ CLEAN='1'
BUILD='1'
NOTQUICK='1'
CREATEDMG='1'
VERSION=$1
header addQt
header "Adding Qt to app bundle"
cd tomahawk.app
$ROOT/../admin/mac/add-Qt-to-bundle.sh \
'QtCore QtGui QtXml QtNetwork QtSql'
'QtCore QtGui QtXml QtNetwork QtSql QtXmlPatterns QtWebKit phonon'
header deposx
header "Running install_name_tool"
$ROOT/../admin/mac/deposx.sh
header "Copying Sparkle pubkey and framework, and qt.conf"
header "Renaming files"
mv Contents/Resources/tomahawkSources.icns Contents/Resources/Tomahawk.icns
mv Contents/MacOS/tomahawk Contents/MacOS/Tomahawk
# cp $ROOT/../admin/mac/Info.plist Contents/Info.plist
header "Copying Sparkle pubkey & framework, and qt.conf"
cp $ROOT/../admin/mac/sparkle_pub.pem Contents/Resources
cp -R /Library/Frameworks/Sparkle.framework Contents/Frameworks
cp $ROOT/../admin/mac/qt.conf Contents/Resources
header Done!
header "Creating DMG"
cd ..
mv tomahawk.app Tomahawk.app
$ROOT/../admin/mac/create-dmg.sh Tomahawk.app
mv Tomahawk.dmg Tomahawk-$VERSION.dmg
header "Creating signed Sparkle update"
$ROOT/../admin/mac/sign_bundle.rb $VERSION ~/tomahawk_sparkle_privkey.pem
mv Tomahawk.app tomahawk.app
header "Done!"

59
admin/mac/create-dmg.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/sh
# author: max@last.fm, muesli@tomahawk-player.org
# brief: Produces a compressed DMG from a bundle directory
# usage: Pass the bundle directory as the only parameter
# note: This script depends on the Tomahawk build system, and must be run from
# the build directory
################################################################################
#if [ -z $VERSION ]
#then
# echo VERSION must be set
# exit 2
#fi
if [ -z "$1" ]
then
echo "Please pass the bundle.app directory as the first parameter."
exit 3
fi
################################################################################
NAME=$(basename "$1" | perl -pe 's/(.*).app/\1/')
IN="$1"
TMP="dmg/$NAME"
OUT="$NAME.dmg"
mkdir -p "$TMP"
################################################################################
# clean up
rm -rf "$TMP"
rm -f "$OUT"
# create DMG contents and copy files
mkdir -p "$TMP/.background"
cp ../admin/mac/dmg_background.png "$TMP/.background/background.png"
cp ../admin/mac/DS_Store.in "$TMP/.DS_Store"
chmod go-rwx "$TMP/.DS_Store"
ln -s /Applications "$TMP/Applications"
# copies the prepared bundle into the dir that will become the DMG
cp -R "$IN" "$TMP"
# create
hdiutil makehybrid -hfs -hfs-volume-name Tomahawk -hfs-openfolder "$TMP" "$TMP" -o tmp.dmg
hdiutil convert -format UDZO -imagekey zlib-level=9 tmp.dmg -o "$OUT"
# cleanup
rm tmp.dmg
#hdiutil create -srcfolder "$TMP" \
# -format UDZO -imagekey zlib-level=9 \
# -scrub \
# "$OUT" \
# || die "Error creating DMG :("
# done !
echo 'DMG size:' `du -hs "$OUT" | awk '{print $1}'`

View File

@@ -62,7 +62,7 @@ function deposx_change
function deplib_change
{
install_name_tool -change /usr/local/Cellar/liblastfm/0.3.3/lib/liblastfm.0.dylib @executable_path/liblastfm.0.dylib $1
install_name_tool -change /usr/local/Cellar/qjson/0.7.1/lib/libqjson.0.dylib @executable_path/libqjson.0.dylib $1
install_name_tool -change /usr/local/Cellar/qjson/0.7.1/lib/libqjson.0.7.1.dylib @executable_path/libqjson.0.7.1.dylib $1
install_name_tool -change /usr/local/lib/libechonest.1.1.dylib @executable_path/libechonest.1.1.dylib $1
install_name_tool -change /usr/local/lib/libclucene-core.0.9.23.dylib @executable_path/libclucene-core.0.9.23.dylib $1
install_name_tool -change /usr/local/lib/libclucene-shared.0.9.23.dylib @executable_path/libclucene-shared.0.9.23.dylib $1
@@ -75,13 +75,13 @@ function deplib_change
install_name_tool -change /usr/local/Cellar/flac/1.2.1/lib/libFLAC++.6.dylib @executable_path/libFLAC++.6.dylib $1
install_name_tool -change /usr/local/Cellar/flac/1.2.1/lib/libFLAC.8.dylib @executable_path/libFLAC.8.dylib $1
install_name_tool -change $ORIGROOT/src/libtomahawk/libtomahawklib.dylib @executable_path/libtomahawklib.dylib $1
install_name_tool -change $ORIGROOT/libsip_jabber.dylib @executable_path/libsip_jabber.dylib $1
install_name_tool -change $ORIGROOT/libsip_twitter.dylib @executable_path/libsip_twitter.dylib $1
install_name_tool -change $ORIGROOT/libsip_zeroconf.dylib @executable_path/libsip_zeroconf.dylib $1
install_name_tool -change $ORIGROOT/libtomahawk_sipjabber.dylib @executable_path/libtomahawk_sipjabber.dylib $1
install_name_tool -change $ORIGROOT/libtomahawk_siptwitter.dylib @executable_path/libtomahawk_siptwitter.dylib $1
install_name_tool -change $ORIGROOT/libtomahawk_sipzeroconf.dylib @executable_path/libtomahawk_sipzeroconf.dylib $1
install_name_tool -change $ORIGROOT/thirdparty/jdns/libtomahawk_jdns.dylib @executable_path/libtomahawk_jdns.dylib $1
install_name_tool -change $ORIGROOT/thirdparty/qtweetlib/libtomahawk_qtweetlib.dylib @executable_path/libtomahawk_qtweetlib.dylib $1
install_name_tool -change libqjson.0.dylib @executable_path/libqjson.0.dylib $1
install_name_tool -change libqjson.0.7.1.dylib @executable_path/libqjson.0.7.1.dylib $1
install_name_tool -change libechonest.1.1.dylib @executable_path/libechonest.1.1.dylib $1
install_name_tool -change libclucene-core.0.9.23.dylib @executable_path/libclucene-core.0.9.23.dylib $1
install_name_tool -change libclucene-shared.0.9.23.dylib @executable_path/libclucene-shared.0.9.23.dylib $1
@@ -99,7 +99,7 @@ do
deplib_change "$x"
done
import_lib /usr/local/Cellar/qjson/0.7.1/lib/libqjson.0.dylib
import_lib /usr/local/Cellar/qjson/0.7.1/lib/libqjson.0.7.1.dylib
import_lib /usr/local/Cellar/liblastfm/0.3.3/lib/liblastfm.0.dylib
import_lib /usr/local/Cellar/gloox/1.0/lib/libgloox.8.dylib
import_lib /usr/local/Cellar/taglib/1.6.3/lib/libtag.1.dylib
@@ -113,9 +113,9 @@ import_lib /usr/local/lib/libechonest.1.1.dylib
import_lib /usr/local/lib/libclucene-core.0.9.23.dylib
import_lib /usr/local/lib/libclucene-shared.0.9.23.dylib
import_lib ../../libsip_jabber.dylib
import_lib ../../libsip_twitter.dylib
import_lib ../../libsip_zeroconf.dylib
import_lib ../../libtomahawk_sipjabber.dylib
import_lib ../../libtomahawk_siptwitter.dylib
import_lib ../../libtomahawk_sipzeroconf.dylib
import_lib ../../src/libtomahawk/libtomahawklib.dylib
import_lib ../../thirdparty/jdns/libtomahawk_jdns.dylib
import_lib ../../thirdparty/qtweetlib/libtomahawk_qtweetlib.dylib

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

@@ -6,9 +6,9 @@ if ARGV.length < 2
exit
end
tarball = "tomahawk#{ARGV[0]}.tar.bz2"
tarball = "tomahawk-#{ARGV[0]}.tar.bz2"
puts "Zipping: #{tarball}..."
`tar jcvf "#{tarball}" tomahawk.app`
`tar jcvf "#{tarball}" Tomahawk.app`
puts "Signing..."
puts `openssl dgst -sha1 -binary < "#{tarball}" | openssl dgst -dss1 -sign "#{ARGV[1]}" | openssl enc -base64`

View File

@@ -2,16 +2,24 @@
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Tomahawk Player Changelog</title>
<link>http://download.tomahawk-player.org/sparkle</link>
<description>Most recent changes with links to updates.</description>
<link>http://www.gettomahawk.com</link>
<description>Tomahawk Player Beta</description>
<language>en</language>
<item>
<title>Version 0.0.1 (Tomahawk Player - It Lives!)</title>
<title>Version 0.0.1 (Tomahawk Player Beta - It Lives?)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/master/ChangeLog
https://github.com/tomahawk-player/tomahawk/raw/0.0.1/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Fri, 04 Mar 2011 16:05:15 -0500</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle-debug/updates/tomahawk0.0.1.tar.bz2" sparkle:version="0.0.1" length="10627176" type="application/octet-stream" sparkle:dsaSignature="MC0CFAyYNZq58X7hPC7Qn+DtotVgym7pAhUA5hkLGllYxjOwwCf7i2LxUsvGyps=" />
<pubDate>Fri, 25 Mar 2011 00:00:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle-debug/updates/tomahawk-0.0.1.tar.bz2" sparkle:version="0.0.1" length="10627176" type="application/octet-stream" sparkle:dsaSignature="MC0CFAyYNZq58X7hPC7Qn+DtotVgym7pAhUA5hkLGllYxjOwwCf7i2LxUsvGyps=" />
</item>
<item>
<title>Version 0.0.2 (Tomahawk Player Beta - It Lives?)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/0.0.2/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Mon, 28 Mar 2011 06:13:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle/updates/tomahawk-0.0.2.tar.bz2" sparkle:version="0.0.2" length="19831287" type="application/octet-stream" sparkle:dsaSignature="MC0CFC0Hwq9x9BWMF/8sA+c5KfzKoBzFAhUAk9r0IJlxQf9qEJk4IL6bbTWTiuI=" />
</item>
</channel>
</rss>

View File

@@ -2,16 +2,24 @@
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Tomahawk Player Changelog</title>
<link>http://download.tomahawk-player.org/sparkle</link>
<description>Most recent changes with links to updates.</description>
<link>http://www.gettomahawk.com</link>
<description>Tomahawk Player</description>
<language>en</language>
<item>
<title>Version 0.0.1 (Tomahawk Player - It Lives!)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/master/ChangeLog
https://github.com/tomahawk-player/tomahawk/raw/0.0.1/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Fri, 04 Mar 2011 16:05:15 -0500</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle/updates/tomahawk0.1.tar.bz2" sparkle:version="0.0.1" length="10627176" type="application/octet-stream" sparkle:dsaSignature="MC0CFAyYNZq58X7hPC7Qn+DtotVgym7pAhUA5hkLGllYxjOwwCf7i2LxUsvGyps=" />
<pubDate>Fri, 25 Mar 2011 00:00:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle/updates/tomahawk-0.0.1.tar.bz2" sparkle:version="0.0.1" length="10627176" type="application/octet-stream" sparkle:dsaSignature="MC0CFAyYNZq58X7hPC7Qn+DtotVgym7pAhUA5hkLGllYxjOwwCf7i2LxUsvGyps=" />
</item>
<item>
<title>Version 0.0.2 (Tomahawk Player - It Lives!)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/0.0.2/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Mon, 28 Mar 2011 06:13:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle/updates/tomahawk-0.0.2.tar.bz2" sparkle:version="0.0.2" length="19831287" type="application/octet-stream" sparkle:dsaSignature="MC0CFC0Hwq9x9BWMF/8sA+c5KfzKoBzFAhUAk9r0IJlxQf9qEJk4IL6bbTWTiuI=" />
</item>
</channel>
</rss>

View File

@@ -1,5 +1,5 @@
[Protocol]
exec=/home/leo/kde/tomahawk/build/tomahawk "%u"
exec=/path/to/binary "%u"
protocol=tomahawk
input=none
output=none

View File

View File

@@ -2,16 +2,19 @@
SET(CMAKE_SYSTEM_NAME Windows)
# specify the cross compiler
SET(CMAKE_C_COMPILER i686-pc-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-pc-mingw32-g++)
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
# where is the target environment containing libraries
SET(CMAKE_FIND_ROOT_PATH /usr/i686-pc-mingw32/sys-root/mingw)
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32/sys-root/mingw)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# windres executable for application icon support
set(WINDRES_EXECUTABLE /usr/bin/i686-pc-mingw32-windres)
SET(WINDRES_EXECUTABLE /usr/bin/i686-w64-mingw32-windres)
# libs with broken find modules
set(TAGLIB_FOUND true)
set(TAGLIB_LIBRARIES ${CMAKE_FIND_ROOT_PATH}/lib/libtag.dll.a)
SET(TAGLIB_FOUND true)
SET(TAGLIB_LIBRARIES ${CMAKE_FIND_ROOT_PATH}/lib/libtag.dll.a)
SET(TAGLIB_INCLUDES ${CMAKE_FIND_ROOT_PATH}/include/taglib)

2
admin/win/nsi/RELEASE_NOTES.txt Executable file → Normal file
View File

@@ -1 +1 @@
TO DO
See http://github.com/tomahawk-player/tomahawk/blob/stable/ChangeLog

0
admin/win/nsi/installer.ico Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

View File

@@ -0,0 +1,35 @@
{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana;}
{\f172\froman\fcharset238\fprq2 Times New Roman CE;}{\f173\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f175\froman\fcharset161\fprq2 Times New Roman Greek;}{\f176\froman\fcharset162\fprq2 Times New Roman Tur;}
{\f177\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f178\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f179\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f180\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
{\f562\fswiss\fcharset238\fprq2 Verdana CE;}{\f563\fswiss\fcharset204\fprq2 Verdana Cyr;}{\f565\fswiss\fcharset161\fprq2 Verdana Greek;}{\f566\fswiss\fcharset162\fprq2 Verdana Tur;}{\f569\fswiss\fcharset186\fprq2 Verdana Baltic;}
{\f570\fswiss\fcharset163\fprq2 Verdana (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \ul\cf2 \sbasedon10 \styrsid7485074 Hyperlink;}}
{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid6712196\rsid7485074\rsid11352300\rsid15940516}{\*\generator Microsoft Word 11.0.5604;}{\info{\title Processes v1}{\author Hardwired}{\operator Hardwired}{\creatim\yr2004\mo12\dy12\hr23\min42}
{\revtim\yr2004\mo12\dy12\hr23\min51}{\version2}{\edmins9}{\nofpages1}{\nofwords80}{\nofchars458}{\nofcharsws537}{\vern24689}}\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180
\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot7485074\newtblstyruls\nogrowautofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}
{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}
{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid7485074 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\b\f39\insrsid7485074\charrsid7485074 Processes v1.0}{\f39\insrsid7485074\charrsid7485074 .0.1
\par }{\f39\fs20\insrsid7485074
\par }\pard \qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15940516 {\f39\fs20\insrsid15940516 This software binaries and source-code are free for any kind of use, including commercial use. }{
\f39\fs20\insrsid7485074\charrsid7485074 There is no restriction and no guaranty for using}{\f39\fs20\insrsid7485074\charrsid7485074 t}{\f39\fs20\insrsid7485074\charrsid7485074 his software}{\f39\fs20\insrsid7485074\charrsid7485074 and/or it
s source-code. }{\f39\fs20\insrsid15940516
\par I}{\f39\fs20\insrsid7485074\charrsid7485074 f you use the plug}{\f39\fs20\insrsid7485074\charrsid7485074 -}{\f39\fs20\insrsid7485074\charrsid7485074 in }{\f39\fs20\insrsid7485074\charrsid7485074 and/}{\f39\fs20\insrsid7485074\charrsid7485074 or it}{
\f39\fs20\insrsid7485074\charrsid7485074 s}{\f39\fs20\insrsid7485074\charrsid7485074 source-code, I would }{\f39\fs20\insrsid7485074\charrsid7485074 appreciate }{\f39\fs20\insrsid7485074\charrsid7485074 if my name is mentioned.}{
\f39\fs20\insrsid7485074\charrsid7485074
\par }\pard \qj \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid7485074 {\f39\fs20\insrsid7485074\charrsid7485074
\par }{\b\f39\fs20\insrsid7485074\charrsid7485074 Andrei Ciubotaru [Hardwired]
\par }{\f39\fs20\insrsid7485074\charrsid7485074 Lead Developer ICode&Ideas SRL (}{\field\flddirty{\*\fldinst {\f39\fs20\insrsid7485074\charrsid7485074 HYPERLINK "http://www.icode.ro/" }{\f39\fs20\insrsid7485074\charrsid7485074 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000170000001500000068007400740070003a002f002f007700770077002e00690063006f00640065002e0072006f002f000000e0c9ea79f9bace118c8200aa004ba90b2a00000068007400740070003a002f002f007700770077002e00690063006f00640065002e007200
6f002f000000}}}{\fldrslt {\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 http://www.icode.ro/}}}{\f39\fs20\insrsid7485074\charrsid7485074 )
\par }{\field{\*\fldinst {\f39\fs20\insrsid7485074 HYPERLINK "hardwiredteks@gmail.com" }{\f39\fs20\insrsid15940516\charrsid7485074 {\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000010000000303000000000000c00000000000004600001800000068617264776972656474656b7340676d61696c2e636f6d00ffffadde000000000000000000000000000000000000000000000000}}}{\fldrslt {
\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 hardwiredteks@gmail.com}}}{\f39\fs20\insrsid7485074\charrsid7485074 , }{\field{\*\fldinst {\f39\fs20\insrsid7485074 HYPERLINK "hardwired@icode.ro" }{\f39\fs20\insrsid15940516\charrsid7485074
{\*\datafield 00d0c9ea79f9bace118c8200aa004ba90b02000000010000000303000000000000c0000000000000460000130000006861726477697265644069636f64652e726f00ffffadde000000000000000000000000000000000000000000000000}}}{\fldrslt {
\cs15\f39\fs20\ul\cf2\insrsid7485074\charrsid7485074 hardwired@icode.ro}}}{\f39\fs20\insrsid7485074\charrsid7485074
\par }}

View File

@@ -0,0 +1,122 @@
----------------------------------------------------------------
----------------------------------------------------------------
Processes (Processes.dll)
Version: 1.0.1.0
Release: 24.february.2005
Description: Nullsoft Installer (NSIS) plug-in for managing?!
Windows processes.
Copyright: <09> 2004-2005 Hardwired. No rights reserved.
There is no restriction and no guaranty for using
this software.
Author: Andrei Ciubotaru [Hardwired]
Lead Developer ICode&Ideas SRL (http://www.icode.ro/)
hardwiredteks@gmail.com, hardwired@icode.ro
----------------------------------------------------------------
----------------------------------------------------------------
INTRODUCTION
The Need For Plug-in - I need it for the one of my installers.
Briefly: Use it when you need to find\kill a process when
installing\uninstalling some application. Also, use it when you
need to test the presence of a device driver.
SUPPORT
Supported platforms are: WinNT,Win2K,WinXP and Win2003 Server.
DESCRIPTION
Processes::FindProcess <process_name> ;without ".exe"
Searches the currently running processes for the given
process name.
return: 1 - the process was found
0 - the process was not found
Processes::KillProcess <process_name> ; without ".exe"
Searches the currently running processes for the given
process name. If the process is found then the it gets
killed.
return: 1 - the process was found and killed
0 - the process was not found or the process
cannot be killed (insuficient rights)
Processes::FindDevice <device_base_name>
Searches the installed devices drivers for the given
device base name.
(important: I said BASE NAME not FILENAME)
return: 1 - the device driver was found
0 - the device driver was not found
USAGE
First of all, does not matter where you use it. Ofcourse, the
routines must be called inside of a Section/Function scope.
Processes::FindProcess "process_name"
Pop $R0
StrCmp $R0 "1" make_my_day noooooo
make_my_day:
...
noooooo:
...
Processes::KillProcess "process_name"
Pop $R0
StrCmp $R0 "1" dead_meat why_wont_you_die
dead_meat:
...
why_wont_you_die:
...
Processes::FindDevice "device_base_name"
Pop $R0
StrCmp $R0 "1" blabla more_blabla
blabla:
...
more_blabla:
...
THANKS
Sunil Kamath for inspiring me. I wanted to use its FindProcDLL
but my requirements made it imposible.
Nullsoft for creating this very powerfull installer. One big,
free and full-featured (hmmm... and guiless for the moment) mean
install machine!:)
ME for being such a great coder...
... HAHAHAHAHAHAHA!
ONE MORE THING
If you use the plugin or it's source-code, I would apreciate
if my name is mentioned.
----------------------------------------------------------------
----------------------------------------------------------------

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// KillProcDLL.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,34 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_)
#define AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <string> // String management...
//From exam28.cpp
#include <tlhelp32.h>
//#include <iostream.h>
#ifdef BORLANDC
#include <string.h>
#include <ctype.h>
#endif
//To make it a NSIS Plug-In
#include "exdll.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__780690DC_E128_403D_BC07_780D1B2CC101__INCLUDED_)

View File

@@ -0,0 +1,37 @@
#include <windows.h>
#include "exdll.h"
HINSTANCE g_hInstance;
HWND g_hwndParent;
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
g_hwndParent=hwndParent;
EXDLL_INIT();
// note if you want parameters from the stack, pop them off in order.
// i.e. if you are called via exdll::myFunction file.dat poop.dat
// calling popstring() the first time would give you file.dat,
// and the second time would give you poop.dat.
// you should empty the stack of your parameters, and ONLY your
// parameters.
// do your stuff here
{
char buf[1024];
wsprintf(buf,"$0=%s\n",getuservariable(INST_0));
MessageBox(g_hwndParent,buf,0,MB_OK);
}
}
BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
g_hInstance=hInst;
return TRUE;
}

View File

@@ -0,0 +1,136 @@
#ifndef _EXDLL_H_
#define _EXDLL_H_
//
// only include this file from one place in your DLL.
// (it is all static, if you use it in two places it will fail)
//
#define EXDLL_INIT() { \
g_stringsize = string_size; \
g_stacktop = stacktop; \
g_variables = variables; }
//
// For page showing plug-ins
//
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
#define NOTIFY_BYE_BYE 'x'
typedef struct _stack_t
{
struct _stack_t *next;
char text[1]; // this should be the length of string_size
} stack_t;
static unsigned int g_stringsize;
static stack_t **g_stacktop;
static char *g_variables;
enum
{
INST_0, // $0
INST_1, // $1
INST_2, // $2
INST_3, // $3
INST_4, // $4
INST_5, // $5
INST_6, // $6
INST_7, // $7
INST_8, // $8
INST_9, // $9
INST_R0, // $R0
INST_R1, // $R1
INST_R2, // $R2
INST_R3, // $R3
INST_R4, // $R4
INST_R5, // $R5
INST_R6, // $R6
INST_R7, // $R7
INST_R8, // $R8
INST_R9, // $R9
INST_CMDLINE, // $CMDLINE
INST_INSTDIR, // $INSTDIR
INST_OUTDIR, // $OUTDIR
INST_EXEDIR, // $EXEDIR
INST_LANG, // $LANGUAGE
__INST_LAST
};
//
// utility functions (not required but often useful)
//
static int popstring( char *str )
{
stack_t *th;
if( !g_stacktop ||
!*g_stacktop )
return 1;
th = (*g_stacktop);
lstrcpy( str, th->text );
*g_stacktop = th->next;
GlobalFree( (HGLOBAL)th );
return 0;
}
static void pushstring( char *str )
{
stack_t *th;
if( !g_stacktop )
return;
th = (stack_t*)GlobalAlloc( GPTR, sizeof(stack_t) + g_stringsize );
lstrcpyn( th->text, str, g_stringsize );
th->next = *g_stacktop;
*g_stacktop = th;
}
static char *getuservariable( int varnum )
{
if( varnum < 0 ||
varnum >= __INST_LAST )
return NULL;
return (g_variables + varnum*g_stringsize);
}
static void setuservariable( int varnum, char *var )
{
if( var != NULL &&
varnum >= 0 &&
varnum < __INST_LAST )
lstrcpy( g_variables + varnum*g_stringsize, var );
}
#endif//_EXDLL_H_

View File

@@ -0,0 +1,411 @@
#include "stdafx.h"
#include "processes.h"
#include "string.h"
//-------------------------------------------------------------------------------------------
// global variables
lpfEnumProcesses EnumProcesses;
lpfEnumProcessModules EnumProcessModules;
lpfGetModuleBaseName GetModuleBaseName;
lpfEnumDeviceDrivers EnumDeviceDrivers;
lpfGetDeviceDriverBaseName GetDeviceDriverBaseName;
HINSTANCE g_hInstance;
HWND g_hwndParent;
HINSTANCE g_hInstLib;
//-------------------------------------------------------------------------------------------
// main DLL entry
BOOL WINAPI _DllMainCRTStartup( HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved )
{
g_hInstance = (struct HINSTANCE__ *)hInst;
return TRUE;
}
//-------------------------------------------------------------------------------------------
// loads the psapi routines
bool LoadPSAPIRoutines( void )
{
if( NULL == (g_hInstLib = LoadLibraryA( "PSAPI.DLL" )) )
return false;
EnumProcesses = (lpfEnumProcesses) GetProcAddress( g_hInstLib, "EnumProcesses" );
EnumProcessModules = (lpfEnumProcessModules) GetProcAddress( g_hInstLib, "EnumProcessModules" );
GetModuleBaseName = (lpfGetModuleBaseName) GetProcAddress( g_hInstLib, "GetModuleBaseNameA" );
EnumDeviceDrivers = (lpfEnumDeviceDrivers) GetProcAddress( g_hInstLib, "EnumDeviceDrivers" );
GetDeviceDriverBaseName = (lpfGetDeviceDriverBaseName) GetProcAddress( g_hInstLib, "GetDeviceDriverBaseNameA" );
if( ( NULL == EnumProcesses ) ||
( NULL == EnumProcessModules ) ||
( NULL == EnumDeviceDrivers ) ||
( NULL == GetModuleBaseName ) ||
( NULL == GetDeviceDriverBaseName ) )
{
FreeLibrary( g_hInstLib );
return false;
}
return true;
}
//-------------------------------------------------------------------------------------------
// free the psapi routines
bool FreePSAPIRoutines( void )
{
EnumProcesses = NULL;
EnumProcessModules = NULL;
GetModuleBaseName = NULL;
EnumDeviceDrivers = NULL;
if( FALSE == FreeLibrary( g_hInstLib ) )
return false;
return true;
}
//-------------------------------------------------------------------------------------------
// find a process by name
// return value: true - process was found
// false - process not found
bool FindProc( char *szProcess )
{
char szProcessName[ 1024 ];
char szCurrentProcessName[ 1024 ];
DWORD dPID[ 1024 ];
DWORD dPIDSize( 1024 );
DWORD dSize( 1024 );
HANDLE hProcess;
HMODULE phModule[ 1024 ];
//
// make the name lower case
//
memset( szProcessName, 0, 1024*sizeof(char) );
sprintf( szProcessName, "%s", szProcess );
strlwr( szProcessName );
//
// load PSAPI routines
//
if( false == LoadPSAPIRoutines() )
return false;
//
// enumerate processes names
//
if( FALSE == EnumProcesses( dPID, dSize, &dPIDSize ) )
{
FreePSAPIRoutines();
return false;
}
//
// walk trough and compare see if the process is running
//
for( int k( dPIDSize / sizeof( DWORD ) ); k >= 0; k-- )
{
memset( szCurrentProcessName, 0, 1024*sizeof(char) );
if( NULL != ( hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dPID[ k ] ) ) )
{
if( TRUE == EnumProcessModules( hProcess, phModule, sizeof(HMODULE)*1024, &dPIDSize ) )
if( GetModuleBaseName( hProcess, phModule[ 0 ], szCurrentProcessName, 1024 ) > 0 )
{
strlwr( szCurrentProcessName );
if( NULL != strstr( szCurrentProcessName, szProcessName ) )
{
FreePSAPIRoutines();
CloseHandle( hProcess );
return true;
}
}
CloseHandle( hProcess );
}
}
//
// free PSAPI routines
//
FreePSAPIRoutines();
return false;
}
//-------------------------------------------------------------------------------------------
// kills a process by name
// return value: true - process was found
// false - process not found
bool KillProc( char *szProcess )
{
char szProcessName[ 1024 ];
char szCurrentProcessName[ 1024 ];
DWORD dPID[ 1024 ];
DWORD dPIDSize( 1024 );
DWORD dSize( 1024 );
HANDLE hProcess;
HMODULE phModule[ 1024 ];
//
// make the name lower case
//
memset( szProcessName, 0, 1024*sizeof(char) );
sprintf( szProcessName, "%s", szProcess );
strlwr( szProcessName );
//
// load PSAPI routines
//
if( false == LoadPSAPIRoutines() )
return false;
//
// enumerate processes names
//
if( FALSE == EnumProcesses( dPID, dSize, &dPIDSize ) )
{
FreePSAPIRoutines();
return false;
}
//
// walk trough and compare see if the process is running
//
for( int k( dPIDSize / sizeof( DWORD ) ); k >= 0; k-- )
{
memset( szCurrentProcessName, 0, 1024*sizeof(char) );
if( NULL != ( hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, dPID[ k ] ) ) )
{
if( TRUE == EnumProcessModules( hProcess, phModule, sizeof(HMODULE)*1024, &dPIDSize ) )
if( GetModuleBaseName( hProcess, phModule[ 0 ], szCurrentProcessName, 1024 ) > 0 )
{
strlwr( szCurrentProcessName );
if( NULL != strstr( szCurrentProcessName, szProcessName ) )
{
FreePSAPIRoutines();
//
// kill process
//
if( false == TerminateProcess( hProcess, 0 ) )
{
CloseHandle( hProcess );
return true;
}
//
// refresh systray
//
UpdateWindow( FindWindow( NULL, "Shell_TrayWnd" ) );
//
// refresh desktop window
//
UpdateWindow( GetDesktopWindow() );
CloseHandle( hProcess );
return true;
}
}
CloseHandle( hProcess );
}
}
//
// free PSAPI routines
//
FreePSAPIRoutines();
return false;
}
//-------------------------------------------------------------------------------------------
bool FindDev( char *szDriverName )
{
char szDeviceName[ 1024 ];
char szCurrentDeviceName[ 1024 ];
LPVOID lpDevices[ 1024 ];
DWORD dDevicesSize( 1024 );
DWORD dSize( 1024 );
TCHAR tszCurrentDeviceName[ 1024 ];
DWORD dNameSize( 1024 );
//
// make the name lower case
//
memset( szDeviceName, 0, 1024*sizeof(char) );
sprintf( szDeviceName, "%s", strlwr( szDriverName ) );
//
// load PSAPI routines
//
if( false == LoadPSAPIRoutines() )
return false;
//
// enumerate devices
//
if( FALSE == EnumDeviceDrivers( lpDevices, dSize, &dDevicesSize ) )
{
FreePSAPIRoutines();
return false;
}
//
// walk trough and compare see if the device driver exists
//
for( int k( dDevicesSize / sizeof( LPVOID ) ); k >= 0; k-- )
{
memset( szCurrentDeviceName, 0, 1024*sizeof(char) );
memset( tszCurrentDeviceName, 0, 1024*sizeof(TCHAR) );
if( 0 != GetDeviceDriverBaseName( lpDevices[ k ], tszCurrentDeviceName, dNameSize ) )
{
sprintf( szCurrentDeviceName, "%S", tszCurrentDeviceName );
if( 0 == strcmp( strlwr( szCurrentDeviceName ), szDeviceName ) )
{
FreePSAPIRoutines();
return true;
}
}
}
//
// free PSAPI routines
//
FreePSAPIRoutines();
return false;
}
//-------------------------------------------------------------------------------------------
extern "C" __declspec(dllexport) void FindProcess( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop )
{
char szParameter[ 1024 ];
g_hwndParent = hwndParent;
EXDLL_INIT();
{
popstring( szParameter );
if( true == FindProc( szParameter ) )
wsprintf( szParameter, "1" );
else
wsprintf( szParameter, "0" );
setuservariable( INST_R0, szParameter );
}
}
//-------------------------------------------------------------------------------------------
extern "C" __declspec(dllexport) void KillProcess( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop )
{
char szParameter[ 1024 ];
g_hwndParent = hwndParent;
EXDLL_INIT();
{
popstring( szParameter );
if( true == KillProc( szParameter ) )
wsprintf( szParameter, "1" );
else
wsprintf( szParameter, "0" );
setuservariable( INST_R0, szParameter );
}
}
//-------------------------------------------------------------------------------------------
extern "C" __declspec(dllexport) void FindDevice( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop )
{
char szParameter[ 1024 ];
g_hwndParent = hwndParent;
EXDLL_INIT();
{
popstring( szParameter );
if( true == FindDev( szParameter ) )
wsprintf( szParameter, "1" );
else
wsprintf( szParameter, "0" );
setuservariable( INST_R0, szParameter );
}
}

View File

@@ -0,0 +1,49 @@
#pragma once
//-------------------------------------------------------------------------------------------
// PSAPI function pointers
typedef BOOL (WINAPI *lpfEnumProcesses) ( DWORD *, DWORD, DWORD * );
typedef BOOL (WINAPI *lpfEnumProcessModules) ( HANDLE, HMODULE *, DWORD, LPDWORD );
typedef DWORD (WINAPI *lpfGetModuleBaseName) ( HANDLE, HMODULE, LPTSTR, DWORD );
typedef BOOL (WINAPI *lpfEnumDeviceDrivers) ( LPVOID *, DWORD, LPDWORD );
typedef BOOL (WINAPI *lpfGetDeviceDriverBaseName)( LPVOID, LPTSTR, DWORD );
//-------------------------------------------------------------------------------------------
// Internal use routines
bool LoadPSAPIRoutines( void );
bool FreePSAPIRoutines( void );
bool FindProc( char *szProcess );
bool KillProc( char *szProcess );
bool FindDev( char *szDriverName );
//-------------------------------------------------------------------------------------------
// Exported routines
extern "C" __declspec(dllexport) void FindProcess( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop );
extern "C" __declspec(dllexport) void KillProcess( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop );
extern "C" __declspec(dllexport) void FindDevice( HWND hwndParent,
int string_size,
char *variables,
stack_t **stacktop );

Binary file not shown.

View File

@@ -0,0 +1,103 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "NSIS Plug-in for Windows process management. Only WinNT, Win2K, WinXP and Win2003 Server supported."
VALUE "CompanyName", "Andrei Ciubotaru [Hardwired]"
VALUE "FileDescription", "Windows Processes Management"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Processes"
VALUE "LegalCopyright", "Copyright (c) 2004 Hardwired. No rights reserved."
VALUE "OriginalFilename", "Processes.dll"
VALUE "ProductName", "Processes"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "processes", "processes.vcproj", "{3438467F-A719-46DC-93E5-137A8B691727}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{3438467F-A719-46DC-93E5-137A8B691727}.Debug.ActiveCfg = Debug|Win32
{3438467F-A719-46DC-93E5-137A8B691727}.Debug.Build.0 = Debug|Win32
{3438467F-A719-46DC-93E5-137A8B691727}.Release.ActiveCfg = Release|Win32
{3438467F-A719-46DC-93E5-137A8B691727}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,122 @@
----------------------------------------------------------------
----------------------------------------------------------------
Processes (Processes.dll)
Version: 1.0.0.1
Release: 12.december.2004
Description:Nullsoft Installer (NSIS) plug-in for managing?!
Windows processes.
Copyright: <09> 2004 Hardwired. No rights reserved.
There is no restriction and no guaranty for using
this software.
Author: Andrei Ciubotaru [Hardwired]
Lead Developer ICode&Ideas SRL (http://www.icode.ro)
hardwiredteks@gmail.com, hardwired@icode.ro
----------------------------------------------------------------
----------------------------------------------------------------
INTRODUCTION
The Need For Plug-in - I need it for the one of my installers.
Briefly: Use it when you need to find\kill a process when
installing\uninstalling some application. Also, use it when you
need to test the presence of a device driver.
SUPPORT
Supported platforms are: WinNT,Win2K,WinXP and Win2003 Server.
DESCRIPTION
Processes::FindProcess <process_name.exe>
Searches the currently running processes for the given
process name.
return: 1 - the process was found
0 - the process was not found
Processes::KillProcess <process_name.exe>
Searches the currently running processes for the given
process name. If the process is found then the it gets
killed.
return: 1 - the process was found and killed
0 - the process was not found or the process
cannot be killed (insuficient rights)
Processes::FindDevice <device_base_name>
Searches the installed devices drivers for the given
device base name.
(important: I said BASE NAME not FILENAME)
return: 1 - the device driver was found
0 - the device driver was not found
USAGE
First of all, does not matter where you use it. Ofcourse, the
routines must be called inside of a Section/Function scope.
Processes::FindProcess "process_name.exe"
Pop $R0
StrCmp $R0 "1" make_my_day noooooo
make_my_day:
...
noooooo:
...
Processes::KillProcess "process_name.exe"
Pop $R0
StrCmp $R0 "1" dead_meat why_wont_you_die
dead_meat:
...
why_wont_you_die:
...
Processes::FindDevice "device_base_name"
Pop $R0
StrCmp $R0 "1" blabla more_blabla
blabla:
...
more_blabla:
...
THANKS
Sunil Kamath for inspiring me. I wanted to use its FindProcDLL
but my requirements made it imposible.
Nullsoft for creating this very powerfull installer. One big,
free and full-featured (hmmm... and guiless for the moment) mean
install machine!:)
ME for being such a great coder...
... HAHAHAHAHAHAHA!
ONE MORE THING
If you use the plugin or it's source-code, I would apreciate
if my name is mentioned.
----------------------------------------------------------------
----------------------------------------------------------------

View File

@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="processes"
SccProjectName="processes"
SccLocalPath=".">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FINDPROCDLL_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/processes.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/processes.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/processes.pdb"
ImportLibrary=".\Debug/processes.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/processes.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1034"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\bin"
IntermediateDirectory="..\bin\processes"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2"
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="1"
OptimizeForWindowsApplication="TRUE"
PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;FINDPROCDLL_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
StructMemberAlignment="1"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile="..\bin\processes/processes.pch"
AssemblerListingLocation="..\bin\processes/"
ObjectFile="..\bin\processes/"
ProgramDataBaseFileName="..\bin\processes/"
WarningLevel="4"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libc.lib"
OutputFile="..\bin/Processes.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreAllDefaultLibraries="FALSE"
ProgramDatabaseFile="..\bin/processes.pdb"
OptimizeForWindows98="1"
ImportLibrary="..\bin/processes.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/processes.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="processes.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions="NDEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath=".\processes.rc">
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions="NDEBUG;_WINDOWS;_MBCS;_USRDLL;FINDPROCDLL_EXPORTS;$(NoInherit)"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="exdll.h">
</File>
<File
RelativePath=".\processes.h">
</File>
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="processes.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by processes.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

0
admin/win/nsi/page_header.bmp Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1 +1 @@
78
103

0
admin/win/nsi/tomahawk.ini Executable file → Normal file
View File

222
admin/win/nsi/tomahawk.nsi Executable file → Normal file
View File

@@ -4,7 +4,7 @@
; Some installer script options (comment-out options not required)
;-----------------------------------------------------------------------------
;!define OPTION_LICENSE_AGREEMENT
;!define OPTION_UAC_PLUGIN_ENHANCED
!define OPTION_UAC_PLUGIN_ENHANCED
!define OPTION_SECTION_SC_START_MENU
!define OPTION_SECTION_SC_DESKTOP
!define OPTION_SECTION_SC_QUICK_LAUNCH
@@ -15,7 +15,7 @@
;-----------------------------------------------------------------------------
; Some paths.
;-----------------------------------------------------------------------------
!define MING_PATH "/usr/i686-pc-mingw32/sys-root/mingw"
!define MING_PATH "/usr/i686-w64-mingw32/sys-root/mingw"
!define MING_BIN "${MING_PATH}/bin"
!define MING_DLL_PATH "${MING_BIN}"
!define MING_LIB "${MING_PATH}/lib"
@@ -23,6 +23,7 @@
!define BUILD_PATH "${ROOT_PATH}\build"
!define QT_DLL_PATH "${MING_BIN}"
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
;-----------------------------------------------------------------------------
; Increment installer revision number as part of this script.
@@ -34,7 +35,7 @@
!define VER_MAJOR "0"
!define VER_MINOR "0"
!define VER_BUILD "0"
!define VER_BUILD "3"
!define VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUILD}"
@@ -57,17 +58,10 @@ InstType Full
InstType Minimal
CRCCheck On
SetCompressor /SOLID lzma
RequestExecutionLevel user ;Now using the UAC plugin.
ReserveFile tomahawk.ini
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
;The UAC plugin provides an elevated user.
;Otherwise request admin level here.
!ifdef OPTION_UAC_PLUGIN_ENHANCED
RequestExecutionLevel user
!else
RequestExecutionLevel admin
!endif
;-----------------------------------------------------------------------------
; Include some required header files.
;-----------------------------------------------------------------------------
@@ -78,9 +72,7 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
!include Memento.nsh ;Remember user selections.
!include WinVer.nsh ;Windows version detection.
!include WordFunc.nsh ;Used by VersionCompare macro function.
!ifdef OPTION_UAC_PLUGIN_ENHANCED
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
!endif
!include UAC.nsh ;Used by the UAC elevation to install as user or admin.
;-----------------------------------------------------------------------------
; Memento selections stored in registry.
@@ -145,18 +137,46 @@ UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
##############################################################################
Function LaunchTomahawk
!ifdef OPTION_UAC_PLUGIN_ENHANCED
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
!else
Exec "$INSTDIR\tomahawk.exe"
!endif
${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
FunctionEnd
!ifdef OPTION_UAC_PLUGIN_ENHANCED
Function LaunchTomahawkAsUser
Exec "$INSTDIR\tomahawk.exe"
FunctionEnd
!endif
##############################################################################
# #
# PROCESS HANDLING FUNCTIONS AND MACROS #
# #
##############################################################################
!macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
Processes::FindProcess ${processName}
StrCmp $R0 "0" ${gotoWhenNotFound} ${gotoWhenFound}
!macroend
!macro ConfirmEndProcess processName
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Found ${processName} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?" \
IDYES process_${processName}_kill IDNO process_${processName}_ended
process_${processName}_kill:
DetailPrint "Killing ${processName} processes."
Processes::KillProcess ${processName}
Sleep 1500
StrCmp $R0 "1" process_${processName}_ended
DetailPrint "Process to kill not found!"
process_${processName}_ended:
!macroend
!macro CheckAndConfirmEndProcess processName
!insertmacro CheckForProcess ${processName} 0 no_process_${processName}_to_end
!insertmacro ConfirmEndProcess ${processName}
no_process_${processName}_to_end:
!macroend
Function EnsureTomahawkShutdown
!insertmacro CheckAndConfirmEndProcess "tomahawk.exe"
FunctionEnd
##############################################################################
# #
@@ -225,12 +245,10 @@ Function PageLeaveReinstall
Delete $R1
RMDir $INSTDIR
no_remove_uninstaller:
StrCmp $R0 "2" +2 0
StrCmp $R0 "2" 0 +3
UAC::Unload
Quit
BringToFront
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload
Quit
!endif
reinst_done:
FunctionEnd
@@ -249,14 +267,32 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
SetDetailsPrint listonly
SetOutPath "$INSTDIR"
;Main executable.
File "${BUILD_PATH}\tomahawk.exe"
!ifdef INSTALL_PATH
;Main executable.
File "${INSTALL_PATH}\bin\tomahawk.exe"
;Plugins
File "${BUILD_PATH}\src\libtomahawk\libtomahawklib.dll"
File "${BUILD_PATH}\libsip_jabber.dll"
File "${BUILD_PATH}\libsip_twitter.dll"
File "${BUILD_PATH}\libsip_zeroconf.dll"
File "${INSTALL_PATH}\lib\librtaudio.dll"
File "${INSTALL_PATH}\lib\libqxtweb-standalone.dll"
File "${INSTALL_PATH}\lib\libtomahawk_jdns.dll"
File "${INSTALL_PATH}\lib\libtomahawk_qtweetlib.dll"
File "${INSTALL_PATH}\lib\libtomahawklib.dll"
File "${INSTALL_PATH}\lib\libtomahawk_sipjabber.dll"
File "${INSTALL_PATH}\lib\libtomahawk_siptwitter.dll"
File "${INSTALL_PATH}\lib\libtomahawk_sipzeroconf.dll"
!endif
!ifndef INSTALL_PATH
;Main executable.
File "${BUILD_PATH}\tomahawk.exe"
File "${BUILD_PATH}\thirdparty\rtaudio\librtaudio.dll"
File "${BUILD_PATH}\thirdparty\qxt\qxtweb-standalone\libqxtweb-standalone.dll"
File "${BUILD_PATH}\thirdparty\jdns\libtomahawk_jdns.dll"
File "${BUILD_PATH}\thirdparty\qtweetlib\libtomahawk_qtweetlib.dll"
File "${BUILD_PATH}\src\libtomahawk\libtomahawklib.dll"
File "${BUILD_PATH}\libtomahawk_sipjabber.dll"
File "${BUILD_PATH}\libtomahawk_siptwitter.dll"
File "${BUILD_PATH}\libtomahawk_sipzeroconf.dll"
!endif
;License & release notes.
File "${ROOT_PATH}\LICENSE.txt"
@@ -274,6 +310,12 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
SetOutPath "$INSTDIR\sqldrivers"
File "${SQLITE_DLL_PATH}\qsqlite4.dll"
SetOutPath "$INSTDIR"
;Image plugins
SetOutPath "$INSTDIR\imageformats"
File "${IMAGEFORMATS_DLL_PATH}\qgif4.dll"
File "${IMAGEFORMATS_DLL_PATH}\qjpeg4.dll"
SetOutPath "$INSTDIR"
;Cygwin/c++ stuff
;File "${MING_DLL_PATH}\cygmad-0.dll"
@@ -283,8 +325,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_DLL_PATH}\libstdc++-6.dll"
;Audio stuff
File "${BUILD_PATH}\thirdparty\rtaudio\librtaudio.dll"
;File "${MING_DLL_PATH}\libmad.dll"
File "${MING_DLL_PATH}\libmad-0.dll"
File "${MING_DLL_PATH}\libogg-0.dll"
File "${MING_DLL_PATH}\libvorbisfile-3.dll"
File "${MING_DLL_PATH}\libvorbis-0.dll"
@@ -296,6 +337,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_DLL_PATH}\libtag.dll"
File "${MING_DLL_PATH}\libgloox-8.dll"
File "${MING_DLL_PATH}\libpng15-15.dll"
File "${MING_DLL_PATH}\libjpeg-8.dll"
File "${MING_DLL_PATH}\zlib1.dll"
File "${MING_DLL_PATH}\libechonest.dll"
@@ -304,9 +346,7 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
File "${MING_LIB}\libclucene-core.dll"
File "${MING_LIB}\libclucene-shared.dll"
File "${BUILD_PATH}\thirdparty\qxt\qxtweb-standalone\libqxtweb-standalone.dll"
File "${BUILD_PATH}\thirdparty\jdns\libtomahawk_jdns.dll"
File "${BUILD_PATH}\thirdparty\qtweetlib\libtomahawk_qtweetlib.dll"
File "${MING_BIN}\libqtsparkle.dll"
SectionEnd
SectionGroup "Shortcuts"
@@ -323,7 +363,7 @@ SectionGroup "Shortcuts"
CreateShortCut "$SMPROGRAMS\Tomahawk\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
CreateShortCut "$SMPROGRAMS\Tomahawk\Tomahawk.lnk" "$INSTDIR\tomahawk.exe"
CreateShortCut "$SMPROGRAMS\Tomahawk\Release notes.lnk" "$INSTDIR\NOTES.txt"
CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\Tomahawk\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SetShellVarContext current
${MementoSectionEnd}
!endif
@@ -367,7 +407,7 @@ Section -post
SetDetailsPrint textonly
DetailPrint "Writing Uninstaller"
SetDetailsPrint listonly
WriteUninstaller $INSTDIR\Uninstall.exe
WriteUninstaller $INSTDIR\uninstall.exe
;Registry keys required for installer version handling and uninstaller.
SetDetailsPrint textonly
@@ -395,6 +435,12 @@ Section -post
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "NoRepair" "1"
; Register tomahawk:// protocol handler
WriteRegStr HKCR "tomahawk" "" "URL: Tomahawk Protocol"
WriteRegStr HKCR "tomahawk\DefaultIcon" "" $INSTDIR\tomahawk.exe,1
WriteRegStr HKCR "tomahawk\shell" "" "open"
WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\tomahawk.exe" "%1"'
SetDetailsPrint textonly
DetailPrint "Finsihed."
SectionEnd
@@ -454,6 +500,8 @@ Section Uninstall
DeleteRegValue HKLM "Software\Tomahawk" ""
DeleteRegKey HKLM "Software\Tomahawk"
DeleteRegKey HKCR "tomahawk"
;Start menu shortcuts.
!ifdef OPTION_SECTION_SC_START_MENU
SetShellVarContext all
@@ -503,27 +551,25 @@ Function .onInit
${MementoSectionRestore}
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort
UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort
UAC_ElevationAborted:
Abort
UAC_ElevationAborted:
Abort
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
goto UAC_Elevate
!endif
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This installer requires admin access, try again"
goto UAC_Elevate
;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
@@ -531,19 +577,25 @@ Function .onInit
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort
;Use available InstallLocation when possible. This is useful in the uninstaller
;via re-install, which would otherwise use a default location - a bug.
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tomahawk" "InstallLocation"
StrCmp $R0 "" SkipSetInstDir
StrCpy $INSTDIR $R0
SkipSetInstDir:
;Shutdown Tomahawk in case Add/Remove re-installer option used.
Call EnsureTomahawkShutdown
FunctionEnd
Function .onInstSuccess
${MementoSectionSave}
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
UAC::Unload ;Must call unload!
FunctionEnd
Function .onInstFailed
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
UAC::Unload ;Must call unload!
FunctionEnd
##############################################################################
@@ -553,27 +605,25 @@ FunctionEnd
##############################################################################
Function un.onInit
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort
UAC_Err:
MessageBox MB_ICONSTOP "Unable to elevate, error $0"
Abort
UAC_ElevationAborted:
Abort
UAC_ElevationAborted:
Abort
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
goto UAC_Elevate
!endif
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
goto UAC_Elevate
;Prevent multiple instances.
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
@@ -584,13 +634,9 @@ Function un.onInit
FunctionEnd
Function un.onUnInstSuccess
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
UAC::Unload ;Must call unload!
FunctionEnd
Function un.onUnInstFailed
!ifdef OPTION_UAC_PLUGIN_ENHANCED
UAC::Unload ;Must call unload!
!endif
UAC::Unload ;Must call unload!
FunctionEnd

0
admin/win/nsi/welcome.bmp Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@@ -3,15 +3,23 @@
<channel>
<title>Tomahawk Player</title>
<link>http://www.gettomahawk.com</link>
<description>Tomahawk Player</description>
<description>Tomahawk Player Beta</description>
<language>en</language>
<item>
<title>Version 0.0.1 (Tomahawk Player - It Lives!)</title>
<title>Version 0.0.1 (Tomahawk Player Beta - It Lives?)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/blob/master/ChangeLog
https://github.com/tomahawk-player/tomahawk/raw/0.0.1/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Fri, 04 Mar 2011 16:05:15 -0500</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparklewin/updates/tomahawk0.0.1.exe" sparkle:version="0.0.1" />
<pubDate>Fri, 25 Mar 2011 00:00:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/tomahawk-beta-0.0.1.exe" sparkle:version="0.0.1" />
</item>
<item>
<title>Version 0.0.2 (Tomahawk Player Beta - It Lives?)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/0.0.2/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Mon, 28 Mar 2011 05:00:02 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/tomahawk-0.0.2.exe" sparkle:version="0.0.2" />
</item>
</channel>
</rss>

View File

@@ -8,10 +8,18 @@
<item>
<title>Version 0.0.1 (Tomahawk Player - It Lives!)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/blob/master/ChangeLog
https://github.com/tomahawk-player/tomahawk/raw/0.0.1/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Fri, 04 Mar 2011 16:05:15 -0500</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparklewin/updates/tomahawk0.0.1.exe" sparkle:version="0.0.1" />
<pubDate>Fri, 25 Mar 2011 00:00:01 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/tomahawk-beta-0.0.1.exe" sparkle:version="0.0.1" />
</item>
<item>
<title>Version 0.0.2 (Tomahawk Player - It Lives!)</title>
<sparkle:releaseNotesLink>
https://github.com/tomahawk-player/tomahawk/raw/0.0.2/ChangeLog
</sparkle:releaseNotesLink>
<pubDate>Mon, 28 Mar 2011 05:00:02 +0100</pubDate>
<enclosure url="http://download.tomahawk-player.org/tomahawk-0.0.2.exe" sparkle:version="0.0.2" />
</item>
</channel>
</rss>

21
cmake_uninstall.cmake.in Normal file
View File

@@ -0,0 +1,21 @@
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
data/images/configure.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
data/images/music-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 B

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,148 +0,0 @@
#ifndef TOMAHAWK_INFOSYSTEM_H
#define TOMAHAWK_INFOSYSTEM_H
#include <QtCore/QObject>
#include <QtCore/QtDebug>
#include <QtCore/qmap.h>
#include <QtCore/qsharedpointer.h>
#include <QtCore/qset.h>
#include <QtCore/qlinkedlist.h>
#include <QtCore/qvariant.h>
namespace Tomahawk {
namespace InfoSystem {
enum InfoType {
InfoTrackID,
InfoTrackArtist,
InfoTrackAlbum,
InfoTrackGenre,
InfoTrackComposer,
InfoTrackDate,
InfoTrackNumber,
InfoTrackDiscNumber,
InfoTrackBitRate,
InfoTrackLength,
InfoTrackSampleRate,
InfoTrackFileSize,
InfoTrackBPM,
InfoTrackReplayGain,
InfoTrackReplayPeakGain,
InfoTrackLyrics,
InfoTrackLocation,
InfoTrackProfile,
InfoTrackEnergy,
InfoTrackDanceability,
InfoTrackTempo,
InfoTrackLoudness,
InfoArtistID,
InfoArtistName,
InfoArtistBiography,
InfoArtistBlog,
InfoArtistFamiliarity,
InfoArtistHotttness,
InfoArtistImages,
InfoArtistNews,
InfoArtistProfile,
InfoArtistReviews,
InfoArtistSongs,
InfoArtistSimilars,
InfoArtistTerms,
InfoArtistLinks,
InfoArtistVideos,
InfoAlbumID,
InfoAlbumName,
InfoAlbumArtist,
InfoAlbumDate,
InfoAlbumGenre,
InfoAlbumComposer,
InfoMiscTopHotttness,
InfoMiscTopTerms,
InfoNoInfo
};
typedef QMap< InfoType, QVariant > InfoMap;
typedef QMap< QString, QMap< QString, QString > > InfoGenericMap;
typedef QHash<QString, QVariant> InfoCustomDataHash;
typedef QHash<QString, QString> MusixMatchHash;
class InfoPlugin : public QObject
{
Q_OBJECT
public:
InfoPlugin(QObject *parent)
:QObject(parent)
{
qDebug() << Q_FUNC_INFO;
}
~InfoPlugin()
{
qDebug() << Q_FUNC_INFO;
}
virtual void getInfo(const QString &caller, const InfoType type, const QVariant &data, Tomahawk::InfoSystem::InfoCustomDataHash customData) = 0;
signals:
void info(QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomDataHash customData);
void finished(QString, Tomahawk::InfoSystem::InfoType);
protected:
InfoType m_type;
};
typedef QWeakPointer< InfoPlugin > InfoPluginPtr;
class InfoSystem : public QObject
{
Q_OBJECT
public:
InfoSystem(QObject *parent);
~InfoSystem()
{
qDebug() << Q_FUNC_INFO;
}
void registerInfoTypes(const InfoPluginPtr &plugin, const QSet< InfoType > &types);
void getInfo(const QString &caller, const InfoType type, const QVariant &data, InfoCustomDataHash customData);
void getInfo(const QString &caller, const InfoMap &input, InfoCustomDataHash customData);
signals:
void info(QString caller, Tomahawk::InfoSystem::InfoType, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomDataHash customData);
void finished(QString target);
public slots:
void infoSlot(QString target, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomDataHash customData);
void finishedSlot(QString target,Tomahawk::InfoSystem::InfoType type);
private:
QLinkedList< InfoPluginPtr > determineOrderedMatches(const InfoType type) const;
QMap< InfoType, QLinkedList<InfoPluginPtr> > m_infoMap;
// For now, statically instantiate plugins; this is just somewhere to keep them
QLinkedList<InfoPluginPtr> m_plugins;
QHash< QString, QHash< Tomahawk::InfoSystem::InfoType, int > > m_dataTracker;
};
}
}
Q_DECLARE_METATYPE(Tomahawk::InfoSystem::InfoGenericMap)
Q_DECLARE_METATYPE(Tomahawk::InfoSystem::InfoCustomDataHash);
Q_DECLARE_METATYPE(Tomahawk::InfoSystem::MusixMatchHash)
#endif // TOMAHAWK_INFOSYSTEM_H

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLUGIN_INCLUDES_H
#define PLUGIN_INCLUDES_H

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOMAHAWKAPP_H
#define TOMAHAWKAPP_H
@@ -16,15 +34,17 @@
#include "QxtHttpServerConnector"
#include "QxtHttpSessionManager"
#include "tomahawk/tomahawkplugin.h"
#include "typedefs.h"
#include "playlist.h"
#include "resolver.h"
#include "network/servent.h"
#include "utils/tomahawkutils.h"
#include "kdsingleapplicationguard/kdsingleapplicationguard.h"
class AudioEngine;
class Database;
class ScanManager;
class SipHandler;
class TomahawkSettings;
class XMPPBot;
@@ -59,10 +79,10 @@ public:
TomahawkApp( int& argc, char *argv[] );
virtual ~TomahawkApp();
void init();
static TomahawkApp* instance();
SipHandler* sipHandler() { return m_sipHandler; }
Tomahawk::InfoSystem::InfoSystem* infoSystem() { return m_infoSystem; }
XMPPBot* xmppBot() { return m_xmppBot; }
#ifndef TOMAHAWK_HEADLESS
@@ -70,16 +90,22 @@ public:
TomahawkWindow* mainWindow() const { return m_mainwindow; }
#endif
void addScriptResolver( const QString& scriptPath );
void removeScriptResolver( const QString& scriptPath );
void enableScriptResolver( const QString& scriptPath );
void disableScriptResolver( const QString& scriptPath );
Tomahawk::ExternalResolver* resolverForPath( const QString& scriptPath );
// PlatformInterface
virtual void activate();
virtual bool loadUrl( const QString& url );
// because QApplication::arguments() is expensive
bool scrubFriendlyName() const { return m_scrubFriendlyName; }
public slots:
void instanceStarted( KDSingleApplicationGuard::Instance );
private slots:
void setupSIP();
void messageReceived( const QString& );
private:
void initLocalCollection();
@@ -91,15 +117,17 @@ private:
void startHTTP();
QList<Tomahawk::collection_ptr> m_collections;
QList<TomahawkPlugin*> m_plugins;
QList<Tomahawk::ExternalResolver*> m_scriptResolvers;
QHash<QString, Tomahawk::ExternalResolver*> m_scriptResolvers;
Database* m_database;
ScanManager *m_scanManager;
AudioEngine* m_audioEngine;
SipHandler* m_sipHandler;
Servent* m_servent;
Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
XMPPBot* m_xmppBot;
Tomahawk::ShortcutHandler* m_shortcutHandler;
bool m_scrubFriendlyName;
#ifdef LIBLASTFM_FOUND
Scrobbler* m_scrobbler;
@@ -107,14 +135,13 @@ private:
#ifndef TOMAHAWK_HEADLESS
TomahawkWindow* m_mainwindow;
#endif
#endif
bool m_headless;
Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
QxtHttpServerConnector m_connector;
QxtHttpSessionManager m_session;
};
#endif // TOMAHAWKAPP_H

View File

@@ -1,31 +0,0 @@
#ifndef TOMAHAWK_PLUGIN_H
#define TOMAHAWK_PLUGIN_H
#include <QString>
#include <QtPlugin>
#include "pluginapi.h"
class TomahawkPlugin
{
public:
TomahawkPlugin(){};
TomahawkPlugin(Tomahawk::PluginAPI * api)
: m_api(api) {};
virtual TomahawkPlugin * factory(Tomahawk::PluginAPI * api) = 0;
virtual QString name() const = 0;
virtual QString description() const = 0;
protected:
Tomahawk::PluginAPI * api() const { return m_api; };
private:
Tomahawk::PluginAPI * m_api;
};
Q_DECLARE_INTERFACE(TomahawkPlugin, "org.tomahawk.TomahawkPlugin/1.0")
#endif

1484
lang/tomahawk_de.ts Normal file

File diff suppressed because it is too large Load Diff

5
lang/tomahawk_i18n.qrc Normal file
View File

@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/lang">
<file>tomahawk_de.qm</file>
</qresource>
</RCC>

25
lang/translations.cmake Normal file
View File

@@ -0,0 +1,25 @@
FILE (GLOB TS_FILES ${CMAKE_SOURCE_DIR}/lang/*.ts)
QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES})
## HACK HACK HACK - around rcc limitations to allow out of source-tree building
SET( trans_file tomahawk_i18n )
SET( trans_srcfile ${CMAKE_SOURCE_DIR}/lang/${trans_file}.qrc)
SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx)
# Copy the QRC file to the output directory
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_infile}
COMMAND ${CMAKE_COMMAND} -E copy ${trans_srcfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_srcfile}
)
# Run the resource compiler (rcc_options should already be set)
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_outfile}
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${trans_file} -o ${trans_outfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_infile}
DEPENDS ${QM_FILES}
)

View File

@@ -73,6 +73,8 @@
<file>./data/images/home.png</file>
<file>./data/images/back.png</file>
<file>./data/images/forward.png</file>
<file>./data/images/music-icon.png</file>
<file>./data/images/configure.png</file>
<file>./data/topbar-radiobuttons.css</file>
<file>./data/icons/tomahawk-icon-16x16.png</file>
<file>./data/icons/tomahawk-icon-32x32.png</file>

View File

@@ -10,5 +10,3 @@ ELSE()
gnutls
)
ENDIF()
#include( "CPack.txt" )

View File

@@ -33,15 +33,18 @@ if (APPLE)
# Use two different sparkle update tracks for debug and release
# We have to change the URL in the Info.plist file :-/
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
FILE(READ ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist plist)
STRING( REPLACE "http://download.tomahawk-player.org/sparkle" # match this
"http://download.tomahawk-player.org/sparkle-debug" #replace with debug url
FILE(READ ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist plist)
STRING( REPLACE "TOMAHAWK_VERSION"
${VERSION}
edited_plist # save in this variable
"${plist}" # from the contents of this var
)
FILE( WRITE ${CMAKE_BINARY_DIR}/Info.plist "${edited_plist}" )
ELSE() # Just copy the release one
FILE( COPY ${CMAKE_SOURCE_DIR}/admin/mac/Info.plist DESTINATION ${CMAKE_BINARY_DIR} )
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
STRING( REPLACE "http://download.tomahawk-player.org/sparkle" # match this
"http://download.tomahawk-player.org/sparkle-debug" #replace with debug url
edited_plist # save in this variable
"${edited_plist}" # from the contents of this var
)
ENDIF()
FILE( WRITE ${CMAKE_BINARY_DIR}/Info.plist "${edited_plist}" )
endif (APPLE)

View File

@@ -35,10 +35,6 @@ ENDIF()
SET( tomahawkSources ${tomahawkSources}
sip/SipHandler.cpp
infosystem/infosystem.cpp
infosystem/infoplugins/echonestplugin.cpp
infosystem/infoplugins/musixmatchplugin.cpp
web/api_v1.cpp
resolvers/scriptresolver.cpp
@@ -68,18 +64,16 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
tomahawktrayicon.cpp
audiocontrols.cpp
settingsdialog.cpp
resolverconfigdelegate.cpp
resolversmodel.cpp
tomahawkwindow.cpp
)
SET( tomahawkHeaders ${tomahawkHeaders}
"${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.h"
"${TOMAHAWK_INC_DIR}/tomahawk/infosystem.h"
sip/SipHandler.h
infosystem/infoplugins/echonestplugin.h
infosystem/infoplugins/musixmatchplugin.h
web/api_v1.h
resolvers/scriptresolver.h
@@ -108,6 +102,9 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
tomahawktrayicon.h
audiocontrols.h
settingsdialog.h
resolverconfigdelegate.h
resolversmodel.h
resolverconfigwrapper.h
tomahawkwindow.h
)
@@ -121,9 +118,10 @@ SET( tomahawkUI ${tomahawkUI}
)
INCLUDE_DIRECTORIES(
.
.
${TOMAHAWK_INC_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
audio
database
@@ -133,14 +131,14 @@ INCLUDE_DIRECTORIES(
topbar
utils
libtomahawk
libtomahawk/utils
mac
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb/
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb
${THIRDPARTY_DIR}/qtweetlib/qtweetlib/src
${THIRDPARTY_DIR}/qtweetlib/tomahawk-custom
${TAGLIB_INCLUDES}
${QJSON_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}/..
)
@@ -165,6 +163,7 @@ IF( APPLE )
ENDIF( APPLE )
IF(GLOOX_FOUND)
INCLUDE_DIRECTORIES( ${GLOOX_INCLUDE_DIR} )
SET( tomahawkHeaders ${tomahawkHeaders} xmppbot/xmppbot.h )
SET( tomahawkSources ${tomahawkSources} xmppbot/xmppbot.cpp )
ENDIF(GLOOX_FOUND)
@@ -177,7 +176,9 @@ qt4_wrap_cpp( tomahawkMoc ${tomahawkHeaders} )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} )
include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${tomahawkHeaders} ${trans_outfile})
IF( "${gui}" STREQUAL "no" )
ELSE()
@@ -195,14 +196,14 @@ IF( APPLE )
)
ENDIF( APPLE )
IF( WIN32 )
ADD_EXECUTABLE( tomahawk ${final_src} )
ADD_EXECUTABLE( tomahawk WIN32 ${final_src} )
ENDIF( WIN32 )
MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" )
SET(LINK_LIBRARIES "")
IF(LIBLASTFM_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${LIBLASTFM_LIBRARY} )
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
ENDIF(LIBLASTFM_FOUND)
IF(GLOOX_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${GLOOX_LIBRARIES} )
@@ -232,4 +233,16 @@ IF( APPLE )
ENDIF(HAVE_SPARKLE)
ENDIF( APPLE )
INCLUDE( "CPack.txt" )
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION bin )
IF(KDE4_FOUND) #install protocol file
FILE(READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol)
STRING( REPLACE "/path/to/binary" # match this
"${CMAKE_INSTALL_PREFIX}/bin/tomahawk" # this is linux (kde) so pretty safe I think
edited_protocol # save in this variable
"${protocol}" # from the contents of this var
)
FILE( WRITE ${CMAKE_BINARY_DIR}/tomahawk.protocol "${edited_protocol}" )
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
ENDIF()
#INCLUDE( "CPack.txt" )

View File

@@ -58,8 +58,8 @@ SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqtgui4 (>=4:4.7.0-0ubuntu1), libtag1c2a (>=
INSTALL(
TARGETS tomahawk DESTINATION bin
RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# LIBRARY DESTINATION lib${LIB_SUFFIX}
# ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
INSTALL(

View File

@@ -1,9 +1,26 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "audiocontrols.h"
#include "ui_audiocontrols.h"
#include <QNetworkReply>
#include "tomahawk/tomahawkapp.h"
#include "audio/audioengine.h"
#include "playlist/playlistmanager.h"
#include "utils/imagebutton.h"
@@ -11,7 +28,7 @@
#include "album.h"
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
static QString s_acInfoIdentifier = QString( "AUDIOCONTROLS" );
AudioControls::AudioControls( QWidget* parent )
@@ -27,6 +44,10 @@ AudioControls::AudioControls( QWidget* parent )
QFont font( ui->artistTrackLabel->font() );
font.setPixelSize( 12 );
#ifdef Q_WS_MAC
font.setPointSize( font.pointSize() - 2 );
#endif
ui->artistTrackLabel->setFont( font );
ui->artistTrackLabel->setElideMode( Qt::ElideMiddle );
ui->artistTrackLabel->setType( QueryLabel::ArtistAndTrack );
@@ -121,10 +142,10 @@ AudioControls::AudioControls( QWidget* parent )
connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
connect( ui->playPauseButton, SIGNAL( clicked() ), this, SIGNAL( playPressed() ) );
connect( ui->pauseButton, SIGNAL( clicked() ), this, SIGNAL( pausePressed() ) );
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
@@ -144,6 +165,12 @@ AudioControls::AudioControls( QWidget* parent )
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
connect( Tomahawk::InfoSystem::InfoSystem::instance(),
SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
SLOT( infoSystemInfo( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ) );
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
onPlaybackStopped(); // initial state
}
@@ -179,40 +206,6 @@ AudioControls::onVolumeChanged( int volume )
}
void
AudioControls::onCoverArtDownloaded()
{
if ( m_currentTrack.isNull() )
return;
QNetworkReply* reply = qobject_cast<QNetworkReply*>( sender() );
QUrl redir = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl();
if ( redir.isEmpty() )
{
const QByteArray ba = reply->readAll();
if ( ba.length() )
{
QPixmap pm;
pm.loadFromData( ba );
if ( pm.isNull() || reply->url().toString().startsWith( LASTFM_DEFAULT_COVER ) )
ui->coverImage->setPixmap( m_defaultCover );
else
ui->coverImage->setPixmap( pm.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
}
}
else
{
// Follow HTTP redirect
QNetworkRequest req( redir );
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
}
reply->deleteLater();
}
void
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
@@ -220,10 +213,61 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
onPlaybackLoading( result );
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=medium&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( result->artist()->name() ).arg( result->album()->name() ) );
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
Tomahawk::InfoSystem::InfoCustomData trackInfo;
trackInfo["artist"] = QVariant::fromValue< QString >( result->artist()->name() );
trackInfo["album"] = QVariant::fromValue< QString >( result->album()->name() );
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo(
s_acInfoIdentifier, Tomahawk::InfoSystem::InfoAlbumCoverArt,
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( trackInfo ), Tomahawk::InfoSystem::InfoCustomData() );
}
void
AudioControls::infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData )
{
Q_UNUSED( input );
Q_UNUSED( customData );
qDebug() << Q_FUNC_INFO << caller << type << s_acInfoIdentifier << Tomahawk::InfoSystem::InfoAlbumCoverArt;
if ( caller != s_acInfoIdentifier || type != Tomahawk::InfoSystem::InfoAlbumCoverArt )
{
qDebug() << "Info of wrong type or not with our identifier";
return;
}
if ( m_currentTrack.isNull() )
{
qDebug() << "Current track is null when trying to apply fetched cover art";
return;
}
if ( !output.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
{
qDebug() << "Cannot convert fetched art from a QByteArray";
return;
}
Tomahawk::InfoSystem::InfoCustomData returnedData = output.value< Tomahawk::InfoSystem::InfoCustomData >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
{
QPixmap pm;
pm.loadFromData( ba );
if ( pm.isNull() )
ui->coverImage->setPixmap( m_defaultCover );
else
ui->coverImage->setPixmap( pm.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
}
}
void
AudioControls::infoSystemFinished( QString target )
{
Q_UNUSED( target );
qDebug() << Q_FUNC_INFO;
}
@@ -280,7 +324,7 @@ AudioControls::onPlaybackResumed()
ui->pauseButton->setVisible( true );
ui->pauseButton->setEnabled( true );
ui->playPauseButton->setVisible( false );
ui->playPauseButton->setEnabled( false );
ui->playPauseButton->setEnabled( false );
}

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUDIOCONTROLS_H
#define AUDIOCONTROLS_H
@@ -5,6 +23,7 @@
#include "result.h"
#include "playlistinterface.h"
#include "infosystem/infosystem.h"
namespace Ui
{
@@ -22,7 +41,7 @@ public:
signals:
void playPressed();
void pausePressed();
public slots:
void onRepeatModeChanged( PlaylistInterface::RepeatMode mode );
void onShuffleModeChanged( bool enabled );
@@ -47,7 +66,8 @@ private slots:
void onAlbumClicked();
void onTrackClicked();
void onCoverArtDownloaded();
void infoSystemInfo( QString caller, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomData customData );
void infoSystemFinished( QString target );
private:
Ui::AudioControls *ui;

View File

@@ -1,16 +1,34 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HEADLESSCHECK
#define HEADLESSCHECK
#ifdef ENABLE_HEADLESS
#define TOMAHAWK_APPLICATION QtSingleCoreApplication
#define TOMAHAWK_APPLICATION QCoreApplication
#define TOMAHAWK_HEADLESS
#include "qtsingleapp/qtsingleapplication.h"
#include <QApplication>>
#else
#define TOMAHAWK_APPLICATION QtSingleApplication
#include "qtsingleapp/qtsingleapplication.h"
#define TOMAHAWK_APPLICATION QApplication
#include <QApplication>
#include "tomahawkwindow.h"
#endif

View File

@@ -1,57 +0,0 @@
#ifndef ECHONESTPLUGIN_H
#define ECHONESTPLUGIN_H
#include "tomahawk/infosystem.h"
#include <QObject>
class QNetworkReply;
namespace Echonest {
class Artist;
}
namespace Tomahawk
{
namespace InfoSystem
{
class EchoNestPlugin : public InfoPlugin
{
Q_OBJECT
public:
EchoNestPlugin(QObject *parent);
virtual ~EchoNestPlugin();
void getInfo( const QString &caller, const InfoType type, const QVariant &data, InfoCustomDataHash customData );
private:
void getSongProfile( const QString &caller, const QVariant &data, InfoCustomDataHash &customData, const QString &item = QString() );
void getArtistBiography ( const QString &caller, const QVariant &data, InfoCustomDataHash &customData );
void getArtistFamiliarity( const QString &caller, const QVariant &data, InfoCustomDataHash &customData );
void getArtistHotttnesss( const QString &caller, const QVariant &data, InfoCustomDataHash &customData );
void getArtistTerms( const QString &caller, const QVariant &data, InfoCustomDataHash &customData );
void getMiscTopTerms( const QString &caller, const QVariant &data, InfoCustomDataHash &customData );
bool isValidArtistData( const QString &caller, const QVariant& data, InfoCustomDataHash& customData );
bool isValidTrackData( const QString &caller, const QVariant& data, InfoCustomDataHash& customData );
Echonest::Artist artistFromReply( QNetworkReply* );
private slots:
void getArtistBiographySlot();
void getArtistFamiliaritySlot();
void getArtistHotttnesssSlot();
void getArtistTermsSlot();
void getMiscTopSlot();
private:
QHash< QNetworkReply*, InfoCustomDataHash > m_replyMap;
QHash< QNetworkReply*, QString > m_callerMap;
};
}
}
#endif // ECHONESTPLUGIN_H

View File

@@ -1,38 +0,0 @@
#ifndef MUSIXMATCHPLUGIN_H
#define MUSIXMATCHPLUGIN_H
#include "tomahawk/infosystem.h"
class QNetworkReply;
namespace Tomahawk
{
namespace InfoSystem
{
class MusixMatchPlugin : public InfoPlugin
{
Q_OBJECT
public:
MusixMatchPlugin(QObject *parent);
virtual ~MusixMatchPlugin();
void getInfo(const QString &caller, const InfoType type, const QVariant &data, InfoCustomDataHash customData);
private:
bool isValidTrackData( const QString &caller, const QVariant& data, InfoCustomDataHash &customData );
public slots:
void trackSearchSlot();
void trackLyricsSlot();
private:
QString m_apiKey;
};
}
}
#endif // MUSIXMATCHPLUGIN_H

View File

@@ -1,96 +0,0 @@
#include "tomahawk/infosystem.h"
#include "infoplugins/echonestplugin.h"
#include "infoplugins/musixmatchplugin.h"
using namespace Tomahawk::InfoSystem;
InfoSystem::InfoSystem(QObject *parent)
: QObject( parent )
{
qDebug() << Q_FUNC_INFO;
qRegisterMetaType<QMap< QString, QMap< QString, QString > > >("Tomahawk::InfoSystem::InfoGenericMap");
qRegisterMetaType<QHash<QString, QVariant > >("Tomahawk::InfoSystem::InfoCustomDataHash");
qRegisterMetaType<QHash<QString, QString > >("Tomahawk::InfoSystem::MusixMatchHash");
InfoPluginPtr enptr(new EchoNestPlugin(this));
m_plugins.append(enptr);
InfoPluginPtr mmptr(new MusixMatchPlugin(this));
m_plugins.append(mmptr);
}
void InfoSystem::registerInfoTypes(const InfoPluginPtr &plugin, const QSet< InfoType >& types)
{
qDebug() << Q_FUNC_INFO;
Q_FOREACH(InfoType type, types)
m_infoMap[type].append(plugin);
}
QLinkedList< InfoPluginPtr > InfoSystem::determineOrderedMatches(const InfoType type) const
{
//Dummy function for now that returns the various items in the QSet; at some point this will
//probably need to support ordering based on the data source
QLinkedList< InfoPluginPtr > providers;
Q_FOREACH(InfoPluginPtr ptr, m_infoMap[type])
providers << ptr;
return providers;
}
void InfoSystem::getInfo(const QString &caller, const InfoType type, const QVariant& data, InfoCustomDataHash customData)
{
qDebug() << Q_FUNC_INFO;
QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type);
if (providers.isEmpty())
{
emit info(QString(), Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
return;
}
InfoPluginPtr ptr = providers.first();
if (!ptr)
{
emit info(QString(), Tomahawk::InfoSystem::InfoNoInfo, QVariant(), QVariant(), customData);
return;
}
m_dataTracker[caller][type] = m_dataTracker[caller][type] + 1;
qDebug() << "current count in dataTracker for type" << type << "is" << m_dataTracker[caller][type];
connect(ptr.data(), SIGNAL(info(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomDataHash)),
this, SLOT(infoSlot(QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomDataHash)), Qt::UniqueConnection);
connect(ptr.data(), SIGNAL(finished(QString, Tomahawk::InfoSystem::InfoType)),
this, SLOT(finishedSlot(QString, Tomahawk::InfoSystem::InfoType)), Qt::UniqueConnection);
ptr.data()->getInfo(caller, type, data, customData);
}
void InfoSystem::getInfo(const QString &caller, const InfoMap &input, InfoCustomDataHash customData)
{
Q_FOREACH( InfoType type, input.keys() )
getInfo(caller, type, input[type], customData);
}
void InfoSystem::infoSlot(QString target, Tomahawk::InfoSystem::InfoType type, QVariant input, QVariant output, Tomahawk::InfoSystem::InfoCustomDataHash customData)
{
qDebug() << Q_FUNC_INFO;
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];
if (m_dataTracker[target][type] == 0)
{
qDebug() << "Caller was not waiting for that type of data!";
return;
}
emit info(target, type, input, output, customData);
}
void InfoSystem::finishedSlot(QString target, Tomahawk::InfoSystem::InfoType type)
{
qDebug() << Q_FUNC_INFO;
m_dataTracker[target][type] = m_dataTracker[target][type] - 1;
qDebug() << "current count in dataTracker is " << m_dataTracker[target][type];
Q_FOREACH(Tomahawk::InfoSystem::InfoType testtype, m_dataTracker[target].keys())
{
if (m_dataTracker[target][testtype] != 0)
{
qDebug() << "found outstanding request of type" << testtype;
return;
}
}
qDebug() << "emitting finished with target" << target;
emit finished(target);
}

View File

@@ -1,86 +0,0 @@
#include "remoteioconnection.h"
#include <QFile>
RemoteIOConnection::RemoteIOConnection(Servent * s, FileTransferSession * fts)
: Connection(s), m_fts(fts)
{
qDebug() << "CTOR " << id() ;
}
RemoteIOConnection::~RemoteIOConnection()
{
qDebug() << "DTOR " << id() ;
}
QString RemoteIOConnection::id() const
{
return QString("RemoteIOConnection[%1]").arg(m_fts->fid());
}
void RemoteIOConnection::shutdown(bool wait)
{
Connection::shutdown(wait);
/*if(!wait)
{
Connection::shutdown(wait);
return;
}
qDebug() << id() << " shutdown requested - waiting until we've received all data TODO";
*/
}
void RemoteIOConnection::setup()
{
if(m_fts->type() == FileTransferSession::RECEIVING)
{
qDebug() << "RemoteIOConnection in RX mode";
return;
}
qDebug() << "RemoteIOConnection in TX mode, fid:" << m_fts->fid();
QString url("/tmp/test.mp3");
qDebug() << "TODO map fid to file://, hardcoded for now";
qDebug() << "Opening for transmission:" << url;
m_readdev = QSharedPointer<QFile>(new QFile(url));
m_readdev->open(QIODevice::ReadOnly);
if(!m_readdev->isOpen())
{
qDebug() << "WARNING file is not readable: " << url;
shutdown();
}
// send chunks within our event loop, since we're not in our own thread
sendSome();
}
void RemoteIOConnection::handleMsg(QByteArray msg)
{
Q_ASSERT(m_fts->type() == FileTransferSession::RECEIVING);
m_fts->iodevice()->addData(msg);
if(msg.length()==0) qDebug() << "Got 0len msg. end?";
}
Connection * RemoteIOConnection::clone()
{
Q_ASSERT(false); return 0;
};
void RemoteIOConnection::sendSome()
{
Q_ASSERT(m_fts->type() == FileTransferSession::SENDING);
if(m_readdev->atEnd())
{
qDebug() << "Sent all. DONE";
shutdown(true);
return;
}
QByteArray ba = m_readdev->read(4096);
//qDebug() << "Sending " << ba.length() << " bytes of audiofile";
sendMsg(ba);
QTimer::singleShot(0, this, SLOT(sendSome()));
}

View File

@@ -1,38 +0,0 @@
#ifndef REMOTEIOCONNECTION_H
#define REMOTEIOCONNECTION_H
#include <QIODevice>
#include <QMutex>
#include <QWaitCondition>
#include <QDebug>
#include <QSharedPointer>
#include "controlconnection.h"
#include "filetransfersession.h"
class RemoteIOConnection : public Connection
{
Q_OBJECT
public:
RemoteIOConnection(Servent * s, FileTransferSession * fts);
~RemoteIOConnection();
QString id() const;
void shutdown(bool wait = false);
void setup();
void handleMsg(QByteArray msg);
Connection * clone();
signals:
private slots:
void sendSome();
private:
FileTransferSession * m_fts;
QSharedPointer<QIODevice> m_readdev;
};
#endif // REMOTEIOCONNECTION_H

View File

@@ -1,101 +0,0 @@
#include "remoteiodevice.h"
RemoteIODevice::RemoteIODevice(RemoteIOConnection * c)
: m_eof(false), m_totalAdded(0), m_rioconn(c)
{
qDebug() << "CTOR RemoteIODevice";
}
RemoteIODevice::~RemoteIODevice()
{
qDebug() << "DTOR RemoteIODevice";
m_rioconn->shutdown();
}
void RemoteIODevice::close()
{
qDebug() << "RemoteIODevice::close";
QIODevice::close();
deleteLater();
}
bool RemoteIODevice::open ( OpenMode mode )
{
return QIODevice::open(mode & QIODevice::ReadOnly);
}
qint64 RemoteIODevice::bytesAvailable () const
{
return m_buffer.length();
}
bool RemoteIODevice::isSequential () const
{
return true;
};
bool RemoteIODevice::atEnd() const
{
return m_eof && m_buffer.length() == 0;
};
void RemoteIODevice::addData(QByteArray msg)
{
m_mut_recv.lock();
if(msg.length()==0)
{
m_eof=true;
//qDebug() << "addData finished, entire file received. EOF.";
m_mut_recv.unlock();
m_wait.wakeAll();
return;
}
else
{
m_buffer.append(msg);
m_totalAdded += msg.length();
//qDebug() << "RemoteIODevice has seen in total: " << m_totalAdded ;
m_mut_recv.unlock();
m_wait.wakeAll();
emit readyRead();
return;
}
}
qint64 RemoteIODevice::writeData ( const char * data, qint64 maxSize )
{
Q_ASSERT(false);
return 0;
}
qint64 RemoteIODevice::readData ( char * data, qint64 maxSize )
{
//qDebug() << "RemIO::readData, bytes in buffer: " << m_buffer.length();
m_mut_recv.lock();
if(m_eof && m_buffer.length() == 0)
{
// eof
qDebug() << "readData called when EOF";
m_mut_recv.unlock();
return 0;
}
if(!m_buffer.length())// return 0;
{
//qDebug() << "WARNING readData when buffer is empty";
m_mut_recv.unlock();
return 0;
}
int len;
if(maxSize>=m_buffer.length()) // whole buffer
{
len = m_buffer.length();
memcpy(data, m_buffer.constData(), len);
m_buffer.clear();
} else { // partial
len = maxSize;
memcpy(data, m_buffer.constData(), len);
m_buffer.remove(0,len);
}
m_mut_recv.unlock();
return len;
}

View File

@@ -1,43 +0,0 @@
#ifndef REMOTEIODEVICE_H
#define REMOTEIODEVICE_H
#include <QIODevice>
#include <QMutex>
#include <QWaitCondition>
#include <QDebug>
#include <QBuffer>
#include "remoteioconnection.h"
class RemoteIOConnection;
class RemoteIODevice : public QIODevice
{
Q_OBJECT
public:
RemoteIODevice(RemoteIOConnection * c);
~RemoteIODevice();
virtual void close();
virtual bool open ( OpenMode mode );
qint64 bytesAvailable () const;
virtual bool isSequential () const;
virtual bool atEnd() const;
public slots:
void addData(QByteArray msg);
protected:
virtual qint64 writeData ( const char * data, qint64 maxSize );
virtual qint64 readData ( char * data, qint64 maxSize );
private:
QByteArray m_buffer;
QMutex m_mut_wait, m_mut_recv;
QWaitCondition m_wait;
bool m_eof;
int m_totalAdded;
RemoteIOConnection * m_rioconn;
};
#endif // REMOTEIODEVICE_H

View File

@@ -5,6 +5,7 @@ SET( QT_USE_QTSQL TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_PHONON TRUE )
SET( QT_USE_QTUITOOLS TRUE )
include( ${QT_USE_FILE} )
@@ -17,11 +18,12 @@ set( libSources
sourcelist.cpp
pipeline.cpp
aclsystem.cpp
artist.cpp
album.cpp
collection.cpp
playlist.cpp
pluginapi.cpp
resolver.cpp
query.cpp
result.cpp
source.cpp
@@ -40,6 +42,7 @@ set( libSources
database/databasecommand.cpp
database/databasecommandloggable.cpp
database/databasecommand_resolve.cpp
database/databasecommand_allartists.cpp
database/databasecommand_allalbums.cpp
database/databasecommand_alltracks.cpp
database/databasecommand_addfiles.cpp
@@ -71,12 +74,20 @@ set( libSources
database/databasecommand_clientauthvalid.cpp
database/database.cpp
playlist/collectionmodel.cpp
infosystem/infosystemcache.cpp
infosystem/infosystem.cpp
infosystem/infoplugins/echonestplugin.cpp
infosystem/infoplugins/lastfmplugin.cpp
infosystem/infoplugins/musixmatchplugin.cpp
playlist/treemodel.cpp
playlist/treeproxymodel.cpp
playlist/treeheader.cpp
playlist/treeitemdelegate.cpp
playlist/collectionproxymodel.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
playlist/playlistmanager.cpp
playlist/plitem.cpp
playlist/playlistmodel.cpp
playlist/playlistproxymodel.cpp
playlist/playlistview.cpp
@@ -84,18 +95,21 @@ set( libSources
playlist/queueproxymodel.cpp
playlist/queueview.cpp
playlist/trackmodel.cpp
playlist/trackmodelitem.cpp
playlist/trackproxymodel.cpp
playlist/trackview.cpp
playlist/trackheader.cpp
playlist/treemodelitem.cpp
playlist/albumitem.cpp
playlist/albummodel.cpp
playlist/albumproxymodel.cpp
playlist/albumitemdelegate.cpp
playlist/albumview.cpp
playlist/artistview.cpp
playlist/topbar/topbar.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
@@ -121,7 +135,7 @@ set( libSources
network/bufferiodevice.cpp
network/msgprocessor.cpp
network/filetransferconnection.cpp
network/streamconnection.cpp
network/dbsyncconnection.cpp
network/remotecollection.cpp
network/portfwdthread.cpp
@@ -144,8 +158,10 @@ set( libSources
widgets/overlaywidget.cpp
widgets/infowidgets/sourceinfowidget.cpp
qtsingleapp/qtlocalpeer.cpp
qtsingleapp/qtsingleapplication.cpp
kdsingleapplicationguard/kdsingleapplicationguard.cpp
kdsingleapplicationguard/kdsharedmemorylocker.cpp
kdsingleapplicationguard/kdtoolsglobal.cpp
kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
)
set( libHeaders
@@ -154,8 +170,8 @@ set( libHeaders
pipeline.h
functimeout.h
aclsystem.h
collection.h
pluginapi.h
query.h
resolver.h
result.h
@@ -179,6 +195,7 @@ set( libHeaders
database/databasecommand.h
database/databasecommandloggable.h
database/databasecommand_resolve.h
database/databasecommand_allartists.h
database/databasecommand_allalbums.h
database/databasecommand_alltracks.h
database/databasecommand_addfiles.h
@@ -209,22 +226,30 @@ set( libHeaders
database/databasecommand_addclientauth.h
database/databasecommand_clientauthvalid.h
infosystem/infosystem.h
infosystem/infosystemcache.h
infosystem/infoplugins/echonestplugin.h
infosystem/infoplugins/lastfmplugin.h
infosystem/infoplugins/musixmatchplugin.h
network/bufferiodevice.h
network/msgprocessor.h
network/remotecollection.h
network/filetransferconnection.h
network/streamconnection.h
network/dbsyncconnection.h
network/servent.h
network/connection.h
network/controlconnection.h
network/portfwdthread.h
playlist/collectionmodel.h
playlist/treemodel.h
playlist/treeproxymodel.h
playlist/treeheader.h
playlist/treeitemdelegate.h
playlist/collectionproxymodel.h
playlist/collectionflatmodel.h
playlist/collectionview.h
playlist/playlistmanager.h
playlist/plitem.h
playlist/playlistmodel.h
playlist/playlistproxymodel.h
playlist/playlistview.h
@@ -232,18 +257,21 @@ set( libHeaders
playlist/queueproxymodel.h
playlist/queueview.h
playlist/trackmodel.h
playlist/trackmodelitem.h
playlist/trackproxymodel.h
playlist/trackview.h
playlist/trackheader.h
playlist/treemodelitem.h
playlist/albumitem.h
playlist/albummodel.h
playlist/albumproxymodel.h
playlist/albumitemdelegate.h
playlist/albumview.h
playlist/artistview.h
playlist/topbar/topbar.h
playlist/topbar/clearbutton.h
playlist/topbar/searchlineedit.h
playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
@@ -283,12 +311,14 @@ set( libHeaders
widgets/overlaywidget.h
widgets/infowidgets/sourceinfowidget.h
qtsingleapp/qtlocalpeer.h
qtsingleapp/qtsingleapplication.h
kdsingleapplicationguard/kdsingleapplicationguard.h
kdsingleapplicationguard/kdsharedmemorylocker.h
kdsingleapplicationguard/kdtoolsglobal.h
kdsingleapplicationguard/kdlockedsharedmemorypointer.h
)
set( libHeaders_NoMOC
playlist/dynamic/GeneratorInterface.h
set( libHeaders_NoMOC
playlist/dynamic/GeneratorInterface.h
)
set( libUI ${libUI}
widgets/newplaylistwidget.ui
@@ -299,14 +329,16 @@ set( libUI ${libUI}
)
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.. ..
${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDE_DIR}
${QJSON_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}
${LIBECHONEST_INCLUDE_DIR}/..
${CLUCENE_INCLUDE_DIR}
${CLUCENE_LIBRARY_DIR}
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
../../include
../network
playlist
${THIRDPARTY_DIR}/libportfwd/include
@@ -315,6 +347,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
${THIRDPARTY_DIR}/jdns/jdns
${THIRDPARTY_DIR}/jdns/jdnsshared
${THIRDPARTY_DIR}/qtweetlib/qtweetlib/src
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
)
@@ -322,6 +355,7 @@ IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
# Thirdparty
${QJSON_LDFLAGS}
# System
"iphlpapi.a"
"ws2_32.dll"
@@ -340,6 +374,7 @@ IF( APPLE )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
# Thirdparty
${QJSON_LIBRARIES}
# System
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
@@ -350,9 +385,14 @@ IF( UNIX AND NOT APPLE )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
# Thirdparty
${QJSON_LDFLAGS}
)
ENDIF( UNIX AND NOT APPLE )
IF(LIBLASTFM_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
ENDIF(LIBLASTFM_FOUND)
qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} )
@@ -370,12 +410,12 @@ target_link_libraries( tomahawklib
# External deps
${TAGLIB_LIBRARIES}
${QJSON_LIBRARIES}
${CLUCENE_LIBRARIES}
${LIBECHONEST_LIBRARY}
${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${LINK_LIBRARIES}
)
install( TARGETS tomahawklib DESTINATION lib )
INSTALL( TARGETS tomahawklib DESTINATION lib${LIB_SUFFIX} )

View File

@@ -0,0 +1,150 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aclsystem.h"
#include <QtDebug>
#include <QMutexLocker>
#include <QVariant>
#include <tomahawksettings.h>
ACLSystem* ACLSystem::s_instance = 0;
ACLSystem*
ACLSystem::instance()
{
if( !s_instance )
new ACLSystem();
return s_instance;
}
ACLSystem::ACLSystem( QObject* parent )
: QObject( parent ),
m_saveTimer( this )
{
s_instance = this;
//qRegisterMetaType< QHash< QString, QHash< QString, ACL > > >("ACLSystem::ACLCacheHash");
QStringList savedEntries = TomahawkSettings::instance()->aclEntries();
if( !savedEntries.empty() && savedEntries.size() % 3 == 0 )
{
int index = 0;
while( index < savedEntries.length() )
{
if( !m_cache.contains( savedEntries.at( index ) ) )
m_cache[savedEntries.at( index ) ] = QHash< QString, ACL >();
m_cache[savedEntries.at( index )][savedEntries.at( index + 1 )] = (ACL)(savedEntries.at( index + 2 ).toInt() );
index += 3;
}
}
m_saveTimer.setSingleShot( false );
m_saveTimer.setInterval( 60000 );
connect( &m_saveTimer, SIGNAL( timeout() ), this, SLOT( saveTimerFired() ) );
m_saveTimer.start();
}
ACLSystem::~ACLSystem()
{
m_saveTimer.stop();
saveTimerFired();
}
ACLSystem::ACL
ACLSystem::isAuthorizedUser( const QString& dbid )
{
qDebug() << Q_FUNC_INFO;
QMutexLocker locker( &m_cacheMutex );
qDebug() << "Current cache keys = " << m_cache.keys();
qDebug() << "Looking up dbid";
if( !m_cache.contains( dbid ) )
return ACLSystem::NotFound;
else
{
QHash< QString, ACL > peerHash = m_cache[dbid];
if( peerHash.contains( "global" ) )
return peerHash["global"];
return ACLSystem::NotFound;
}
}
void
ACLSystem::authorizeUser( const QString& dbid, ACLSystem::ACL globalType )
{
qDebug() << Q_FUNC_INFO;
if( globalType == ACLSystem::NotFound )
return;
QMutexLocker locker( &m_cacheMutex );
QHash< QString, ACL > peerHash;
if( m_cache.contains( dbid ) )
peerHash = m_cache[dbid];
peerHash["global"] = globalType;
m_cache[dbid] = peerHash;
}
ACLSystem::ACL
ACLSystem::isAuthorizedPath( const QString& dbid, const QString& path )
{
QMutexLocker locker( &m_cacheMutex );
if( !m_cache.contains( dbid ) )
return ACLSystem::NotFound;
QHash< QString, ACL > peerHash = m_cache[dbid];
if( !peerHash.contains( path ) )
{
if( peerHash.contains( "global" ) )
return peerHash["global"];
else
return ACLSystem::Deny;
}
return peerHash[path];
}
void
ACLSystem::authorizePath( const QString& dbid, const QString& path, ACLSystem::ACL type )
{
TomahawkSettings *s = TomahawkSettings::instance();
if( !s->scannerPaths().contains( path ) )
{
qDebug() << "path selected is not in our scanner path!";
return;
}
QMutexLocker locker( &m_cacheMutex );
QHash< QString, ACLSystem::ACL > peerHash;
if ( m_cache.contains( dbid ) )
peerHash = m_cache[dbid];
peerHash[path] = type;
m_cache[dbid] = peerHash;
}
void
ACLSystem::saveTimerFired()
{
QStringList saveCache;
foreach( QString dbid, m_cache.keys() )
{
foreach( QString path, m_cache[dbid].keys() )
saveCache << dbid << path << QString::number( (int)(m_cache[dbid][path]) );
}
TomahawkSettings::instance()->setAclEntries( saveCache );
}

View File

@@ -0,0 +1,64 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOMAHAWK_ACLSYSTEM_H
#define TOMAHAWK_ACLSYSTEM_H
#include <QObject>
#include <QString>
#include <QHash>
#include <QTimer>
#include <QMutex>
#include "dllmacro.h"
class DLLEXPORT ACLSystem : public QObject
{
Q_OBJECT
public:
static ACLSystem* instance();
enum ACL {
Allow = 0,
Deny = 1,
NotFound = 2
};
ACLSystem( QObject *parent = 0 );
~ACLSystem();
ACL isAuthorizedUser( const QString &dbid );
void authorizeUser( const QString &dbid, ACL globalType );
ACL isAuthorizedPath( const QString &dbid, const QString &path );
void authorizePath( const QString &dbid, const QString &path, ACL type );
private slots:
void saveTimerFired();
private:
QHash< QString, QHash< QString, ACL > > m_cache;
QTimer m_saveTimer;
QMutex m_cacheMutex;
static ACLSystem* s_instance;
};
#endif // TOMAHAWK_ACLSYSTEM_H

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "album.h"
#include <QDebug>
@@ -75,7 +93,7 @@ Album::tracks()
cmd->setAlbum( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOMAHAWKALBUM_H
#define TOMAHAWKALBUM_H
@@ -40,7 +58,7 @@ public:
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& pattern ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "artist.h"
#include <QDebug>
@@ -77,7 +95,7 @@ Artist::tracks()
cmd->setArtist( this );
cmd->setSortOrder( DatabaseCommand_AllTracks::Album );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOMAHAWKARTIST_H
#define TOMAHAWKARTIST_H
@@ -40,7 +58,7 @@ public:
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
virtual void setShuffled( bool ) {}
virtual void setFilter( const QString& pattern ) {}
virtual void setFilter( const QString& /*pattern*/ ) {}
signals:
void repeatModeChanged( PlaylistInterface::RepeatMode mode );

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "audioengine.h"
#include <QUrl>
@@ -162,6 +180,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
{
setCurrentTrack( result );
io = Servent::instance()->getIODeviceForUrl( m_currentTrack );
if ( m_currentTrack->url().startsWith( "http://" ) )
{
m_readReady = false;
connect( io.data(), SIGNAL( downloadProgress( qint64, qint64 ) ), SLOT( onDownloadProgress( qint64, qint64 ) ) );
}
else
m_readReady = true;
if ( !io || io.isNull() )
{

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AUDIOENGINE_H
#define AUDIOENGINE_H
@@ -98,6 +116,7 @@ private:
Phonon::MediaObject* m_mediaObject;
Phonon::AudioOutput* m_audioOutput;
bool m_readReady;
unsigned int m_timeElapsed;
bool m_expectStop;

View File

@@ -0,0 +1,64 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dummytranscode.h"
#include <QDebug>
DummyTranscode::DummyTranscode()
: m_init( false )
{
qDebug() << Q_FUNC_INFO;
}
DummyTranscode::~DummyTranscode()
{
qDebug() << Q_FUNC_INFO;
}
void
DummyTranscode::processData( const QByteArray &buffer, bool finish )
{
Q_UNUSED( finish );
m_buffer.append( buffer );
// qDebug() << "DUMMYTRANSCODING:" << buffer.size();
if( !m_init && m_buffer.size() >= 16364 ) {
m_init = true;
emit streamInitialized( 44100, 2 );
}
}
void
DummyTranscode::onSeek( int seconds )
{
Q_UNUSED( seconds );
m_buffer.clear();
}
void
DummyTranscode::clearBuffers()
{
m_buffer.clear();
m_init = false;
}

View File

@@ -0,0 +1,63 @@
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2011 Leo Franchi <leo@kdab.com>
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
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DUMMYTRANSCODE_H
#define DUMMYTRANSCODE_H
#include "audio/transcodeinterface.h"
#include "dllmacro.h"
#define _BUFFER_PREFERRED 32768
class DLLEXPORT DummyTranscode : public TranscodeInterface
{
Q_OBJECT
public:
DummyTranscode();
virtual ~DummyTranscode();
const QStringList supportedTypes() const { QStringList l; l << "audio/basic"; return l; }
int needData() { return true; } // always eats data
bool haveData() { return !m_buffer.isEmpty(); }
unsigned int preferredDataSize() { return _BUFFER_PREFERRED; }
QByteArray data() { QByteArray b = m_buffer; m_buffer.clear(); return b; }
virtual void setBufferCapacity( int bytes ) { m_bufferCapacity = bytes; }
int bufferSize() { return m_buffer.size(); }
public slots:
virtual void clearBuffers();
virtual void onSeek( int seconds );
virtual void processData( const QByteArray& data, bool finish );
signals:
void streamInitialized( long sampleRate, int channels );
void timeChanged( int seconds );
private:
QByteArray m_buffer;
int m_bufferCapacity;
bool m_init;
};
#endif // DUMMYTRANSCODE_H

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "collection.h"
#include <QMetaObject>
@@ -92,10 +110,10 @@ Collection::deleteDynamicPlaylist( const Tomahawk::dynplaylist_ptr& p )
QList<dynplaylist_ptr> todelete;
todelete << p;
m_dynplaylists.removeAll( p );
qDebug() << Q_FUNC_INFO << "Collection name" << name()
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.length();
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.length();
emit dynamicPlaylistsDeleted( todelete );
}
@@ -158,7 +176,6 @@ Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
{
qDebug() << Q_FUNC_INFO << tracks.count() << name();
m_isLoaded = true;
m_tracks << tracks;
emit tracksAdded( tracks );
}

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
/*
The collection - acts as container for someones music library
load() -> async populate by calling addArtists etc,
@@ -33,6 +51,7 @@ public:
Collection( const source_ptr& source, const QString& name, QObject* parent = 0 );
virtual ~Collection();
virtual void setLoaded() { m_isLoaded = true; }
virtual bool isLoaded() const { return m_isLoaded; }
virtual QString name() const;
@@ -72,9 +91,10 @@ public slots:
void setPlaylists( const QList<Tomahawk::playlist_ptr>& plists );
void setDynamicPlaylists( const QList< Tomahawk::dynplaylist_ptr >& dynplists );
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
void setTracks( const QList<Tomahawk::query_ptr>& tracks );
void delTracks( const QStringList& files );
void resetTrackCache() { m_tracks.clear(); m_isLoaded = false; }
protected:
QString m_name;

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "database.h"
#define WORKER_THREADS 5
@@ -14,11 +32,16 @@ Database::instance()
Database::Database( const QString& dbname, QObject* parent )
: QObject( parent )
, m_ready( false )
, m_impl( new DatabaseImpl( dbname, this ) )
, m_workerRW( new DatabaseWorker( m_impl, this, true ) )
{
s_instance = this;
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( indexReady() ) );
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( ready() ) );
connect( m_impl, SIGNAL( indexReady() ), SLOT( setIsReadyTrue() ) );
m_workerRW->start();
}

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_H
#define DATABASE_H
@@ -23,6 +41,7 @@
class DLLEXPORT Database : public QObject
{
Q_OBJECT
public:
static Database* instance();
@@ -30,19 +49,27 @@ public:
~Database();
QString dbid() const;
const bool indexReady() const { return m_indexReady; }
bool indexReady() const { return m_indexReady; }
void loadIndex();
bool isReady() const { return m_ready; }
signals:
void indexReady(); // search index
void ready();
void newJobRO( QSharedPointer<DatabaseCommand> );
void newJobRW( QSharedPointer<DatabaseCommand> );
public slots:
void enqueue( QSharedPointer<DatabaseCommand> lc );
private slots:
void setIsReadyTrue() { m_ready = true; }
private:
bool m_ready;
DatabaseImpl* m_impl;
DatabaseWorker* m_workerRW;
QHash< QString, DatabaseWorker* > m_workers;

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "databasecollection.h"
#include "database/database.h"
@@ -12,7 +30,6 @@ using namespace Tomahawk;
DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent )
: Collection( src, QString( "dbcollection:%1" ).arg( src->userName() ), parent )
, m_loadedTracks( false )
{
}
@@ -35,10 +52,10 @@ DatabaseCollection::loadDynamicPlaylists()
{
qDebug() << Q_FUNC_INFO;
DatabaseCommand_LoadAllDynamicPlaylists* cmd = new DatabaseCommand_LoadAllDynamicPlaylists( source() );
connect( cmd, SIGNAL( playlistLoaded( Tomahawk::source_ptr, QVariantList ) ),
SLOT( dynamicPlaylistCreated( const Tomahawk::source_ptr&, const QVariantList& ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
}
@@ -48,10 +65,10 @@ DatabaseCollection::loadTracks()
{
qDebug() << Q_FUNC_INFO << source()->userName();
m_loadedTracks = true;
setLoaded();
DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( source()->collection() );
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ),
connect( cmd, SIGNAL( tracks( QList<Tomahawk::query_ptr>, QVariant ) ),
SLOT( setTracks( QList<Tomahawk::query_ptr> ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
@@ -95,12 +112,12 @@ DatabaseCollection::playlists()
QList< dynplaylist_ptr > DatabaseCollection::dynamicPlaylists()
{
qDebug() << Q_FUNC_INFO;
if ( Collection::dynamicPlaylists().isEmpty() )
{
loadDynamicPlaylists();
}
return Collection::dynamicPlaylists();
}
@@ -110,7 +127,7 @@ DatabaseCollection::tracks()
{
qDebug() << Q_FUNC_INFO;
if ( !m_loadedTracks )
if ( !isLoaded() )
{
loadTracks();
}

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASECOLLECTION_H
#define DATABASECOLLECTION_H
@@ -34,9 +52,6 @@ public slots:
private slots:
void dynamicPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
private:
bool m_loadedTracks;
};
#endif // DATABASECOLLECTION_H

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "databasecommand.h"
#include <QDebug>

View File

@@ -1,3 +1,21 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk 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
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASECOMMAND_H
#define DATABASECOMMAND_H
@@ -30,6 +48,7 @@ public:
explicit DatabaseCommand( const Tomahawk::source_ptr& src, QObject* parent = 0 );
DatabaseCommand( const DatabaseCommand &other )
: QObject( other.parent() )
{
}
@@ -41,7 +60,7 @@ public:
// if i make this pure virtual, i get compile errors in qmetatype.h.
// we need Q_DECLARE_METATYPE to use in queued sig/slot connections.
virtual void exec( DatabaseImpl* lib ) { Q_ASSERT( false ); }
virtual void exec( DatabaseImpl* /*lib*/ ) { Q_ASSERT( false ); }
void _exec( DatabaseImpl* lib );
@@ -57,6 +76,9 @@ public:
virtual bool singletonCmd() const { return false; }
virtual bool localOnly() const { return false; }
virtual QVariant data() const { return m_data; }
virtual void setData( const QVariant& data ) { m_data = data; }
QString guid() const
{
if( m_guid.isEmpty() )
@@ -79,6 +101,8 @@ private:
State m_state;
Tomahawk::source_ptr m_source;
mutable QString m_guid;
QVariant m_data;
};
Q_DECLARE_METATYPE( DatabaseCommand )

Some files were not shown because too many files have changed in this diff Show More