Skip to content
Browse files

Generate pro files from pro.in files so QtCreator works better

  • Loading branch information...
1 parent 40f8820 commit d53245124cb60bbbc0dd791f8a4f6599774c1d10 @mxcl mxcl committed May 14, 2009
View
6 .gitignore
@@ -12,3 +12,9 @@ Makefile*
*.sln
*.suo
.DS_Store
+/app/audioscrobbler/audioscrobbler.pro
+/app/boffin/boffin.pro
+/app/radio/radio.pro
+/lib/listener/listener.pro
+/lib/unicorn/unicorn.pro
+
View
4 Last.fm.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS = lib/unicorn/libunicorn.pro \
- lib/listener/liblistener.pro \
+SUBDIRS = lib/unicorn \
+ lib/listener \
app/audioscrobbler \
app/radio \
app/twiddly \
View
91 admin/qpp
@@ -8,39 +8,8 @@ require 'find'
require 'ftools'
require "#{cwd}/platform.rb"
-
-if ARGV[0] && File.file?( ARGV[0] )
- File.open( ARGV[0] ).each_line do |line|
- line.chomp!
-
- matches = /^\s*TEMPLATE += (.*)$/.match( line )
- if !matches.nil?
- exit if matches[1].downcase == 'subdirs'
- end
-
- matches = /^\s*VERSION += +((\d\.){0,2}\d)/.match( line )
- if !matches.nil? && !File.file?( "_version.h" )
- File.open( "_version.h", 'w' ) { |f| f.write( "#define VERSION \"#{matches[1]}\"\n" ) }
- end
- end
-end
-
-
-sources = Array.new
-headers = Array.new
-forms = Array.new
-resources = Array.new
-
-dir = ARGV[0]
-if dir.nil?
- dir = '.'
-elsif !File.directory?( dir )
- dir = File.dirname( dir )
-end
-
-
-def find_sources( dir )
- Find.find( dir ) do |path|
+def find_sources()
+ Find.find( '.' ) do |path|
if File.directory?( path )
excludes = ['.svn', 'tests', '_build']
case Platform::IMPL
@@ -59,30 +28,48 @@ def find_sources( dir )
end
end
+########################################################################### impl
+sources = Array.new
+headers = Array.new
+forms = Array.new
+resources = Array.new
+
+abort "usage: qpp file.pro.in" unless File.file? ARGV[0]
-find_sources( dir ) do |path, ext|
- path.sub!( /^.\//, '' )
- case ext
- when ".h" then headers << path
- when ".ui" then forms << path
- when ".qrc" then resources << path
- when ".cpp" then sources << path
+File.open( ARGV[0] ).each_line do |line|
+ line.chomp!
+
+ matches = /^\s*TEMPLATE += (.*)$/.match( line )
+ if !matches.nil?
+ exit if matches[1].downcase == 'subdirs'
+ end
+
+ matches = /^\s*VERSION += +((\d\.){0,2}\d)/.match( line )
+ if !matches.nil? && !File.file?( "_version.h" )
+ File.open( "_version.h", 'w' ) { |f| f.write( "#define VERSION \"#{matches[1]}\"\n" ) }
end
end
+Dir.chdir File.dirname(ARGV[0]) do
+ find_sources do |path, ext|
+ path.sub!( /^.\//, '' )
+ case ext
+ when ".h" then headers << path
+ when ".ui" then forms << path
+ when ".qrc" then resources << path
+ when ".cpp" then sources << path
+ end
+ end
+end
-def write_section( section, array, f )
+def write_section( section, array )
return if array.empty?
- f.write( section + " +=" )
- array.each do |path|
- f.write( " \\\n\t" )
- f.write( path )
- end
- f.write( "\n" )
+ print "#{section} +="
+ array.each { |path| print " \\\n\t#{path}" }
+ puts
end
-f = File.open( '_files.qmake', 'w' )
-write_section( "SOURCES", sources, f )
-write_section( "HEADERS", headers, f )
-write_section( "FORMS", forms, f )
-write_section( "RESOURCES", resources, f )
+write_section( "SOURCES", sources )
+write_section( "HEADERS", headers )
+write_section( "FORMS", forms )
+write_section( "RESOURCES", resources )
View
5 app/audioscrobbler/audioscrobbler.pro → app/audioscrobbler/audioscrobbler.pro.in
@@ -3,8 +3,5 @@ TARGET = audioscrobbler
VERSION = 2.0.0
QT = core gui xml network
LIBS += -llastfm -lunicorn -llistener
-
-include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
-
DEFINES += LASTFM_COLLAPSE_NAMESPACE
+include( $$ROOT_DIR/admin/include.qmake )
View
1 app/boffin/boffin.pro → app/boffin/boffin.pro.in
@@ -3,7 +3,6 @@ QT += opengl sql phonon
VERSION = 1.0.0
include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
DEFINES += LASTFM_COLLAPSE_NAMESPACE
macx-g++{
View
13 app/radio/LegacyTuner.cpp
@@ -18,9 +18,7 @@
***************************************************************************/
#include "LegacyTuner.h"
-#include <lastfm/WsDomElement>
-#include <lastfm/CoreSettings>
-#include <lastfm/WsAccessManager>
+#include <lastfm/XmlQuery>
#include <lastfm/Xspf>
#include <QCoreApplication>
#include <QtNetwork>
@@ -33,8 +31,7 @@ static inline QByteArray iso3166() { return QLocale().name().right( 2 ).toAscii(
LegacyTuner::LegacyTuner( const RadioStation& station, const QString& password_md5 )
- : m_nam( new WsAccessManager( this ) ),
- m_retry_counter( 0 ),
+ : m_retry_counter( 0 ),
m_station( station )
{
#ifdef WIN32
@@ -53,12 +50,12 @@ LegacyTuner::LegacyTuner( const RadioStation& station, const QString& password_m
url.setPath( "/radio/handshake.php" );
url.addEncodedQueryItem( "version", QCoreApplication::applicationVersion().toAscii() );
url.addEncodedQueryItem( "platform", PLATFORM );
- url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(Ws::Username) );
+ url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(lastfm::ws::Username) );
url.addEncodedQueryItem( "passwordmd5", password_md5.toAscii() );
url.addEncodedQueryItem( "language", iso3166() );
QNetworkRequest request( url );
- QNetworkReply* reply = m_nam->get( request );
+ QNetworkReply* reply = lastfm::nam()->get( request );
connect( reply, SIGNAL(finished()), SLOT(onHandshakeReturn()) );
}
@@ -196,7 +193,7 @@ LegacyTuner::onGetPlaylistReturn()
{
// an empty playlist is a bug, if there is no content
// NotEnoughContent should have been returned with the WsReply
- emit error( Ws::MalformedResponse );
+ emit error( lastfm::ws::MalformedResponse );
}
}
else {
View
8 app/radio/LegacyTuner.h
@@ -21,12 +21,14 @@
#define LEGACY_TUNER_H
#include <lastfm/Track>
-#include "RadioStation.h"
+#include <lastfm/RadioStation>
+#include <lastfm/ws.h>
+using lastfm::RadioStation;
/** certain stuff can only be played with the legacy tuner */
-class LASTFM_RADIO_DLLEXPORT LegacyTuner
+class LegacyTuner : public QObject
{
Q_OBJECT
@@ -40,7 +42,7 @@ class LASTFM_RADIO_DLLEXPORT LegacyTuner
signals:
void title( const QString& );
void trackAvailable();
- void error( Ws::Error );
+ void error( lastfm::ws::Error );
private slots:
void onHandshakeReturn();
View
1 app/radio/radio.pro → app/radio/radio.pro.in
@@ -6,7 +6,6 @@ CONFIG += lastfm
LIBS += -lunicorn
include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
DEFINES += LASTFM_COLLAPSE_NAMESPACE
View
2 app/twiddly/twiddly.pro
@@ -3,10 +3,8 @@ LIBS += -lunicorn -llastfm
QT = core xml sql
include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
DEFINES += LASTFM_COLLAPSE_NAMESPACE
-LIBS += -L$$DESTDIR
SOURCES = main.cpp PlayCountsDatabase.cpp IPod.cpp $$ROOT_DIR/common/c++/Logger.cpp
macx*:SOURCES += ITunesLibrary_mac.cpp
View
9 configure
@@ -89,12 +89,11 @@ echo 'Using '`which $QMAKE`
header 'Generating Build System'
middle "Running qpp..."
-for x in `admin/findsrc pro lib` `admin/findsrc pro app`
+for x in `admin/findsrc pro.in lib` `admin/findsrc pro.in app`
do
- cwd=`pwd`
- pushd `dirname $x` &> /dev/null
- $cwd/admin/qpp `basename $x` || die "Ruby not installed?"
- popd &> /dev/null
+ pro=`dirname "$x"`/`basename "$x" .in`
+ cp "$x" "$pro"
+ admin/qpp "$x" >> "$pro"
done
View
6 lib/listener/liblistener.pro → lib/listener/listener.pro.in
@@ -1,14 +1,10 @@
TARGET = listener
TEMPLATE = lib
QT = core xml network
-LIBS += -llastfm
+LIBS += -llastfm -lunicorn
include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
DEFINES += _LISTENER_DLLEXPORT LASTFM_COLLAPSE_NAMESPACE
win32:LIBS += Advapi32.lib
-
-SOURCES -= mac/ITunesListener.cpp
-HEADERS -= mac/ITunesListener.h
View
15 lib/listener/mac/ITunesListener.cpp
@@ -19,9 +19,8 @@
#include "ITunesListener.h"
#include "../PlayerConnection.h"
-#include <lastfm/CoreProcess>
-#include <lastfm/AppleScript>
-#include <lastfm/CFStringToQString>
+#include <lastfm/misc.h>
+#include "lib/unicorn/mac/AppleScript.h"
#include <QThread>
@@ -131,7 +130,7 @@ template <> QString
ITunesDictionaryHelper::token<QString>( CFStringRef t )
{
CFStringRef s = token<CFStringRef>( t );
- return CFStringToQString( s );
+ return lastfm::CFStringToQString( s );
}
@@ -155,7 +154,7 @@ ITunesDictionaryHelper::determineTrackInformation()
// Get path decoded - iTunes encodes the file location as URL
CFStringRef location = token<CFStringRef>( CFSTR("Location") );
- QUrl url = QUrl::fromEncoded( CFStringToUtf8( location ) );
+ QUrl url = QUrl::fromEncoded( lastfm::CFStringToUtf8( location ) );
path = url.toString().remove( "file://localhost" );
static AppleScript script( "tell application \"iTunes\" to return persistent ID of current track & player position" );
@@ -231,7 +230,7 @@ bool //static
ITunesListener::isMusic()
{
const char* code = "with timeout of 1 seconds\n"
- "tell application \"iTunes\" to return video kind of current track\n"
+ "tell application \"iTunes\" to if running then return video kind of current track\n"
"end timeout";
static AppleScript script( code ); //compile once
@@ -244,15 +243,15 @@ ITunesListener::isMusic()
bool //static
ITunesListener::iTunesIsPlaying()
{
- const char* code = "tell application \"iTunes\" to return player state is playing";
+ const char* code = "tell application \"iTunes\" to if running then return player state is playing";
return AppleScript( code ).exec() == "true";
}
void
ITunesListener::setupCurrentTrack()
{
- if (!CoreProcess::isRunning( "iTunes" ) || !iTunesIsPlaying() || !isMusic())
+ if (!iTunesIsPlaying() || !isMusic())
return;
#define ENDL " & \"\n\" & "
View
5 lib/unicorn/libunicorn.pro → lib/unicorn/unicorn.pro.in
@@ -3,12 +3,9 @@ TEMPLATE = lib
CONFIG += lastfm
QT = core gui xml network
LIBS += -llastfm
-
include( $$ROOT_DIR/admin/include.qmake )
-include( _files.qmake )
-
SOURCES += $$ROOT_DIR/common/c++/Logger.cpp
DEFINES += _UNICORN_DLLEXPORT LASTFM_COLLAPSE_NAMESPACE
# UniqueApplication
-win32:LIBS += user32.lib shell32.lib
+win32:LIBS += user32.lib shell32.lib

0 comments on commit d532451

Please sign in to comment.
Something went wrong with that request. Please try again.