This commit is contained in:
Mark Furneaux 2014-12-05 22:11:32 -05:00
commit b1add3d73e
353 changed files with 34094 additions and 26233 deletions

View File

@ -18,6 +18,10 @@
* USA
*/
extern "C" {
#include <libavutil/mem.h>
}
#include "utils.h"
#include "fft_lib_avfft.h"

View File

@ -21,9 +21,7 @@
#ifndef CHROMAPRINT_FFT_LIB_AVFFT_H_
#define CHROMAPRINT_FFT_LIB_AVFFT_H_
#include <math.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavcodec/avfft.h>
}
#include "combined_buffer.h"

View File

@ -216,8 +216,7 @@ optional_component(SEAFILE ON "Seafile support"
DEPENDS "Taglib 1.8" "TAGLIB_VERSION VERSION_GREATER 1.7.999"
)
# Note: broken with gstreamer-1.0 - API changes in the audiocdsrc element.
optional_component(AUDIOCD OFF "Devices: Audio CD support"
optional_component(AUDIOCD ON "Devices: Audio CD support"
DEPENDS "libcdio" CDIO_FOUND
)

View File

@ -425,5 +425,6 @@
<file>providers/vk.png</file>
<file>vk/link.png</file>
<file>providers/seafile.png</file>
<file>icons/32x32/internet-services.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

1
debian/control vendored
View File

@ -13,6 +13,7 @@ Build-Depends: debhelper (>= 7),
libboost-serialization1.40-dev |
libboost-serialization1.42-dev |
libboost-serialization-dev,
libcdio-cdda1,
libglew1.5-dev |
libglew-dev,
libqt4-dev,

157
dist/copyright.py vendored Executable file
View File

@ -0,0 +1,157 @@
#!/usr/bin/python
from subprocess import *
from sys import *
from os import rename, remove
from datetime import *
def pretty_years(s):
l = list(s)
l.sort()
start = None
prev = None
r = []
for x in l:
if prev is None:
start = x
prev = x
continue
if x == prev + 1:
prev = x
continue
if prev == start:
r.append("%i" % prev)
else:
r.append("%i-%i" % (start, prev))
start = x
prev = x
if not prev is None:
if prev == start:
r.append("%i" % prev)
else:
r.append("%i-%i" % (start, prev))
return ", ".join(r)
def order_by_year(a, b):
la = list(a[2])
la.sort()
lb = list(b[2])
lb.sort()
if la[0] < lb[0]:
return -1
elif la[0] > lb[0]:
return 1
else:
return 0
def gen_copyrights(f):
commits = []
data = {}
copyrights = []
for ln in Popen(["git", "blame", "--incremental", f], stdout=PIPE).stdout:
if ln.startswith("filename "):
if len(data) > 0:
commits.append(data)
data = {}
elif ln.startswith("author "):
data["author"] = ln[7:].strip()
elif ln.startswith("author-mail <"):
data["author-mail"] = ln[12:].strip()
elif ln.startswith("author-time "):
data["author-time"] = ln[11:].strip()
elif ln.startswith("author-tz "):
data["author-tz"] = ln[9:].strip()
with open(f,'r') as fi:
fil = fi.readlines()
for i in fil:
if -1 < i.find("Original Author"):
da = i.split(" ")
print f
copyrights.append(" Copyright %s, %s %s\n" % (da[3].strip(), da[1], da[2]))
by_author = {}
for c in commits:
try:
n = by_author[c["author"]]
except KeyError:
n = (c["author"], c["author-mail"], set())
by_author[c["author"]] = n
# FIXME: Handle time zones properly
year = datetime.fromtimestamp(int(c["author-time"])).year
n[2].add(year)
for an, a in list(by_author.iteritems()):
for bn, b in list(by_author.iteritems()):
if a is b:
continue
if a[1] == b[1]:
a[2].update(b[2])
if by_author.has_key(an) and by_author.has_key(bn):
del by_author[bn]
copyright = list(by_author.itervalues())
copyright.sort(order_by_year)
for name, mail, years in copyright:
copyrights.append(" Copyright %s, %s %s\n" % (pretty_years(years), name, mail))
return copyrights
def change_file(filename):
content=[]
out=[]
extended=0
ends=0
with open(filename, "r") as fi:
content=fi.readlines()
copyrights=gen_copyrights(filename)
if -1 == content[0].find("/* This file is part of Clementine."):
print("File {} have no Clementine copyright info".format(filename))
return 0
for i in content:
if i.find("*/") != -1:
ends = 1
if i.find("Copyright ") != -1:
if not extended:
out.extend(copyrights)
extended = 1
if not ends:
continue
else:
out.append(i)
with open(filename+'_tmp', "w") as fi:
fi.writelines(out)
rename(filename+'_tmp', filename)
if __name__ == "__main__":
for files in argv[1:]:
change_file(files)

2580
dist/cpplint.py vendored

File diff suppressed because it is too large Load Diff

View File

@ -199,6 +199,7 @@ Section "Delete old files" oldfiles
Delete "$INSTDIR\avcodec-53.dll"
Delete "$INSTDIR\avformat-53.dll"
Delete "$INSTDIR\avutil-51.dll"
Delete "$INSTDIR\libcdio-14.dll"
Delete "$INSTDIR\libgstapp-0.10-0.dll"
Delete "$INSTDIR\libgstaudio-0.10-0.dll"
Delete "$INSTDIR\libgstbase-0.10-0.dll"
@ -231,7 +232,7 @@ Section "Clementine" Clementine
File "clementine-spotifyblob.exe"
File "clementine.ico"
File "glew32.dll"
File "libcdio-14.dll"
File "libcdio-16.dll"
File "libeay32.dll"
File "libfaac.dll"
File "libfaad.dll"
@ -1043,7 +1044,7 @@ Section "Uninstall"
Delete "$INSTDIR\clementine-spotifyblob.exe"
Delete "$INSTDIR\glew32.dll"
Delete "$INSTDIR\intl.dll"
Delete "$INSTDIR\libcdio-14.dll"
Delete "$INSTDIR\libcdio-16.dll"
Delete "$INSTDIR\libeay32.dll"
Delete "$INSTDIR\libexpat-1.dll"
Delete "$INSTDIR\libfaac.dll"

View File

@ -81,9 +81,8 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
// Try to send 5 seconds of audio in advance to initially fill Clementine's
// buffer.
// Commented for now as otherwise the seek will take too long.
//g_object_set(G_OBJECT(tcpsink_), "ts-offset", qint64(-5 * kNsecPerSec),
// nullptr);
g_object_set(G_OBJECT(tcpsink_), "ts-offset", qint64(-5 * kNsecPerSec),
nullptr);
// We know the time of each buffer
g_object_set(G_OBJECT(appsrc_), "format", GST_FORMAT_TIME, nullptr);
@ -107,12 +106,10 @@ bool MediaPipeline::Init(int sample_rate, int channels) {
#endif
// Set caps
GstCaps* caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, format,
"rate", G_TYPE_INT, sample_rate,
"channels", G_TYPE_INT, channels,
"layout", G_TYPE_STRING, "interleaved",
nullptr);
GstCaps* caps = gst_caps_new_simple(
"audio/x-raw", "format", G_TYPE_STRING, format, "rate", G_TYPE_INT,
sample_rate, "channels", G_TYPE_INT, channels, "layout", G_TYPE_STRING,
"interleaved", nullptr);
gst_app_src_set_caps(appsrc_, caps);
gst_caps_unref(caps);

View File

@ -604,7 +604,6 @@ void SpotifyClient::PlaylistStateChangedForGetPlaylists(sp_playlist* pl,
void SpotifyClient::AddTracksToPlaylist(
const pb::spotify::AddTracksToPlaylistRequest& req) {
// Get the playlist we want to update
int playlist_index = req.playlist_index();
sp_playlist* playlist =
@ -615,21 +614,22 @@ void SpotifyClient::AddTracksToPlaylist(
}
// Get the tracks we want to add
std::unique_ptr<sp_track*[]> tracks_array (new sp_track*[req.track_uri_size()]);
std::unique_ptr<sp_track* []> tracks_array(
new sp_track* [req.track_uri_size()]);
for (int i = 0; i < req.track_uri_size(); ++i) {
sp_link* track_link = sp_link_create_from_string(req.track_uri(i).c_str());
sp_track* track = sp_link_as_track(track_link);
sp_track_add_ref(track);
sp_link_release(track_link);
if (!track) {
qLog(Error) << "Track" << QString::fromStdString(req.track_uri(i)) << "not found";
qLog(Error) << "Track" << QString::fromStdString(req.track_uri(i))
<< "not found";
}
tracks_array[i] = track;
}
// Actually add the tracks to the playlist
if (sp_playlist_add_tracks(playlist, tracks_array.get(),
req.track_uri_size(),
if (sp_playlist_add_tracks(playlist, tracks_array.get(), req.track_uri_size(),
0 /* TODO: don't insert at a hardcoded position */,
session_) != SP_ERROR_OK) {
qLog(Error) << "Error when adding tracks!";
@ -643,7 +643,6 @@ void SpotifyClient::AddTracksToPlaylist(
void SpotifyClient::RemoveTracksFromPlaylist(
const pb::spotify::RemoveTracksFromPlaylistRequest& req) {
// Get the playlist we want to update
int playlist_index = req.playlist_index();
sp_playlist* playlist =
@ -665,7 +664,6 @@ void SpotifyClient::RemoveTracksFromPlaylist(
}
}
void SpotifyClient::ConvertTrack(sp_track* track, pb::spotify::Track* pb) {
sp_album* album = sp_track_album(track);
@ -758,9 +756,6 @@ int SpotifyClient::MusicDeliveryCallback(sp_session* session,
}
if (num_frames == 0) {
// According to libspotify documentation, this occurs when a discontinuity
// has occurred (such as after a seek). Maybe should clear buffers here as
// well? (in addition of clearing buffers in gstenginepipeline.cpp)
return 0;
}
@ -919,17 +914,8 @@ void SpotifyClient::StartPlayback(const pb::spotify::PlaybackRequest& req) {
}
void SpotifyClient::Seek(qint64 offset_nsec) {
if (sp_session_player_seek(session_, offset_nsec / kNsecPerMsec)
!= SP_ERROR_OK) {
qLog(Error) << "Seek error";
return;
}
pb::spotify::Message message;
pb::spotify::SeekCompleted* response = message.mutable_seek_completed();
Q_UNUSED(response);
SendMessage(message);
// TODO
qLog(Error) << "TODO seeking";
}
void SpotifyClient::TryPlaybackAgain(const PendingPlaybackRequest& req) {

View File

@ -59,7 +59,6 @@ class SpotifyClient : public AbstractMessageHandler<pb::spotify::Message> {
pb::spotify::LoginResponse_Error error_code);
void SendPlaybackError(const QString& error);
void SendSearchResponse(sp_search* result);
void SendSeekCompleted();
// Spotify session callbacks.
static void SP_CALLCONV LoggedInCallback(sp_session* session, sp_error error);
@ -124,7 +123,8 @@ class SpotifyClient : public AbstractMessageHandler<pb::spotify::Message> {
void LoadPlaylist(const pb::spotify::LoadPlaylistRequest& req);
void SyncPlaylist(const pb::spotify::SyncPlaylistRequest& req);
void AddTracksToPlaylist(const pb::spotify::AddTracksToPlaylistRequest& req);
void RemoveTracksFromPlaylist(const pb::spotify::RemoveTracksFromPlaylistRequest& req);
void RemoveTracksFromPlaylist(
const pb::spotify::RemoveTracksFromPlaylistRequest& req);
void StartPlayback(const pb::spotify::PlaybackRequest& req);
void Seek(qint64 offset_nsec);
void LoadImage(const QString& id_b64);

View File

@ -23,6 +23,7 @@ enum MsgType {
STOP_AFTER = 17;
GET_LIBRARY = 18;
RATE_SONG = 19;
GLOBAL_SEARCH = 100;
// Messages send by both
DISCONNECT = 2;
@ -53,6 +54,8 @@ enum MsgType {
DOWNLOAD_QUEUE_EMPTY = 51;
LIBRARY_CHUNK = 52;
DOWNLOAD_TOTAL_SIZE = 53;
GLOBAL_SEARCH_RESULT = 54;
TRANSCODING_FILES = 55;
}
// Valid Engine states
@ -284,9 +287,25 @@ message ResponseDownloadTotalSize {
optional int32 file_count = 2;
}
message RequestGlobalSearch {
optional string query = 1;
}
message ResponseGlobalSearch {
optional int32 id = 1;
optional string query = 2;
optional string search_provider = 3;
repeated SongMetadata song_metadata = 4;
}
message ResponseTranscoderStatus {
optional int32 processed = 1;
optional int32 total = 2;
}
// The message itself
message Message {
optional int32 version = 1 [default=16];
optional int32 version = 1 [default=18];
optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message?
optional RequestConnect request_connect = 21;
@ -301,6 +320,7 @@ message Message {
optional RequestClosePlaylist request_close_playlist = 29;
optional RequestDownloadSongs request_download_songs = 31;
optional RequestRateSong request_rate_song = 35;
optional RequestGlobalSearch request_global_search = 37;
optional Repeat repeat = 13;
optional Shuffle shuffle = 14;
@ -318,4 +338,6 @@ message Message {
optional ResponseSongOffer response_song_offer = 33;
optional ResponseLibraryChunk response_library_chunk = 34;
optional ResponseDownloadTotalSize response_download_total_size = 36;
optional ResponseGlobalSearch response_global_search = 38;
optional ResponseTranscoderStatus response_transcoder_status = 39;
}

View File

@ -176,9 +176,6 @@ message SeekRequest {
optional int64 offset_nsec = 1;
}
message SeekCompleted {
}
enum Bitrate {
Bitrate96k = 1;
Bitrate160k = 2;
@ -229,7 +226,7 @@ message Message {
optional BrowseToplistRequest browse_toplist_request = 19;
optional BrowseToplistResponse browse_toplist_response = 20;
optional PauseRequest pause_request = 21;
optional SeekCompleted seek_completed = 22;
// ID 22 unused.
optional AddTracksToPlaylistRequest add_tracks_to_playlist = 23;
optional RemoveTracksFromPlaylistRequest remove_tracks_from_playlist = 24;
}

View File

@ -723,6 +723,14 @@ bool TagReader::SaveSongRatingToFile(
if (filename.isNull()) return false;
qLog(Debug) << "Saving song rating tags to" << filename;
if (song.rating() < 0) {
// The FMPS spec says unrated == "tag not present". For us, no rating
// results in rating being -1, so don't write anything in that case.
// Actually, we should also remove tag set in this case, but in
// Clementine it is not possible to unset rating i.e. make a song "unrated".
qLog(Debug) << "Unrated: do nothing";
return true;
}
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));

View File

@ -78,6 +78,7 @@ set(SOURCES
analyzers/rainbowdashanalyzer.cpp
analyzers/sonogram.cpp
analyzers/turbine.cpp
analyzers/fht.cpp
core/appearance.cpp
core/application.cpp
@ -88,7 +89,6 @@ set(SOURCES
core/deletefiles.cpp
core/filesystemmusicstorage.cpp
core/filesystemwatcherinterface.cpp
core/fht.cpp
core/globalshortcutbackend.cpp
core/globalshortcuts.cpp
core/gnomeglobalshortcutbackend.cpp
@ -183,6 +183,7 @@ set(SOURCES
internet/internetmodel.cpp
internet/internetplaylistitem.cpp
internet/internetservice.cpp
internet/internetshowsettingspage.cpp
internet/internetview.cpp
internet/internetviewcontainer.cpp
internet/jamendodynamicplaylist.cpp
@ -232,6 +233,7 @@ set(SOURCES
networkremote/networkremotehelper.cpp
networkremote/outgoingdatacreator.cpp
networkremote/remoteclient.cpp
networkremote/songsender.cpp
networkremote/zeroconf.cpp
playlist/dynamicplaylistcontrols.cpp
@ -247,6 +249,7 @@ set(SOURCES
playlist/playlistlistmodel.cpp
playlist/playlistlistview.cpp
playlist/playlistmanager.cpp
playlist/playlistsaveoptionsdialog.cpp
playlist/playlistsequence.cpp
playlist/playlisttabbar.cpp
playlist/playlistundocommands.cpp
@ -487,6 +490,7 @@ set(HEADERS
internet/internetmimedata.h
internet/internetmodel.h
internet/internetservice.h
internet/internetshowsettingspage.h
internet/internetsongmimedata.h
internet/internetview.h
internet/internetviewcontainer.h
@ -531,6 +535,7 @@ set(HEADERS
networkremote/incomingdataparser.h
networkremote/outgoingdatacreator.h
networkremote/remoteclient.h
networkremote/songsender.h
playlist/dynamicplaylistcontrols.h
playlist/playlist.h
@ -544,6 +549,7 @@ set(HEADERS
playlist/playlistlistmodel.h
playlist/playlistlistview.h
playlist/playlistmanager.h
playlist/playlistsaveoptionsdialog.h
playlist/playlistsequence.h
playlist/playlisttabbar.h
playlist/playlistview.h
@ -692,6 +698,7 @@ set(UI
internet/digitallyimportedsettingspage.ui
internet/groovesharksettingspage.ui
internet/icecastfilterwidget.ui
internet/internetshowsettingspage.ui
internet/internetviewcontainer.ui
internet/magnatunedownloaddialog.ui
internet/magnatunesettingspage.ui
@ -707,6 +714,7 @@ set(UI
playlist/dynamicplaylistcontrols.ui
playlist/playlistcontainer.ui
playlist/playlistsaveoptionsdialog.ui
playlist/playlistlistcontainer.ui
playlist/playlistsequence.ui
playlist/queuemanager.ui
@ -1031,10 +1039,12 @@ optional_source(HAVE_AUDIOCD
SOURCES
devices/cddadevice.cpp
devices/cddalister.cpp
devices/cddasongloader.cpp
ui/ripcd.cpp
HEADERS
devices/cddadevice.h
devices/cddalister.h
devices/cddasongloader.h
ui/ripcd.h
UI
ui/ripcd.ui

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analyzer.h"
#include "engines/enginebase.h"

76
src/analyzers/analyzerbase.cpp Executable file → Normal file
View File

@ -1,25 +1,33 @@
/***************************************************************************
viswidget.cpp - description
-------------------
begin : Die Jan 7 2003
copyright : (C) 2003 by Max Howell
email : markey@web.de
***************************************************************************/
/* This file is part of Clementine.
Copyright 2003, Max Howell <max.howell@methylblue.com>
Copyright 2009, 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2003
*/
#include "analyzerbase.h"
#include <cmath> //interpolate()
#include <cmath>
#include <cstdint>
#include <QEvent> //event()
#include <QEvent>
#include <QPainter>
#include <QPaintEvent>
#include <QtDebug>
@ -34,10 +42,10 @@
// widget when you return control to it
// 4. if you want to manipulate the scope, reimplement transform()
// 5. for convenience <vector> <qpixmap.h> <qwdiget.h> are pre-included
// TODO make an INSTRUCTIONS file
// TODO(David Sansome): make an INSTRUCTIONS file
// can't mod scope in analyze you have to use transform
// TODO for 2D use setErasePixmap Qt function insetead of m_background
// TODO(John Maguire): for 2D use setErasePixmap Qt function insetead of m_background
// make the linker happy only for gcc < 4.0
#if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 0)) && \
@ -60,8 +68,7 @@ void Analyzer::Base::hideEvent(QHideEvent*) { m_timer.stop(); }
void Analyzer::Base::showEvent(QShowEvent*) { m_timer.start(timeout(), this); }
void Analyzer::Base::transform(Scope& scope) // virtual
{
void Analyzer::Base::transform(Scope& scope) {
// this is a standard transformation that should give
// an FFT scope that has bands for pretty analyzers
@ -91,9 +98,9 @@ void Analyzer::Base::paintEvent(QPaintEvent* e) {
// convert to mono here - our built in analyzers need mono, but the
// engines provide interleaved pcm
for (uint x = 0; (int)x < m_fht->size(); ++x) {
for (uint x = 0; static_cast<int>(x) < m_fht->size(); ++x) {
m_lastScope[x] =
double(thescope[i] + thescope[i + 1]) / (2 * (1 << 15));
static_cast<double>(thescope[i] + thescope[i + 1]) / (2 * (1 << 15));
i += 2;
}
@ -150,22 +157,21 @@ int Analyzer::Base::resizeForBands(int bands) {
return m_fht->size() / 2;
}
void Analyzer::Base::demo(QPainter& p) // virtual
{
void Analyzer::Base::demo(QPainter& p) {
static int t = 201; // FIXME make static to namespace perhaps
if (t > 999) t = 1; // 0 = wasted calculations
if (t < 201) {
Scope s(32);
const double dt = double(t) / 200;
const double dt = static_cast<double>(t) / 200;
for (uint i = 0; i < s.size(); ++i)
s[i] = dt * (sin(M_PI + (i * M_PI) / s.size()) + 1.0);
analyze(p, s, new_frame_);
} else
} else {
analyze(p, Scope(32, 0), new_frame_);
}
++t;
}
@ -173,20 +179,19 @@ void Analyzer::Base::polishEvent() {
init(); // virtual
}
void Analyzer::interpolate(const Scope& inVec, Scope& outVec) // static
{
void Analyzer::interpolate(const Scope& inVec, Scope& outVec) {
double pos = 0.0;
const double step = (double)inVec.size() / outVec.size();
const double step = static_cast<double>(inVec.size()) / outVec.size();
for (uint i = 0; i < outVec.size(); ++i, pos += step) {
const double error = pos - std::floor(pos);
const unsigned long offset = (unsigned long)pos;
const uint64_t offset = static_cast<uint64_t>(pos);
unsigned long indexLeft = offset + 0;
uint64_t indexLeft = offset + 0;
if (indexLeft >= inVec.size()) indexLeft = inVec.size() - 1;
unsigned long indexRight = offset + 1;
uint64_t indexRight = offset + 1;
if (indexRight >= inVec.size()) indexRight = inVec.size() - 1;
@ -194,8 +199,7 @@ void Analyzer::interpolate(const Scope& inVec, Scope& outVec) // static
}
}
void Analyzer::initSin(Scope& v, const uint size) // static
{
void Analyzer::initSin(Scope& v, const uint size) {
double step = (M_PI * 2) / size;
double radian = 0;

54
src/analyzers/analyzerbase.h Executable file → Normal file
View File

@ -1,27 +1,49 @@
// Maintainer: Max Howell <max.howell@methylblue.com>, (C) 2004
// Copyright: See COPYING file that comes with this distribution
/* This file is part of Clementine.
Copyright 2004, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
#ifndef ANALYZERBASE_H
#define ANALYZERBASE_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2004
*/
#ifndef ANALYZERS_ANALYZERBASE_H_
#define ANALYZERS_ANALYZERBASE_H_
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include "core/fht.h" //stack allocated and convenience
#include "fht.h"
#include "engines/engine_fwd.h"
#include <QPixmap> //stack allocated and convenience
#include <QBasicTimer> //stack allocated
#include <QWidget> //baseclass
#include <vector> //included for convenience
#include <QPixmap>
#include <QBasicTimer>
#include <QWidget>
#include <vector>
#include <QGLWidget> //baseclass
#include <QGLWidget>
#ifdef Q_WS_MACX
#include <OpenGL/gl.h> //included for convenience
#include <OpenGL/glu.h> //included for convenience
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> //included for convenience
#include <GL/glu.h> //included for convenience
#include <GL/gl.h>
#include <GL/glu.h>
#endif
class QEvent;
@ -53,7 +75,7 @@ class Base : public QWidget {
virtual void framerateChanged() {}
protected:
Base(QWidget*, uint scopeSize = 7);
explicit Base(QWidget*, uint scopeSize = 7);
void hideEvent(QHideEvent*);
void showEvent(QShowEvent*);
@ -86,4 +108,4 @@ void initSin(Scope&, const uint = 6000);
} // END namespace Analyzer
#endif
#endif // ANALYZERS_ANALYZERBASE_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011-2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2013, Vasily Fomin <vasili.fomin@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011-2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2013, Vasily Fomin <vasili.fomin@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +19,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ANALYZERCONTAINER_H
#define ANALYZERCONTAINER_H
#ifndef ANALYZERS_ANALYZERCONTAINER_H_
#define ANALYZERS_ANALYZERCONTAINER_H_
#include <QWidget>
#include <QMenu>
@ -29,8 +33,7 @@ class AnalyzerContainer : public QWidget {
Q_OBJECT
public:
AnalyzerContainer(QWidget* parent);
explicit AnalyzerContainer(QWidget* parent);
void SetEngine(EngineBase* engine);
void SetActions(QAction* visualisation);
@ -100,4 +103,4 @@ void AnalyzerContainer::AddAnalyzerType() {
actions_ << action;
}
#endif
#endif // ANALYZERS_ANALYZERCONTAINER_H_

View File

@ -1,18 +1,31 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Mark Kretschmann <markey@web.de>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
/* This file is part of Clementine.
Copyright 2003, Mark Kretschmann <markey@web.de>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Alibek Omarov <a1ba.omarov@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Mark Kretschmann <markey@web.de> 2003
*/
#include "baranalyzer.h"
#include <cmath> //log10(), etc.
#include <cmath>
#include <QtDebug>
#include <QPainter>
@ -27,15 +40,15 @@ BarAnalyzer::BarAnalyzer(QWidget* parent) : Analyzer::Base(parent, 8) {
QColor fg(parent->palette().color(QPalette::Highlight).lighter(150));
double dr = double(m_bg.red() - fg.red()) /
double dr = static_cast<double>(m_bg.red() - fg.red()) /
(NUM_ROOFS - 1); // -1 because we start loop below at 0
double dg = double(m_bg.green() - fg.green()) / (NUM_ROOFS - 1);
double db = double(m_bg.blue() - fg.blue()) / (NUM_ROOFS - 1);
double dg = static_cast<double>(m_bg.green() - fg.green()) / (NUM_ROOFS - 1);
double db = static_cast<double>(m_bg.blue() - fg.blue()) / (NUM_ROOFS - 1);
for (uint i = 0; i < NUM_ROOFS; ++i) {
m_pixRoof[i] = QPixmap(COLUMN_WIDTH, 1);
m_pixRoof[i].fill(QColor(fg.red() + int(dr * i), fg.green() + int(dg * i),
fg.blue() + int(db * i)));
m_pixRoof[i].fill(QColor(fg.red() + static_cast<int>(dr * i), fg.green() + static_cast<int>(dg * i),
fg.blue() + static_cast<int>(db * i)));
}
}
@ -45,11 +58,11 @@ void BarAnalyzer::resizeEvent(QResizeEvent* e) { init(); }
void BarAnalyzer::init() {
const double MAX_AMPLITUDE = 1.0;
const double F = double(height() - 2) / (log10(255) * MAX_AMPLITUDE);
const double F = static_cast<double>(height() - 2) / (log10(255) * MAX_AMPLITUDE);
BAND_COUNT = width() / 5;
MAX_DOWN = int(0 - (qMax(1, height() / 50)));
MAX_UP = int(qMax(1, height() / 25));
MAX_DOWN = static_cast<int>(0 - (qMax(1, height() / 50)));
MAX_UP = static_cast<int>(qMax(1, height() / 25));
barVector.resize(BAND_COUNT, 0);
roofVector.resize(BAND_COUNT, height() - 5);
@ -60,7 +73,7 @@ void BarAnalyzer::init() {
// generate a list of values that express amplitudes in range 0-MAX_AMP as
// ints from 0-height() on log scale
for (uint x = 0; x < 256; ++x) {
m_lvlMapper[x] = uint(F * log10(x + 1));
m_lvlMapper[x] = static_cast<uint>(F * log10(x + 1));
}
m_pixBarGradient = QPixmap(height() * COLUMN_WIDTH, height());
@ -74,11 +87,11 @@ void BarAnalyzer::init() {
for (int x = 0, r = rgb.red(), g = rgb.green(), b = rgb.blue(), r2 = 255 - r; x < height();
++x) {
for (int y = x; y > 0; --y) {
const double fraction = (double)y / height();
const double fraction = static_cast<double>(y) / height();
// p.setPen( QColor( r + (int)(r2 * fraction), g, b - (int)(255 *
// fraction) ) );
p.setPen(QColor(r + (int)(r2 * fraction), g, b));
p.setPen(QColor(r + static_cast<int>(r2 * fraction), g, b));
p.drawLine(x * COLUMN_WIDTH, height() - y, (x + 1) * COLUMN_WIDTH,
height() - y);
}
@ -102,7 +115,7 @@ void BarAnalyzer::analyze(QPainter& p, const Scope& s, bool new_frame) {
for (uint i = 0, x = 0, y2; i < v.size(); ++i, x += COLUMN_WIDTH + 1) {
// assign pre[log10]'d value
y2 = uint(v[i] *
y2 = static_cast<uint>(v[i] *
256); // 256 will be optimised to a bitshift //no, it's a float
y2 = m_lvlMapper[(y2 > 255) ? 255 : y2]; // lvlMapper is array of ints with
// values 0 to height()
@ -124,8 +137,8 @@ void BarAnalyzer::analyze(QPainter& p, const Scope& s, bool new_frame) {
MAX_DOWN)
y2 = barVector[i] + MAX_DOWN;
if ((int)y2 > roofVector[i]) {
roofVector[i] = (int)y2;
if (static_cast<int>(y2) > roofVector[i]) {
roofVector[i] = static_cast<int>(y2);
roofVelocityVector[i] = 1;
}
@ -162,10 +175,11 @@ void BarAnalyzer::analyze(QPainter& p, const Scope& s, bool new_frame) {
if (roofVector[i] < 0) {
roofVector[i] = 0; // not strictly necessary
roofVelocityVector[i] = 0;
} else
} else {
++roofVelocityVector[i];
}
}
}
p.drawPixmap(0, 0, canvas_);
}

View File

@ -1,10 +1,31 @@
// Maintainer: Max Howell <max.howell@methylblue.com>
// Authors: Mark Kretschmann & Max Howell (C) 2003-4
// Copyright: See COPYING file that comes with this distribution
//
/* This file is part of Clementine.
Copyright 2003-2005, Max Howell <max.howell@methylblue.com>
Copyright 2005, Mark Kretschmann <markey@web.de>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof A. Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
#ifndef BARANALYZER_H
#define BARANALYZER_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2003-2005
* Original Author: Mark Kretschmann <markey@web.de> 2005
*/
#ifndef ANALYZERS_BARANALYZER_H_
#define ANALYZERS_BARANALYZER_H_
#include "analyzerbase.h"
@ -12,6 +33,7 @@ typedef std::vector<uint> aroofMemVec;
class BarAnalyzer : public Analyzer::Base {
Q_OBJECT
public:
Q_INVOKABLE BarAnalyzer(QWidget*);
@ -57,4 +79,4 @@ class BarAnalyzer : public Analyzer::Base {
QColor m_bg;
};
#endif
#endif // ANALYZERS_BARANALYZER_H_

View File

@ -1,7 +1,28 @@
// Author: Max Howell <max.howell@methylblue.com>, (C) 2003-5
// Mark Kretschmann <markey@web.de>, (C) 2005
// Copyright: See COPYING file that comes with this distribution
//
/* This file is part of Clementine.
Copyright 2003-2005, Max Howell <max.howell@methylblue.com>
Copyright 2005, Mark Kretschmann <markey@web.de>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2003-2005
* Original Author: Mark Kretschmann <markey@web.de> 2005
*/
#include "blockanalyzer.h"
@ -24,28 +45,19 @@ const char* BlockAnalyzer::kName =
BlockAnalyzer::BlockAnalyzer(QWidget* parent)
: Analyzer::Base(parent, 9),
m_columns(0) // uint
,
m_rows(0) // uint
,
m_y(0) // uint
,
m_barPixmap(1, 1) // null qpixmaps cause crashes
,
m_columns(0),
m_rows(0),
m_y(0),
m_barPixmap(1, 1),
m_topBarPixmap(WIDTH, HEIGHT),
m_scope(MIN_COLUMNS) // Scope
,
m_store(1 << 8, 0) // vector<uint>
,
m_fade_bars(FADE_SIZE) // vector<QPixmap>
,
m_fade_pos(1 << 8, 50) // vector<uint>
,
m_fade_intensity(1 << 8, 32) // vector<uint>
{
m_scope(MIN_COLUMNS),
m_store(1 << 8, 0),
m_fade_bars(FADE_SIZE),
m_fade_pos(1 << 8, 50),
m_fade_intensity(1 << 8, 32) {
setMinimumSize(MIN_COLUMNS * (WIDTH + 1) - 1,
MIN_ROWS * (HEIGHT + 1) -
1); //-1 is padding, no drawing takes place there
MIN_ROWS * (HEIGHT + 1) - 1);
// -1 is padding, no drawing takes place there
setMaximumWidth(MAX_COLUMNS * (WIDTH + 1) - 1);
// mxcl says null pixmaps cause crashes, so let's play it safe
@ -64,8 +76,8 @@ void BlockAnalyzer::resizeEvent(QResizeEvent* e) {
// all is explained in analyze()..
// +1 to counter -1 in maxSizes, trust me we need this!
m_columns = qMax(uint(double(width() + 1) / (WIDTH + 1)), MAX_COLUMNS);
m_rows = uint(double(height() + 1) / (HEIGHT + 1));
m_columns = qMax(static_cast<uint>(static_cast<double>(width() + 1) / (WIDTH + 1)), MAX_COLUMNS);
m_rows = static_cast<uint>(static_cast<double>(height() + 1) / (HEIGHT + 1));
// this is the y-offset for drawing from the top of the widget
m_y = (height() - (m_rows * (HEIGHT + 1)) + 2) / 2;
@ -103,15 +115,14 @@ void BlockAnalyzer::determineStep() {
// the fall time of 30 is too slow on framerates above 50fps
const double fallTime = timeout() < 20 ? 20 * m_rows : 30 * m_rows;
m_step = double(m_rows * timeout()) / fallTime;
m_step = static_cast<double>(m_rows * timeout()) / fallTime;
}
void BlockAnalyzer::framerateChanged() { // virtual
determineStep();
}
void BlockAnalyzer::transform(Analyzer::Scope& s) // pure virtual
{
void BlockAnalyzer::transform(Analyzer::Scope& s) {
for (uint x = 0; x < s.size(); ++x) s[x] *= 2;
float* front = static_cast<float*>(&s.front());
@ -157,12 +168,12 @@ void BlockAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s,
for (uint y, x = 0; x < m_scope.size(); ++x) {
// determine y
for (y = 0; m_scope[x] < m_yscale[y]; ++y)
;
continue;
// this is opposite to what you'd think, higher than y
// means the bar is lower than y (physically)
if ((float)y > m_store[x])
y = int(m_store[x] += m_step);
if (static_cast<float>(y) > m_store[x])
y = static_cast<int>(m_store[x] += m_step);
else
m_store[x] = y;
@ -191,8 +202,9 @@ void BlockAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s,
}
for (uint x = 0; x < m_store.size(); ++x)
canvas_painter.drawPixmap(
x * (WIDTH + 1), int(m_store[x]) * (HEIGHT + 1) + m_y, m_topBarPixmap);
canvas_painter.drawPixmap(x * (WIDTH + 1),
static_cast<int>(m_store[x]) * (HEIGHT + 1) + m_y,
m_topBarPixmap);
p.drawPixmap(0, 0, canvas_);
}
@ -231,7 +243,7 @@ static inline void adjustToLimits(int& b, int& f, uint& amount) {
QColor ensureContrast(const QColor& bg, const QColor& fg, uint _amount = 150) {
class OutputOnExit {
public:
OutputOnExit(const QColor& color) : c(color) {}
explicit OutputOnExit(const QColor& color) : c(color) {}
~OutputOnExit() {
int h, s, v;
c.getHsv(&h, &s, &v);
@ -241,14 +253,6 @@ QColor ensureContrast(const QColor& bg, const QColor& fg, uint _amount = 150) {
const QColor& c;
};
// hack so I don't have to cast everywhere
#define amount static_cast<int>(_amount)
// #define STAMP debug() << (QValueList<int>() << fh << fs << fv) << endl;
// #define STAMP1( string ) debug() << string << ": " <<
// (QValueList<int>() << fh << fs << fv) << endl;
// #define STAMP2( string, value ) debug() << string << "=" << value << ":
// " << (QValueList<int>() << fh << fs << fv) << endl;
OutputOnExit allocateOnTheStack(fg);
int bh, bs, bv;
@ -259,23 +263,17 @@ QColor ensureContrast(const QColor& bg, const QColor& fg, uint _amount = 150) {
int dv = abs(bv - fv);
// STAMP2( "DV", dv );
// value is the best measure of contrast
// if there is enough difference in value already, return fg unchanged
if (dv > amount) return fg;
if (dv > static_cast<int>(_amount)) return fg;
int ds = abs(bs - fs);
// STAMP2( "DS", ds );
// saturation is good enough too. But not as good. TODO adapt this a little
if (ds > amount) return fg;
if (ds > static_cast<int>(_amount)) return fg;
int dh = abs(bh - fh);
// STAMP2( "DH", dh );
if (dh > 120) {
// a third of the colour wheel automatically guarentees contrast
// but only if the values are high enough and saturations significant enough
@ -283,105 +281,75 @@ QColor ensureContrast(const QColor& bg, const QColor& fg, uint _amount = 150) {
// check the saturation for the two colours is sufficient that hue alone can
// provide sufficient contrast
if (ds > amount / 2 && (bs > 125 && fs > 125))
// STAMP1( "Sufficient saturation difference, and hues are
// compliemtary" );
if (ds > static_cast<int>(_amount) / 2 && (bs > 125 && fs > 125))
return fg;
else if (dv > amount / 2 && (bv > 125 && fv > 125))
// STAMP1( "Sufficient value difference, and hues are
// compliemtary" );
else if (dv > static_cast<int>(_amount) / 2 && (bv > 125 && fv > 125))
return fg;
// STAMP1( "Hues are complimentary but we must modify the value or
// saturation of the contrasting colour" );
// but either the colours are two desaturated, or too dark
// so we need to adjust the system, although not as much
///_amount /= 2;
}
if (fs < 50 && ds < 40) {
// low saturation on a low saturation is sad
const int tmp = 50 - fs;
fs = 50;
if (amount > tmp)
if (static_cast<int>(_amount) > tmp)
_amount -= tmp;
else
_amount = 0;
}
// test that there is available value to honor our contrast requirement
if (255 - dv < amount) {
if (255 - dv < static_cast<int>(_amount)) {
// we have to modify the value and saturation of fg
// adjustToLimits( bv, fv, amount );
// STAMP
// see if we need to adjust the saturation
if (amount > 0) adjustToLimits(bs, fs, _amount);
// STAMP
if (static_cast<int>(_amount) > 0) adjustToLimits(bs, fs, _amount);
// see if we need to adjust the hue
if (amount > 0) fh += amount; // cycles around;
// STAMP
if (static_cast<int>(_amount) > 0) fh += static_cast<int>(_amount); // cycles around;
return QColor::fromHsv(fh, fs, fv);
}
// STAMP
if (fv > bv && bv > static_cast<int>(_amount))
return QColor::fromHsv(fh, fs, bv - static_cast<int>(_amount));
if (fv > bv && bv > amount) return QColor::fromHsv(fh, fs, bv - amount);
if (fv < bv && fv > static_cast<int>(_amount))
return QColor::fromHsv(fh, fs, fv - static_cast<int>(_amount));
// STAMP
if (fv > bv && (255 - fv > static_cast<int>(_amount)))
return QColor::fromHsv(fh, fs, fv + static_cast<int>(_amount));
if (fv < bv && fv > amount) return QColor::fromHsv(fh, fs, fv - amount);
// STAMP
if (fv > bv && (255 - fv > amount))
return QColor::fromHsv(fh, fs, fv + amount);
// STAMP
if (fv < bv && (255 - bv > amount))
return QColor::fromHsv(fh, fs, bv + amount);
// STAMP
// debug() << "Something went wrong!\n";
if (fv < bv && (255 - bv > static_cast<int>(_amount)))
return QColor::fromHsv(fh, fs, bv + static_cast<int>(_amount));
return Qt::blue;
#undef amount
// #undef STAMP
}
void BlockAnalyzer::paletteChange(const QPalette&) // virtual
{
void BlockAnalyzer::paletteChange(const QPalette&) {
const QColor bg = palette().color(QPalette::Background);
const QColor fg = ensureContrast(bg, palette().color(QPalette::Highlight));
m_topBarPixmap.fill(fg);
const double dr = 15 * double(bg.red() - fg.red()) / (m_rows * 16);
const double dg = 15 * double(bg.green() - fg.green()) / (m_rows * 16);
const double db = 15 * double(bg.blue() - fg.blue()) / (m_rows * 16);
const double dr = 15 * static_cast<double>(bg.red() - fg.red()) / (m_rows * 16);
const double dg = 15 * static_cast<double>(bg.green() - fg.green()) / (m_rows * 16);
const double db = 15 * static_cast<double>(bg.blue() - fg.blue()) / (m_rows * 16);
const int r = fg.red(), g = fg.green(), b = fg.blue();
bar()->fill(bg);
QPainter p(bar());
for (int y = 0; (uint)y < m_rows; ++y)
for (int y = 0; static_cast<uint>(y) < m_rows; ++y)
// graduate the fg color
p.fillRect(0, y * (HEIGHT + 1), WIDTH, HEIGHT,
QColor(r + int(dr * y), g + int(dg * y), b + int(db * y)));
QColor(r + static_cast<int>(dr * y), g + static_cast<int>(dg * y),
b + static_cast<int>(db * y)));
{
const QColor bg = palette().color(QPalette::Background).dark(112);
// make a complimentary fadebar colour
// TODO dark is not always correct, dumbo!
// TODO(John Maguire): dark is not always correct, dumbo!
int h, s, v;
palette().color(QPalette::Background).dark(150).getHsv(&h, &s, &v);
const QColor fg(QColor::fromHsv(h + 120, s, v));
@ -395,10 +363,10 @@ void BlockAnalyzer::paletteChange(const QPalette&) // virtual
for (uint y = 0; y < FADE_SIZE; ++y) {
m_fade_bars[y].fill(palette().color(QPalette::Background));
QPainter f(&m_fade_bars[y]);
for (int z = 0; (uint)z < m_rows; ++z) {
for (int z = 0; static_cast<uint>(z) < m_rows; ++z) {
const double Y = 1.0 - (log10(FADE_SIZE - y) / log10(FADE_SIZE));
f.fillRect(0, z * (HEIGHT + 1), WIDTH, HEIGHT,
QColor(r + int(dr * Y), g + int(dg * Y), b + int(db * Y)));
QColor(r + static_cast<int>(dr * Y), g + static_cast<int>(dg * Y), b + static_cast<int>(db * Y)));
}
}
}

View File

@ -1,9 +1,29 @@
// Maintainer: Max Howell <mac.howell@methylblue.com>, (C) 2003-5
// Copyright: See COPYING file that comes with this distribution
//
/* This file is part of Clementine.
Copyright 2003-2005, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof A. Sobiecki <sobkas@gmail.com>
#ifndef BLOCKANALYZER_H
#define BLOCKANALYZER_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2003-2005
*/
#ifndef ANALYZERS_BLOCKANALYZER_H_
#define ANALYZERS_BLOCKANALYZER_H_
#include "analyzerbase.h"
#include <qcolor.h>
@ -12,12 +32,9 @@ class QResizeEvent;
class QMouseEvent;
class QPalette;
/**
* @author Max Howell
*/
class BlockAnalyzer : public Analyzer::Base {
Q_OBJECT
public:
Q_INVOKABLE BlockAnalyzer(QWidget*);
~BlockAnalyzer();
@ -62,4 +79,4 @@ class BlockAnalyzer : public Analyzer::Base {
float m_step; // rows to fall per frame
};
#endif
#endif // ANALYZERS_BLOCKANALYZER_H_

View File

@ -1,5 +1,26 @@
// Author: Max Howell <max.howell@methylblue.com>, (C) 2004
// Copyright: See COPYING file that comes with this distribution
/* This file is part of Clementine.
Copyright 2004, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2004
*/
#include "boomanalyzer.h"
#include <cmath>
@ -23,11 +44,11 @@ BoomAnalyzer::BoomAnalyzer(QWidget* parent)
barPixmap(COLUMN_WIDTH, 50) {}
void BoomAnalyzer::changeK_barHeight(int newValue) {
K_barHeight = (double)newValue / 1000;
K_barHeight = static_cast<double>(newValue) / 1000;
}
void BoomAnalyzer::changeF_peakSpeed(int newValue) {
F_peakSpeed = (double)newValue / 1000;
F_peakSpeed = static_cast<double>(newValue) / 1000;
}
void BoomAnalyzer::resizeEvent(QResizeEvent*) { init(); }
@ -36,7 +57,7 @@ void BoomAnalyzer::init() {
const uint HEIGHT = height() - 2;
const double h = 1.2 / HEIGHT;
F = double(HEIGHT) / (log10(256) * 1.1 /*<- max. amplitude*/);
F = static_cast<double>(HEIGHT) / (log10(256) * 1.1 /*<- max. amplitude*/);
barPixmap = QPixmap(COLUMN_WIDTH - 2, HEIGHT);
canvas_ = QPixmap(size());
@ -44,11 +65,11 @@ void BoomAnalyzer::init() {
QPainter p(&barPixmap);
for (uint y = 0; y < HEIGHT; ++y) {
const double F = (double)y * h;
const double F = static_cast<double>(y) * h;
p.setPen(QColor(qMax(0, 255 - int(229.0 * F)),
qMax(0, 255 - int(229.0 * F)),
qMax(0, 255 - int(191.0 * F))));
p.setPen(QColor(qMax(0, 255 - static_cast<int>(229.0 * F)),
qMax(0, 255 - static_cast<int>(229.0 * F)),
qMax(0, 255 - static_cast<int>(191.0 * F))));
p.drawLine(0, y, COLUMN_WIDTH - 2, y);
}
}
@ -94,8 +115,9 @@ void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
if (h > peak_height[i]) {
peak_height[i] = h;
peak_speed[i] = 0.01;
} else
} else {
goto peak_handling;
}
} else {
if (bar_height[i] > 0.0) {
bar_height[i] -= K_barHeight; // 1.4

View File

@ -1,9 +1,29 @@
// Author: Max Howell <max.howell@methylblue.com>, (C) 2004
// Copyright: See COPYING file that comes with this distribution
//
/* This file is part of Clementine.
Copyright 2004, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
#ifndef BOOMANALYZER_H
#define BOOMANALYZER_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Max Howell <max.howell@methylblue.com> 2004
*/
#ifndef ANALYZERS_BOOMANALYZER_H_
#define ANALYZERS_BOOMANALYZER_H_
#include "analyzerbase.h"
@ -13,6 +33,7 @@
class BoomAnalyzer : public Analyzer::Base {
Q_OBJECT
public:
Q_INVOKABLE BoomAnalyzer(QWidget*);
@ -42,4 +63,4 @@ class BoomAnalyzer : public Analyzer::Base {
QPixmap canvas_;
};
#endif
#endif // ANALYZERS_BOOMANALYZER_H_

View File

@ -1,22 +1,24 @@
// FHT - Fast Hartley Transform Class
//
// Copyright (C) 2004 Melchior FRANZ - mfranz@kde.org
//
// 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 2 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, write to the Free Software
// Foundation, 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA
//
// $Id$
/* This file is part of Clementine.
Copyright 2004, Melchior FRANZ <mfranz@kde.org>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Melchior FRANZ <mfranz@kde.org> 2004
*/
#include <math.h>
#include <string.h>
@ -58,11 +60,11 @@ void FHT::makeCasTable(void) {
}
float* FHT::copy(float* d, float* s) {
return (float*)memcpy(d, s, m_num * sizeof(float));
return static_cast<float*>(memcpy(d, s, m_num * sizeof(float)));
}
float* FHT::clear(float* d) {
return (float*)memset(d, 0, m_num * sizeof(float));
return static_cast<float*>(memset(d, 0, m_num * sizeof(float)));
}
void FHT::scale(float* p, float d) {
@ -77,9 +79,9 @@ void FHT::logSpectrum(float* out, float* p) {
int n = m_num / 2, i, j, k, *r;
if (!m_log) {
m_log = new int[n];
float f = n / log10((double)n);
float f = n / log10(static_cast<double>(n));
for (i = 0, r = m_log; i < n; i++, r++) {
j = int(rint(log10(i + 1.0) * f));
j = static_cast<int>(rint(log10(i + 1.0) * f));
*r = j >= n ? n - 1 : j;
}
}
@ -87,9 +89,9 @@ void FHT::logSpectrum(float* out, float* p) {
*out++ = *p = *p / 100;
for (k = i = 1, r = m_log; i < n; i++) {
j = *r++;
if (i == j)
if (i == j) {
*out++ = p[i];
else {
} else {
float base = p[k - 1];
float step = (p[j] - base) / (j - (k - 1));
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
@ -108,7 +110,8 @@ void FHT::semiLogSpectrum(float* p) {
void FHT::spectrum(float* p) {
power2(p);
for (int i = 0; i < (m_num / 2); i++, p++) *p = (float)sqrt(*p * .5);
for (int i = 0; i < (m_num / 2); i++, p++)
*p = static_cast<float>(sqrt(*p * .5));
}
void FHT::power(float* p) {

View File

@ -1,25 +1,27 @@
// FHT - Fast Hartley Transform Class
//
// Copyright (C) 2004 Melchior FRANZ - mfranz@kde.org
//
// 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 2 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, write to the Free Software
// Foundation, 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA
//
// $Id$
/* This file is part of Clementine.
Copyright 2004, Melchior FRANZ <mfranz@kde.org>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
#ifndef FHT_H
#define FHT_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Melchior FRANZ <mfranz@kde.org> 2004
*/
#ifndef ANALYZERS_FHT_H_
#define ANALYZERS_FHT_H_
/**
* Implementation of the Hartley Transform after Bracewell's discrete
@ -54,7 +56,7 @@ class FHT {
* should be at least 3. Values of more than 3 need a trigonometry table.
* @see makeCasTable()
*/
FHT(int);
explicit FHT(int);
~FHT();
inline int sizeExp() const { return m_exp2; }
@ -115,4 +117,4 @@ class FHT {
void transform(float*);
};
#endif
#endif // ANALYZERS_FHT_H_

View File

@ -1,19 +1,25 @@
/***************************************************************************
gloscope.cpp - description
-------------------
begin : Jan 17 2004
copyright : (C) 2004 by Adam Pigg
email : adam@piggz.co.uk
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Adam Pigg <adam@piggz.co.uk>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Adam Pigg <adam@piggz.co.uk> 2004
*/
#include <config.h>
@ -28,8 +34,6 @@ GLAnalyzer::GLAnalyzer(QWidget* parent)
GLAnalyzer::~GLAnalyzer() {}
// METHODS =====================================================
void GLAnalyzer::analyze(const Scope& s) {
// kdDebug() << "Scope Size: " << s.size() << endl;
/* Scope t(32);
@ -66,15 +70,12 @@ void GLAnalyzer::analyze(const Scope& s) {
mfactor = 20 / peak;
for (uint i = 0; i < 32; i++) {
// kdDebug() << "Scope item " << i << " value: " << s[i] << endl;
// Calculate new horizontal position (x) depending on number of samples
x = -16.0f + i;
// Calculating new vertical position (y) depending on the data passed by
// amarok
y = float(s[i + offset] * mfactor); // This make it kinda dynamically
y = static_cast<float>(s[i + offset] * mfactor); // This make it kinda dynamically
// resize depending on the data
// Some basic bounds checking
@ -83,10 +84,10 @@ void GLAnalyzer::analyze(const Scope& s) {
else if (y < 0)
y = 0;
if ((y - m_oldy[i]) < -0.6f) // Going Down Too Much
{
if ((y - m_oldy[i]) < -0.6f) {
y = m_oldy[i] - 0.7f;
}
if (y < 0.0f) {
y = 0.0f;
}
@ -145,9 +146,6 @@ void GLAnalyzer::resizeGL(int w, int h) {
void GLAnalyzer::paintGL() {
glMatrixMode(GL_MODELVIEW);
#if 0
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
#else
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glPushMatrix();

View File

@ -1,32 +1,34 @@
/***************************************************************************
gloscope.h - description
-------------------
begin : Jan 17 2004
copyright : (C) 2004 by Adam Pigg
email : adam@piggz.co.uk
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Adam Pigg <adam@piggz.co.uk>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
#ifndef GLOSCOPE_H
#define GLOSCOPE_H
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Adam Pigg <adam@piggz.co.uk> 2004
*/
#ifndef ANALYZERS_GLANALYZER_H_
#define ANALYZERS_GLANALYZER_H_
#include <config.h>
#ifdef HAVE_QGLWIDGET
#include "analyzerbase.h"
/**
*@author piggz
*/
typedef struct {
float level;
uint delay;
@ -46,7 +48,7 @@ class GLAnalyzer : public Analyzer::Base3D {
GLfloat x, y;
public:
GLAnalyzer(QWidget*);
explicit GLAnalyzer(QWidget*);
~GLAnalyzer();
void analyze(const Scope&);
@ -57,4 +59,4 @@ class GLAnalyzer : public Analyzer::Base3D {
};
#endif
#endif
#endif // ANALYZERS_GLANALYZER_H_

View File

@ -1,19 +1,25 @@
/***************************************************************************
glanalyzer2.cpp - description
-------------------
begin : Feb 16 2004
copyright : (C) 2004 by Enrico Ros
email : eros.kde@email.it
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Enrico Ros <eros.kde@email.it>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Enrico Ros <eros.kde@email.it> 2004
*/
#include <config.h>
@ -71,7 +77,7 @@ void GLAnalyzer2::resizeGL(int w, int h) {
glOrtho(-10.0f, 10.0f, -10.0f, 10.0f, -5.0f, 5.0f);
// Get the aspect ratio of the screen to draw 'cicular' particles
float ratio = (float)w / (float)h, eqPixH = 60, eqPixW = 80;
float ratio = static_cast<float>(w) / static_cast<float>(h), eqPixH = 60, eqPixW = 80;
if (ratio >= (4.0 / 3.0)) {
unitX = 10.0 / (eqPixH * ratio);
unitY = 10.0 / eqPixH;
@ -83,7 +89,7 @@ void GLAnalyzer2::resizeGL(int w, int h) {
// Get current timestamp.
timeval tv;
gettimeofday(&tv, nullptr);
show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
show.timeStamp = static_cast<double>(tv.tv_sec) + static_cast<double>(tv.tv_usec) / 1000000.0;
}
void GLAnalyzer2::paused() { analyze(Scope()); }
@ -103,20 +109,21 @@ void GLAnalyzer2::analyze(const Scope& s) {
for (int i = 0; i < bands; i++) {
float value = s[i];
currentEnergy += value;
currentMeanBand += (float)i * value;
currentMeanBand += static_cast<float>(i) * value;
if (value > maxValue) maxValue = value;
}
frame.silence = currentEnergy < 0.001;
if (!frame.silence) {
frame.meanBand = 100.0 * currentMeanBand / (currentEnergy * bands);
currentEnergy = 100.0 * currentEnergy / (float)bands;
currentEnergy = 100.0 * currentEnergy / static_cast<float>(bands);
frame.dEnergy = currentEnergy - frame.energy;
frame.energy = currentEnergy;
// printf( "%d [%f :: %f ]\t%f \n", bands, frame.energy,
// frame.meanBand, maxValue );
} else
} else {
frame.energy = 0.0;
}
}
// update the frame
updateGL();
@ -126,7 +133,7 @@ void GLAnalyzer2::paintGL() {
// Compute the dT since the last call to paintGL and update timings
timeval tv;
gettimeofday(&tv, nullptr);
double currentTime = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
double currentTime = static_cast<double>(tv.tv_sec) + static_cast<double>(tv.tv_usec) / 1000000.0;
show.dT = currentTime - show.timeStamp;
show.timeStamp = currentTime;
@ -202,8 +209,9 @@ void GLAnalyzer2::paintGL() {
if (dotTexture) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, dotTexture);
} else
} else {
glDisable(GL_TEXTURE_2D);
}
glLoadIdentity();
// glRotatef( -frame.rotDegrees, 0,0,1 );

View File

@ -1,22 +1,28 @@
/***************************************************************************
glanalyzer2.h - description
-------------------
begin : Feb 16 2004
copyright : (C) 2004 by Enrico Ros
email : eros.kde@email.it
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Enrico Ros <eros.kde@email.it>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
#ifndef GLSTARVIEW_H
#define GLSTARVIEW_H
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Enrico Ros <eros.kde@email.it> 2004
*/
#ifndef ANALYZERS_GLANALYZER2_H_
#define ANALYZERS_GLANALYZER2_H_
#include <config.h>
#ifdef HAVE_QGLWIDGET
@ -27,7 +33,7 @@
class GLAnalyzer2 : public Analyzer::Base3D {
public:
GLAnalyzer2(QWidget*);
explicit GLAnalyzer2(QWidget*);
~GLAnalyzer2();
void analyze(const Scope&);
void paused();
@ -68,4 +74,4 @@ class GLAnalyzer2 : public Analyzer::Base3D {
};
#endif
#endif
#endif // ANALYZERS_GLANALYZER2_H_

View File

@ -1,19 +1,25 @@
/***************************************************************************
glanalyzer3.cpp - Bouncing Ballzz
-------------------
begin : Feb 19 2004
copyright : (C) 2004 by Enrico Ros
email : eros.kde@email.it
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Enrico Ros <eros.kde@email.it>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Enrico Ros <eros.kde@email.it> 2004
*/
#include <config.h>
@ -40,16 +46,8 @@ class Ball {
vx(0.0),
vy(0.0),
vz(0.0),
mass(0.01 + drand48() / 10.0)
//,color( (float[3]) { 0.0, drand48()*0.5, 0.7 + drand48() * 0.3 } )
{
// this is because GCC < 3.3 can't compile the above line, we aren't sure
// why though
color[0] = 0.0;
color[1] = drand48() * 0.5;
color[2] = 0.7 + drand48() * 0.3;
};
mass(0.01 + drand48() / 10.0),
color((float[3]) { 0.0, drand48()*0.5, 0.7 + drand48() * 0.3 }) {}
float x, y, z, vx, vy, vz, mass;
float color[3];
@ -70,8 +68,8 @@ class Ball {
class Paddle {
public:
Paddle(float xPos)
: onLeft(xPos < 0), mass(1.0), X(xPos), x(xPos), vx(0.0) {};
explicit Paddle(float xPos)
: onLeft(xPos < 0), mass(1.0), X(xPos), x(xPos), vx(0.0) {}
void updatePhysics(float dT) {
x += vx * dT; // posision
@ -165,7 +163,7 @@ void GLAnalyzer3::resizeGL(int w, int h) {
glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 4.5f);
// Get the aspect ratio of the screen to draw 'circular' particles
float ratio = (float)w / (float)h;
float ratio = static_cast<float>(w) / static_cast<float>(h);
if (ratio >= 1.0) {
unitX = 0.34 / ratio;
unitY = 0.34;
@ -177,7 +175,7 @@ void GLAnalyzer3::resizeGL(int w, int h) {
// Get current timestamp.
timeval tv;
gettimeofday(&tv, nullptr);
show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
show.timeStamp = static_cast<double>(tv.tv_sec) + static_cast<double>(tv.tv_usec) / 1000000.0;
}
void GLAnalyzer3::paused() { analyze(Scope()); }
@ -186,7 +184,7 @@ void GLAnalyzer3::analyze(const Scope& s) {
// compute the dTime since the last call
timeval tv;
gettimeofday(&tv, nullptr);
double currentTime = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
double currentTime = static_cast<double>(tv.tv_sec) + static_cast<double>(tv.tv_usec) / 1000000.0;
show.dT = currentTime - show.timeStamp;
show.timeStamp = currentTime;
@ -200,7 +198,7 @@ void GLAnalyzer3::analyze(const Scope& s) {
currentEnergy += value;
if (value > maxValue) maxValue = value;
}
currentEnergy *= 100.0 / (float)bands;
currentEnergy *= 100.0 / static_cast<float>(bands);
// emulate a peak detector: currentEnergy -> peakEnergy (3tau = 30 seconds)
show.peakEnergy = 1.0 + (show.peakEnergy - 1.0) * exp(-show.dT / 10.0);
if (currentEnergy > show.peakEnergy) show.peakEnergy = currentEnergy;
@ -210,8 +208,9 @@ void GLAnalyzer3::analyze(const Scope& s) {
currentEnergy /= show.peakEnergy;
frame.dEnergy = currentEnergy - frame.energy;
frame.energy = currentEnergy;
} else
} else {
frame.silence = true;
}
// update the frame
updateGL();
@ -259,8 +258,10 @@ void GLAnalyzer3::paintGL() {
if (ballTexture) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ballTexture);
} else
} else {
glDisable(GL_TEXTURE_2D);
}
glEnable(GL_BLEND);
Ball* ball = balls.first();
for (; ball; ball = balls.next()) {

View File

@ -1,25 +1,31 @@
/***************************************************************************
glanalyzer3.h - description
-------------------
begin : Feb 16 2004
copyright : (C) 2004 by Enrico Ros
email : eros.kde@email.it
***************************************************************************/
/* This file is part of Clementine.
Copyright 2004, Enrico Ros <eros.kde@email.it>
Copyright 2009, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Enrico Ros <eros.kde@email.it> 2004
*/
#include <config.h>
#ifdef HAVE_QGLWIDGET
#ifndef GLBOUNCER_H
#define GLBOUNCER_H
#ifndef ANALYZERS_GLANALYZER3_H_
#define ANALYZERS_GLANALYZER3_H_
#include "analyzerbase.h"
#include <qstring.h>
@ -31,7 +37,7 @@ class Paddle;
class GLAnalyzer3 : public Analyzer::Base3D {
public:
GLAnalyzer3(QWidget*);
explicit GLAnalyzer3(QWidget*);
~GLAnalyzer3();
void analyze(const Scope&);
void paused();
@ -76,4 +82,4 @@ class GLAnalyzer3 : public Analyzer::Base3D {
};
#endif
#endif
#endif // ANALYZERS_GLANALYZER3_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011-2012, 2014, David Sansome <me@davidsansome.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -71,7 +74,7 @@ void NyanCatAnalyzer::resizeEvent(QResizeEvent* e) {
buffer_[1] = QPixmap();
available_rainbow_width_ = width() - kCatWidth + kRainbowOverlap;
px_per_frame_ = float(available_rainbow_width_) / (kHistorySize - 1) + 1;
px_per_frame_ = static_cast<float>(available_rainbow_width_) / (kHistorySize - 1) + 1;
x_offset_ = px_per_frame_ * (kHistorySize - 1) - available_rainbow_width_;
}
@ -109,11 +112,11 @@ void NyanCatAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s,
QPointF* dest = polyline;
float* source = history_;
const float top_of_cat = float(height()) / 2 - float(kCatHeight) / 2;
const float top_of_cat = static_cast<float>(height()) / 2 - static_cast<float>(kCatHeight) / 2;
for (int band = 0; band < kRainbowBands; ++band) {
// Calculate the Y position of this band.
const float y =
float(kCatHeight) / (kRainbowBands + 1) * (band + 0.5) + top_of_cat;
static_cast<float>(kCatHeight) / (kRainbowBands + 1) * (band + 0.5) + top_of_cat;
// Add each point in the line.
for (int x = 0; x < kHistorySize; ++x) {

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, Tyler Rhodes <tyler.s.rhodes@gmail.com>
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2011, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NYANCATANALYZER_H
#define NYANCATANALYZER_H
#ifndef ANALYZERS_NYANCATANALYZER_H_
#define ANALYZERS_NYANCATANALYZER_H_
#include "analyzerbase.h"
@ -102,4 +105,4 @@ class NyanCatAnalyzer : public Analyzer::Base {
QBrush background_brush_;
};
#endif // NYANCATANALYZER_H
#endif // ANALYZERS_NYANCATANALYZER_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2014, Alibek Omarov <a1ba.omarov@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -71,7 +74,7 @@ void RainbowDashAnalyzer::resizeEvent(QResizeEvent* e) {
buffer_[1] = QPixmap();
available_rainbow_width_ = width() - kDashWidth + kRainbowOverlap;
px_per_frame_ = float(available_rainbow_width_) / (kHistorySize - 1) + 1;
px_per_frame_ = static_cast<float>(available_rainbow_width_) / (kHistorySize - 1) + 1;
x_offset_ = px_per_frame_ * (kHistorySize - 1) - available_rainbow_width_;
}
@ -108,11 +111,11 @@ void RainbowDashAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s,
QPointF* dest = polyline;
float* source = history_;
const float top_of_Dash = float(height()) / 2 - float(kRainbowHeight) / 2;
const float top_of_Dash = static_cast<float>(height()) / 2 - static_cast<float>(kRainbowHeight) / 2;
for (int band = 0; band < kRainbowBands; ++band) {
// Calculate the Y position of this band.
const float y =
float(kRainbowHeight) / (kRainbowBands + 1) * (band + 0.5) +
static_cast<float>(kRainbowHeight) / (kRainbowBands + 1) * (band + 0.5) +
top_of_Dash;
// Add each point in the line.

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2014, Alibek Omarov <a1ba.omarov@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RAINBOWDASHANALYZER_H
#define RAINBOWDASHANALYZER_H
#ifndef ANALYZERS_RAINBOWDASHANALYZER_H_
#define ANALYZERS_RAINBOWDASHANALYZER_H_
#include "analyzerbase.h"
@ -103,4 +105,4 @@ class RainbowDashAnalyzer : public Analyzer::Base {
QBrush background_brush_;
};
#endif // RAINBOWDASHANALYZER_H
#endif // ANALYZERS_RAINBOWDASHANALYZER_H_

View File

@ -1,15 +1,26 @@
//
//
// C++ Implementation: Sonogram
//
// Description:
//
//
// Author: Melchior FRANZ <mfranz@kde.org>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
/* This file is part of Clementine.
Copyright 2004, Melchior FRANZ <mfranz@kde.org>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Melchior FRANZ <mfranz@kde.org> 2004
*/
#include "sonogram.h"
@ -53,9 +64,9 @@ void Sonogram::analyze(QPainter& p, const Scope& s, bool new_frame) {
if (it >= end || *it < .005)
c = palette().color(QPalette::Background);
else if (*it < .05)
c.setHsv(95, 255, 255 - int(*it * 4000.0));
c.setHsv(95, 255, 255 - static_cast<int>(*it * 4000.0));
else if (*it < 1.0)
c.setHsv(95 - int(*it * 90.0), 255, 255);
c.setHsv(95 - static_cast<int>(*it * 90.0), 255, 255);
else
c = Qt::red;

View File

@ -1,18 +1,28 @@
//
//
// C++ Interface: Sonogram
//
// Description:
//
//
// Author: Melchior FRANZ <mfranz@kde.org>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//
/* This file is part of Clementine.
Copyright 2004, Melchior FRANZ <mfranz@kde.org>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
#ifndef SONOGRAM_H
#define SONOGRAM_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Melchior FRANZ <mfranz@kde.org> 2004
*/
#ifndef ANALYZERS_SONOGRAM_H_
#define ANALYZERS_SONOGRAM_H_
#include "analyzerbase.h"
@ -37,4 +47,4 @@ class Sonogram : public Analyzer::Base {
QPixmap canvas_;
};
#endif
#endif // ANALYZERS_SONOGRAM_H_

View File

@ -1,11 +1,28 @@
//
// Amarok BarAnalyzer 3 - Jet Turbine: Symmetric version of analyzer 1
//
// Author: Stanislav Karchebny <berkus@users.sf.net>, (C) 2003
// Max Howell (I modified it to use boom analyzer code)
//
// Copyright: like rest of Amarok
//
/* This file is part of Clementine.
Copyright 2003, Stanislav Karchebny <berkus@users.sf.net>
Copyright 2003, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Stanislav Karchebny <berkus@users.sf.net> 2003
* Original Author: Max Howell <max.howell@methylblue.com> 2003
*/
#include <cmath>
#include <QPainter>
@ -41,8 +58,9 @@ void TurbineAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
if (h > peak_height[i]) {
peak_height[i] = h;
peak_speed[i] = 0.01;
} else
} else {
goto peak_handling;
}
} else {
if (bar_height[i] > 0.0) {
bar_height[i] -= K_barHeight; // 1.4
@ -60,15 +78,16 @@ void TurbineAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
}
}
y = hd2 - uint(bar_height[i]);
y = hd2 - static_cast<uint>(bar_height[i]);
canvas_painter.drawPixmap(x + 1, y, barPixmap, 0, y, -1, -1);
canvas_painter.drawPixmap(x + 1, hd2, barPixmap, 0, int(bar_height[i]), -1,
-1);
canvas_painter.drawPixmap(x + 1, hd2, barPixmap, 0,
static_cast<int>(bar_height[i]),
-1, -1);
canvas_painter.setPen(palette().color(QPalette::Highlight));
if (bar_height[i] > 0)
canvas_painter.drawRect(x, y, COLUMN_WIDTH - 1,
(int)bar_height[i] * 2 - 1);
static_cast<int>(bar_height[i]) * 2 - 1);
const uint x2 = x + COLUMN_WIDTH - 1;
canvas_painter.setPen(palette().color(QPalette::Base));

View File

@ -1,13 +1,28 @@
//
// Amarok BarAnalyzer 3 - Jet Turbine: Symmetric version of analyzer 1
//
// Author: Stanislav Karchebny <berkus@users.sf.net>, (C) 2003
//
// Copyright: like rest of Amarok
//
/* This file is part of Clementine.
Copyright 2003, Stanislav Karchebny <berkus@users.sf.net>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
#ifndef ANALYZER_TURBINE_H
#define ANALYZER_TURBINE_H
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
/* Original Author: Stanislav Karchebny <berkus@users.sf.net> 2003
*/
#ifndef ANALYZERS_TURBINE_H_
#define ANALYZERS_TURBINE_H_
#include "boomanalyzer.h"
@ -21,4 +36,4 @@ class TurbineAnalyzer : public BoomAnalyzer {
static const char* kName;
};
#endif
#endif // ANALYZERS_TURBINE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,15 +17,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPEARANCE_H
#define APPEARANCE_H
#ifndef CORE_APPEARANCE_H_
#define CORE_APPEARANCE_H_
#include <QColor>
#include <QPalette>
class Appearance : public QObject {
public:
Appearance(QObject* parent = nullptr);
explicit Appearance(QObject* parent = nullptr);
// Load the user preferred theme, which could the default system theme or a
// custom set of colors that user has chosen
void LoadUserTheme();
@ -42,4 +44,4 @@ class Appearance : public QObject {
QColor background_color_;
};
#endif // APPEARANCE_H
#endif // CORE_APPEARANCE_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine.
Copyright 2012-2013, Andreas <asfa194@gmail.com>
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, Marti Raudsepp <marti@juffo.org>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012-2013, Andreas <asfa194@gmail.com>
Copyright 2012-2013, David Sansome <me@davidsansome.com>
Copyright 2013, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +19,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPLICATION_H
#define APPLICATION_H
#ifndef CORE_APPLICATION_H_
#define CORE_APPLICATION_H_
#include "ui/settingsdialog.h"
@ -54,7 +58,7 @@ class Application : public QObject {
public:
static bool kIsPortable;
Application(QObject* parent = nullptr);
explicit Application(QObject* parent = nullptr);
~Application();
const QString& language_name() const { return language_name_; }
@ -136,4 +140,4 @@ signals:
QList<QThread*> threads_;
};
#endif // APPLICATION_H
#endif // CORE_APPLICATION_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2010-2011, 2013, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "backgroundstreams.h"
#include <QAction>

View File

@ -1,5 +1,24 @@
#ifndef BACKGROUNDSTREAMS_H
#define BACKGROUNDSTREAMS_H
/* This file is part of Clementine.
Copyright 2010-2011, 2013, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_BACKGROUNDSTREAMS_H_
#define CORE_BACKGROUNDSTREAMS_H_
#include <QMap>
#include <QObject>
@ -12,6 +31,7 @@ class QAction;
class BackgroundStreams : public QObject {
Q_OBJECT
public:
explicit BackgroundStreams(EngineBase* engine, QObject* parent = nullptr);
~BackgroundStreams();
@ -65,4 +85,4 @@ signals:
static const char* kEnterpriseUrl;
};
#endif
#endif // CORE_BACKGROUNDSTREAMS_H_

View File

@ -1,5 +1,23 @@
#ifndef BOUNDFUTUREWATCHER_H
#define BOUNDFUTUREWATCHER_H
/* This file is part of Clementine.
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_BOUNDFUTUREWATCHER_H_
#define CORE_BOUNDFUTUREWATCHER_H_
#include <QFutureWatcher>
@ -8,7 +26,7 @@
template <typename T, typename D>
class BoundFutureWatcher : public QFutureWatcher<T>, boost::noncopyable {
public:
BoundFutureWatcher(const D& data, QObject* parent = nullptr)
explicit BoundFutureWatcher(const D& data, QObject* parent = nullptr)
: QFutureWatcher<T>(parent), data_(data) {}
~BoundFutureWatcher() {}
@ -19,4 +37,4 @@ class BoundFutureWatcher : public QFutureWatcher<T>, boost::noncopyable {
D data_;
};
#endif
#endif // CORE_BOUNDFUTUREWATCHER_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2011, 2013, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CACHEDLIST_H
#define CACHEDLIST_H
#ifndef CORE_CACHEDLIST_H_
#define CORE_CACHEDLIST_H_
#include <QDateTime>
#include <QSettings>
@ -98,4 +100,4 @@ class CachedList {
ListType data_;
};
#endif // CACHEDLIST_H
#endif // CORE_CACHEDLIST_H_

View File

@ -1,5 +1,11 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, David Sansome <me@davidsansome.com>
Copyright 2010-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2013, Kevin Cox <kevincox.ca@gmail.com>
Copyright 2013, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>
Copyright 2014, Alexander Bikadorov <abiku@cs.tu-berlin.de>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,11 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2011, John Maguire <john.maguire@gmail.com>
Copyright 2011, Andrea Decorte <adecorte@gmail.com>
Copyright 2013, Kevin Cox <kevincox.ca@gmail.com>
Copyright 2013, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>
Copyright 2014, Alexander Bikadorov <abiku@cs.tu-berlin.de>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +21,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMANDLINEOPTIONS_H
#define COMMANDLINEOPTIONS_H
#ifndef CORE_COMMANDLINEOPTIONS_H_
#define CORE_COMMANDLINEOPTIONS_H_
#include <QList>
#include <QUrl>
@ -27,7 +33,7 @@ class CommandlineOptions {
friend QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
public:
CommandlineOptions(int argc = 0, char* *argv = nullptr);
explicit CommandlineOptions(int argc = 0, char* *argv = nullptr);
static const char* kHelpText;
static const char* kVersionText;
@ -114,4 +120,4 @@ class CommandlineOptions {
QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a);
QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
#endif // COMMANDLINEOPTIONS_H
#endif // CORE_COMMANDLINEOPTIONS_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, David Sansome <davidsansome@gmail.com>
Copyright 2011, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CRASHREPORTING_H
#define CRASHREPORTING_H
#ifndef CORE_CRASHREPORTING_H_
#define CORE_CRASHREPORTING_H_
#include <memory>
@ -70,7 +72,7 @@ class CrashSender : public QObject {
Q_OBJECT
public:
CrashSender(const QString& path);
explicit CrashSender(const QString& path);
// Returns false if the user doesn't want to send the crash report (caller
// should exit), or true if he does (caller should start the Qt event loop).
@ -90,4 +92,4 @@ class CrashSender : public QObject {
QProgressDialog* progress_;
};
#endif // CRASHREPORTING_H
#endif // CORE_CRASHREPORTING_H_

View File

@ -1,5 +1,13 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2013, David Sansome <me@davidsansome.com>
Copyright 2010-2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2010, 2012-2014, John Maguire <john.maguire@gmail.com>
Copyright 2012-2013, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2012, Marti Raudsepp <marti@juffo.org>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013, Uwe Klotz <uwe.klotz@gmail.com>
Copyright 2014, Krzysztof A. Sobiecki <sobkas@gmail.com>
Copyright 2014, Chocobozzz <djidane14ff@hotmail.fr>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,11 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, 2012-2013, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2012, Marti Raudsepp <marti@juffo.org>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013, Uwe Klotz <uwe.klotz@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +21,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DATABASE_H
#define DATABASE_H
#ifndef CORE_DATABASE_H_
#define CORE_DATABASE_H_
#include <QMap>
#include <QMutex>
@ -30,7 +36,6 @@
#include "gtest/gtest_prod.h"
extern "C" {
struct sqlite3_tokenizer;
struct sqlite3_tokenizer_cursor;
struct sqlite3_tokenizer_module;
@ -175,7 +180,7 @@ signals:
class MemoryDatabase : public Database {
public:
MemoryDatabase(Application* app, QObject* parent = nullptr)
explicit MemoryDatabase(Application* app, QObject* parent = nullptr)
: Database(app, parent, ":memory:") {}
~MemoryDatabase() {
// Make sure Qt doesn't reuse the same database
@ -183,4 +188,4 @@ class MemoryDatabase : public Database {
}
};
#endif // DATABASE_H
#endif // CORE_DATABASE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DELETEFILES_H
#define DELETEFILES_H
#ifndef CORE_DELETEFILES_H_
#define CORE_DELETEFILES_H_
#include <memory>
@ -61,4 +63,4 @@ signals:
SongList songs_with_errors_;
};
#endif // DELETEFILES_H
#endif // CORE_DELETEFILES_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2011, Jonathan Anderson <jontis@gmail.com>
Copyright 2011, Angus Gratton <gus@projectgus.com>
Copyright 2014, vkrishtal <krishtalhost@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,14 +17,14 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILESYSTEMMUSICSTORAGE_H
#define FILESYSTEMMUSICSTORAGE_H
#ifndef CORE_FILESYSTEMMUSICSTORAGE_H_
#define CORE_FILESYSTEMMUSICSTORAGE_H_
#include "musicstorage.h"
class FilesystemMusicStorage : public virtual MusicStorage {
public:
FilesystemMusicStorage(const QString& root);
explicit FilesystemMusicStorage(const QString& root);
~FilesystemMusicStorage() {}
QString LocalPath() const { return root_; }
@ -34,4 +36,4 @@ class FilesystemMusicStorage : public virtual MusicStorage {
QString root_;
};
#endif // FILESYSTEMMUSICSTORAGE_H
#endif // CORE_FILESYSTEMMUSICSTORAGE_H_

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,15 +17,15 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILESYSTEMWATCHERINTERFACE_H
#define FILESYSTEMWATCHERINTERFACE_H
#ifndef CORE_FILESYSTEMWATCHERINTERFACE_H_
#define CORE_FILESYSTEMWATCHERINTERFACE_H_
#include <QObject>
class FileSystemWatcherInterface : public QObject {
Q_OBJECT
public:
FileSystemWatcherInterface(QObject* parent = nullptr);
explicit FileSystemWatcherInterface(QObject* parent = nullptr);
virtual void Init() {}
virtual void AddPath(const QString& path) = 0;
virtual void RemovePath(const QString& path) = 0;
@ -35,4 +37,4 @@ signals:
void PathChanged(const QString& path);
};
#endif
#endif // CORE_FILESYSTEMWATCHERINTERFACE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBALSHORTCUTBACKEND_H
#define GLOBALSHORTCUTBACKEND_H
#ifndef CORE_GLOBALSHORTCUTBACKEND_H_
#define CORE_GLOBALSHORTCUTBACKEND_H_
#include <QObject>
@ -26,7 +28,7 @@ class GlobalShortcutBackend : public QObject {
Q_OBJECT
public:
GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
explicit GlobalShortcutBackend(GlobalShortcuts* parent = nullptr);
virtual ~GlobalShortcutBackend() {}
bool is_active() const { return active_; }
@ -45,4 +47,4 @@ signals:
bool active_;
};
#endif // GLOBALSHORTCUTBACKEND_H
#endif // CORE_GLOBALSHORTCUTBACKEND_H_

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, Paweł Bara <keirangtp@gmail.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Alexander Bikadorov <abiku@cs.tu-berlin.de>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2010, Paweł Bara <keirangtp@gmail.com>
Copyright 2011, Andrea Decorte <adecorte@gmail.com>
Copyright 2013, Alexander Bikadorov <abiku@cs.tu-berlin.de>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +20,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBALSHORTCUTS_H
#define GLOBALSHORTCUTS_H
#ifndef CORE_GLOBALSHORTCUTS_H_
#define CORE_GLOBALSHORTCUTS_H_
#include <QKeySequence>
#include <QMap>
@ -33,7 +38,7 @@ class GlobalShortcuts : public QWidget {
Q_OBJECT
public:
GlobalShortcuts(QWidget* parent = nullptr);
explicit GlobalShortcuts(QWidget* parent = nullptr);
static const char* kSettingsGroup;
@ -96,4 +101,4 @@ signals:
QSignalMapper* rating_signals_mapper_;
};
#endif
#endif // CORE_GLOBALSHORTCUTS_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GNOMEGLOBALSHORTCUTBACKEND_H
#define GNOMEGLOBALSHORTCUTBACKEND_H
#ifndef CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
#define CORE_GNOMEGLOBALSHORTCUTBACKEND_H_
#include "globalshortcutbackend.h"
@ -28,7 +30,7 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
Q_OBJECT
public:
GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
explicit GnomeGlobalShortcutBackend(GlobalShortcuts* parent);
static const char* kGsdService;
static const char* kGsdPath;
@ -49,4 +51,4 @@ class GnomeGlobalShortcutBackend : public GlobalShortcutBackend {
bool is_connected_;
};
#endif // GNOMEGLOBALSHORTCUTBACKEND_H
#endif // CORE_GNOMEGLOBALSHORTCUTBACKEND_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2011, David Sansome <davidsansome@gmail.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#import <AppKit/NSApplication.h>
#include "config.h"

View File

@ -1,3 +1,21 @@
/* This file is part of Clementine.
Copyright 2010-2012, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAC_STARTUP_H
#define MAC_STARTUP_H
@ -32,4 +50,4 @@ void EnableFullScreen(const QWidget& main_window);
} // namespace mac
#endif
#endif // MAC_STARTUP_H

View File

@ -1,5 +1,6 @@
/* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACFSLISTENER_H
#define MACFSLISTENER_H
#ifndef CORE_MACFSLISTENER_H_
#define CORE_MACFSLISTENER_H_
#include <CoreServices/CoreServices.h>
@ -57,4 +59,4 @@ signals:
QTimer update_timer_;
};
#endif
#endif // CORE_MACFSLISTENER_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACGLOBALSHORTCUTBACKEND_H
#define MACGLOBALSHORTCUTBACKEND_H
#ifndef CORE_MACGLOBALSHORTCUTBACKEND_H_
#define CORE_MACGLOBALSHORTCUTBACKEND_H_
#include <memory>
@ -32,7 +34,7 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
Q_OBJECT
public:
MacGlobalShortcutBackend(GlobalShortcuts* parent);
explicit MacGlobalShortcutBackend(GlobalShortcuts* parent);
virtual ~MacGlobalShortcutBackend();
bool IsAccessibilityEnabled() const;
@ -53,4 +55,4 @@ class MacGlobalShortcutBackend : public GlobalShortcutBackend {
std::unique_ptr<MacGlobalShortcutBackendPrivate> p_;
};
#endif // MACGLOBALSHORTCUTBACKEND_H
#endif // CORE_MACGLOBALSHORTCUTBACKEND_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2011, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -44,7 +47,8 @@ std::size_t hash_value(const QModelIndex& index) { return qHash(index); }
namespace {
struct Mapping {
Mapping(const QModelIndex& _source_index) : source_index(_source_index) {}
explicit Mapping(const QModelIndex& _source_index) :
source_index(_source_index) {}
QModelIndex source_index;
};
@ -190,9 +194,9 @@ void MergedProxyModel::SourceModelReset() {
void MergedProxyModel::SubModelReset() {
QAbstractItemModel* submodel = static_cast<QAbstractItemModel*>(sender());
// TODO: When we require Qt 4.6, use beginResetModel() and endResetModel()
// in LibraryModel and catch those here - that will let us do away with this
// std::numeric_limits<int>::max() hack.
// TODO(David Sansome): When we require Qt 4.6, use beginResetModel() and
// endResetModel() in LibraryModel and catch those here - that will let
// us do away with this std::numeric_limits<int>::max() hack.
// Remove all the children of the item that got deleted
QModelIndex source_parent = merge_points_.value(submodel);

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MERGEDPROXYMODEL_H
#define MERGEDPROXYMODEL_H
#ifndef CORE_MERGEDPROXYMODEL_H_
#define CORE_MERGEDPROXYMODEL_H_
#include <memory>
@ -30,7 +32,7 @@ class MergedProxyModel : public QAbstractProxyModel {
Q_OBJECT
public:
MergedProxyModel(QObject* parent = nullptr);
explicit MergedProxyModel(QObject* parent = nullptr);
~MergedProxyModel();
// Make another model appear as a child of the given item in the source model.
@ -107,4 +109,4 @@ signals:
std::unique_ptr<MergedProxyModelPrivate> p_;
};
#endif // MERGEDPROXYMODEL_H
#endif // CORE_MERGEDPROXYMODEL_H_

View File

@ -1,3 +1,25 @@
/* This file is part of Clementine.
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013, pie.or.paj <pie.or.paj@gmail.com>
Copyright 2014, David Sansome <me@davidsansome.com>
Copyright 2014, Maltsev Vlad <shedwardx@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "metatypes.h"
#include <QMetaType>

View File

@ -1,6 +1,24 @@
#ifndef METATYPES_H
#define METATYPES_H
/* This file is part of Clementine.
Copyright 2012, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_METATYPES_H_
#define CORE_METATYPES_H_
void RegisterMetaTypes();
#endif
#endif // CORE_METATYPES_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MIMEDATA_H
#define MIMEDATA_H
#ifndef CORE_MIMEDATA_H_
#define CORE_MIMEDATA_H_
#include <QMimeData>
@ -72,4 +75,4 @@ class MimeData : public QMimeData {
}
};
#endif // MIMEDATA_H
#endif // CORE_MIMEDATA_H_

View File

@ -1,5 +1,23 @@
#ifndef MODELFUTUREWATCHER_H
#define MODELFUTUREWATCHER_H
/* This file is part of Clementine.
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_MODELFUTUREWATCHER_H_
#define CORE_MODELFUTUREWATCHER_H_
#include <QFutureWatcher>
#include <QPersistentModelIndex>
@ -7,7 +25,7 @@
template <typename T>
class ModelFutureWatcher : public QFutureWatcher<T> {
public:
ModelFutureWatcher(const QModelIndex& index, QObject* parent = nullptr)
explicit ModelFutureWatcher(const QModelIndex& index, QObject* parent = nullptr)
: QFutureWatcher<T>(parent), index_(index) {}
~ModelFutureWatcher() {}
@ -18,4 +36,4 @@ class ModelFutureWatcher : public QFutureWatcher<T> {
QPersistentModelIndex index_;
};
#endif
#endif // CORE_MODELFUTUREWATCHER_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS_H
#define MPRIS_H
#ifndef CORE_MPRIS_H_
#define CORE_MPRIS_H_
#include <QObject>
@ -31,7 +33,7 @@ class Mpris : public QObject {
Q_OBJECT
public:
Mpris(Application* app, QObject* parent = nullptr);
explicit Mpris(Application* app, QObject* parent = nullptr);
signals:
void RaiseMainWindow();
@ -43,4 +45,4 @@ signals:
} // namespace mpris
#endif // MPRIS_H
#endif // CORE_MPRIS_H_

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2013, Uwe Klotz <uwe.klotz@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS1_H
#define MPRIS1_H
#ifndef CORE_MPRIS1_H_
#define CORE_MPRIS1_H_
#include "core/player.h"
@ -102,7 +104,7 @@ class Mpris1Root : public QObject {
Q_OBJECT
public:
Mpris1Root(Application* app, QObject* parent = nullptr);
explicit Mpris1Root(Application* app, QObject* parent = nullptr);
QString Identity();
void Quit();
@ -116,7 +118,7 @@ class Mpris1Player : public QObject {
Q_OBJECT
public:
Mpris1Player(Application* app, QObject* parent = nullptr);
explicit Mpris1Player(Application* app, QObject* parent = nullptr);
void Pause();
void Stop();
@ -171,7 +173,7 @@ class Mpris1TrackList : public QObject {
Q_OBJECT
public:
Mpris1TrackList(Application* app, QObject* parent = nullptr);
explicit Mpris1TrackList(Application* app, QObject* parent = nullptr);
int AddTrack(const QString&, bool);
void DelTrack(int index);
@ -196,4 +198,4 @@ signals:
} // namespace mpris
#endif // MPRIS1_H
#endif // CORE_MPRIS1_H_

View File

@ -1,5 +1,11 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2010-2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2013, TTSDA <ttsda@ttsda.cc>
Copyright 2013, Aggelos Biboudis <biboudis@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -169,7 +175,7 @@ void Mpris2::EmitNotification(const QString& name) {
if (value.isValid()) EmitNotification(name, value);
}
//------------------Root Interface--------------------------//
// ------------------Root Interface--------------- //
bool Mpris2::CanQuit() const { return true; }
@ -345,7 +351,7 @@ void Mpris2::ArtLoaded(const Song& song, const QString& art_uri) {
double Mpris2::Volume() const {
if (mpris1_->player()) {
return double(mpris1_->player()->VolumeGet()) / 100;
return static_cast<double>(mpris1_->player()->VolumeGet()) / 100;
} else {
return 0.0;
}
@ -458,28 +464,28 @@ void Mpris2::OpenUri(const QString& uri) {
}
TrackIds Mpris2::Tracks() const {
// TODO
// TODO(John Maguire): ?
return TrackIds();
}
bool Mpris2::CanEditTracks() const { return false; }
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds& tracks) const {
// TODO
// TODO(John Maguire): ?
return TrackMetadata();
}
void Mpris2::AddTrack(const QString& uri, const QDBusObjectPath& afterTrack,
bool setAsCurrent) {
// TODO
// TODO(John Maguire): ?
}
void Mpris2::RemoveTrack(const QDBusObjectPath& trackId) {
// TODO
// TODO(John Maguire): ?
}
void Mpris2::GoTo(const QDBusObjectPath& trackId) {
// TODO
// TODO(John Maguire): ?
}
quint32 Mpris2::PlaylistCount() const {
@ -529,7 +535,7 @@ void Mpris2::ActivatePlaylist(const QDBusObjectPath& playlist_id) {
app_->player()->Next();
}
// TODO: Support sort orders.
// TODO(John Maguire): Support sort orders.
MprisPlaylistList Mpris2::GetPlaylists(quint32 index, quint32 max_count,
const QString& order,
bool reverse_order) {

View File

@ -1,5 +1,9 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2010-2012, David Sansome <me@davidsansome.com>
Copyright 2011-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2013, Aggelos Biboudis <biboudis@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +19,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS2_H
#define MPRIS2_H
#ifndef CORE_MPRIS2_H_
#define CORE_MPRIS2_H_
#include "playlist/playlistitem.h"
@ -228,4 +232,4 @@ signals:
} // namespace mpris
#endif
#endif // CORE_MPRIS2_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, Paweł Bara <keirangtp@gmail.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPRIS_COMMON_H
#define MPRIS_COMMON_H
#ifndef CORE_MPRIS_COMMON_H_
#define CORE_MPRIS_COMMON_H_
#include <QDateTime>
#include <QObject>
@ -58,4 +61,4 @@ inline QString AsMPRISDateTimeType(uint time) {
} // namespace mpris
#endif // MPRIS_COMMON_H
#endif // CORE_MPRIS_COMMON_H_

View File

@ -1,3 +1,22 @@
/* This file is part of Clementine.
Copyright 2011-2012, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "multisortfilterproxy.h"
#include "core/logging.h"

View File

@ -1,11 +1,30 @@
#ifndef MULTISORTFILTERPROXY_H
#define MULTISORTFILTERPROXY_H
/* This file is part of Clementine.
Copyright 2011, David Sansome <me@davidsansome.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_MULTISORTFILTERPROXY_H_
#define CORE_MULTISORTFILTERPROXY_H_
#include <QSortFilterProxyModel>
class MultiSortFilterProxy : public QSortFilterProxyModel {
public:
MultiSortFilterProxy(QObject* parent = nullptr);
explicit MultiSortFilterProxy(QObject* parent = nullptr);
void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder);
@ -19,4 +38,4 @@ class MultiSortFilterProxy : public QSortFilterProxyModel {
QList<SortSpec> sorting_;
};
#endif // MULTISORTFILTERPROXY_H
#endif // CORE_MULTISORTFILTERPROXY_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUSICSTORAGE_H
#define MUSICSTORAGE_H
#ifndef CORE_MUSICSTORAGE_H_
#define CORE_MUSICSTORAGE_H_
#include "song.h"
@ -51,6 +53,7 @@ class MusicStorage {
QString destination_;
Song metadata_;
bool overwrite_;
bool mark_as_listened_;
bool remove_original_;
ProgressFunction progress_;
};
@ -85,4 +88,4 @@ class MusicStorage {
Q_DECLARE_METATYPE(MusicStorage*);
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>);
#endif // MUSICSTORAGE_H
#endif // CORE_MUSICSTORAGE_H_

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2013, David Sansome <me@davidsansome.com>
Copyright 2010-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, 2012, David Sansome <me@davidsansome.com>
Copyright 2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NETWORK_H
#define NETWORK_H
#ifndef CORE_NETWORK_H_
#define CORE_NETWORK_H_
#include <QAbstractNetworkCache>
#include <QMutex>
@ -27,7 +29,7 @@ class QNetworkDiskCache;
class ThreadSafeNetworkDiskCache : public QAbstractNetworkCache {
public:
ThreadSafeNetworkDiskCache(QObject* parent);
explicit ThreadSafeNetworkDiskCache(QObject* parent);
qint64 cacheSize() const;
QIODevice* data(const QUrl& url);
@ -48,7 +50,7 @@ class NetworkAccessManager : public QNetworkAccessManager {
Q_OBJECT
public:
NetworkAccessManager(QObject* parent = nullptr);
explicit NetworkAccessManager(QObject* parent = nullptr);
protected:
QNetworkReply* createRequest(Operation op, const QNetworkRequest& request,
@ -59,7 +61,7 @@ class RedirectFollower : public QObject {
Q_OBJECT
public:
RedirectFollower(QNetworkReply* first_reply, int max_redirects = 5);
explicit RedirectFollower(QNetworkReply* first_reply, int max_redirects = 5);
bool hit_redirect_limit() const { return redirects_remaining_ < 0; }
QNetworkReply* reply() const { return current_reply_; }
@ -104,9 +106,9 @@ class NetworkTimeouts : public QObject {
Q_OBJECT
public:
NetworkTimeouts(int timeout_msec, QObject* parent = nullptr);
explicit NetworkTimeouts(int timeout_msec, QObject* parent = nullptr);
// TODO: Template this to avoid code duplication.
// TODO(John Maguire): Template this to avoid code duplication.
void AddReply(QNetworkReply* reply);
void AddReply(RedirectFollower* reply);
void SetTimeout(int msec) { timeout_msec_ = msec; }
@ -124,4 +126,4 @@ class NetworkTimeouts : public QObject {
QMap<RedirectFollower*, int> redirect_timers_;
};
#endif // NETWORK_H
#endif // CORE_NETWORK_H_

View File

@ -1,3 +1,23 @@
/* This file is part of Clementine.
Copyright 2010-2011, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "networkproxyfactory.h"
#include "core/logging.h"

View File

@ -1,5 +1,24 @@
#ifndef NETWORKPROXYFACTORY_H
#define NETWORKPROXYFACTORY_H
/* This file is part of Clementine.
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine 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.
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_NETWORKPROXYFACTORY_H_
#define CORE_NETWORKPROXYFACTORY_H_
#include <QMutex>
#include <QNetworkProxyFactory>
@ -37,4 +56,4 @@ class NetworkProxyFactory : public QNetworkProxyFactory {
#endif
};
#endif // NETWORKPROXYFACTORY_H
#endif // CORE_NETWORKPROXYFACTORY_H_

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, David Sansome <me@davidsansome.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof A. Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -39,6 +42,7 @@ const int Organise::kTranscodeProgressInterval = 500;
Organise::Organise(TaskManager* task_manager,
std::shared_ptr<MusicStorage> destination,
const OrganiseFormat& format, bool copy, bool overwrite,
bool mark_as_listened,
const NewSongInfoList& songs_info, bool eject_after)
: thread_(nullptr),
task_manager_(task_manager),
@ -47,6 +51,7 @@ Organise::Organise(TaskManager* task_manager,
format_(format),
copy_(copy),
overwrite_(overwrite),
mark_as_listened_(mark_as_listened),
eject_after_(eject_after),
task_count_(songs_info.count()),
transcode_suffix_(1),
@ -69,8 +74,8 @@ void Organise::Start() {
thread_ = new QThread;
connect(thread_, SIGNAL(started()), SLOT(ProcessSomeFiles()));
connect(transcoder_, SIGNAL(JobComplete(QString, bool)),
SLOT(FileTranscoded(QString, bool)));
connect(transcoder_, SIGNAL(JobComplete(QString, QString, bool)),
SLOT(FileTranscoded(QString, QString, bool)));
moveToThread(thread_);
thread_->start();
@ -180,12 +185,17 @@ void Organise::ProcessSomeFiles() {
job.destination_ = task.song_info_.new_filename_;
job.metadata_ = song;
job.overwrite_ = overwrite_;
job.mark_as_listened_ = mark_as_listened_;
job.remove_original_ = !copy_;
job.progress_ = std::bind(&Organise::SetSongProgress, this, _1,
!task.transcoded_filename_.isEmpty());
if (!destination_->CopyToStorage(job)) {
files_with_errors_ << task.song_info_.song_.basefilename();
} else {
if (job.mark_as_listened_) {
emit FileCopied(job.metadata_.id());
}
}
// Clean up the temporary transcoded file
@ -264,13 +274,13 @@ void Organise::UpdateProgress() {
task_manager_->SetTaskProgress(task_id_, progress, total);
}
void Organise::FileTranscoded(const QString& filename, bool success) {
qLog(Info) << "File finished" << filename << success;
void Organise::FileTranscoded(const QString& input, const QString& output, bool success) {
qLog(Info) << "File finished" << input << success;
transcode_progress_timer_.stop();
Task task = tasks_transcoding_.take(filename);
Task task = tasks_transcoding_.take(input);
if (!success) {
files_with_errors_ << filename;
files_with_errors_ << input;
} else {
tasks_pending_ << task;
}

View File

@ -1,5 +1,8 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +18,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ORGANISE_H
#define ORGANISE_H
#ifndef CORE_ORGANISE_H_
#define CORE_ORGANISE_H_
#include <memory>
@ -45,7 +48,8 @@ class Organise : public QObject {
Organise(TaskManager* task_manager, std::shared_ptr<MusicStorage> destination,
const OrganiseFormat& format, bool copy, bool overwrite,
const NewSongInfoList& songs, bool eject_after);
bool mark_as_listened, const NewSongInfoList& songs,
bool eject_after);
static const int kBatchSize;
static const int kTranscodeProgressInterval;
@ -54,13 +58,14 @@ class Organise : public QObject {
signals:
void Finished(const QStringList& files_with_errors);
void FileCopied(int database_id);
protected:
void timerEvent(QTimerEvent* e);
private slots:
void ProcessSomeFiles();
void FileTranscoded(const QString& filename, bool success);
void FileTranscoded(const QString& input, const QString& output, bool success);
private:
void SetSongProgress(float progress, bool transcoded = false);
@ -90,6 +95,7 @@ signals:
const OrganiseFormat format_;
const bool copy_;
const bool overwrite_;
const bool mark_as_listened_;
const bool eject_after_;
int task_count_;
@ -109,4 +115,4 @@ signals:
QStringList files_with_errors_;
};
#endif // ORGANISE_H
#endif // CORE_ORGANISE_H_

View File

@ -1,5 +1,10 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010-2011, 2014, David Sansome <me@davidsansome.com>
Copyright 2011, Angus Gratton <gus@projectgus.com>
Copyright 2012, Mateusz Kowalczyk <mk440@bath.ac.uk>
Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -172,6 +177,8 @@ QString OrganiseFormat::ParseBlock(QString block, const Song& song,
QString OrganiseFormat::TagValue(const QString& tag, const Song& song) const {
QString value;
// TODO(sobkas): What about nice switch statement?
if (tag == "title")
value = song.title();
else if (tag == "album")

View File

@ -1,5 +1,7 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2010, 2014, David Sansome <me@davidsansome.com>
Copyright 2013-2014, John Maguire <john.maguire@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -15,8 +17,8 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SRC_CORE_ORGANISEFORMAT_H_
#define SRC_CORE_ORGANISEFORMAT_H_
#ifndef CORE_ORGANISEFORMAT_H_
#define CORE_ORGANISEFORMAT_H_
#include <QSyntaxHighlighter>
#include <QValidator>
@ -25,7 +27,7 @@
class OrganiseFormat {
public:
OrganiseFormat(const QString& format = QString());
explicit OrganiseFormat(const QString& format = QString());
static const char* kTagPattern;
static const char* kBlockPattern;
@ -80,4 +82,4 @@ class OrganiseFormat {
bool replace_the_;
};
#endif // SRC_CORE_ORGANISEFORMAT_H_
#endif // CORE_ORGANISEFORMAT_H_

View File

@ -1,5 +1,15 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Copyright 2009-2012, David Sansome <me@davidsansome.com>
Copyright 2010-2011, 2014, Arnaud Bienner <arnaud.bienner@gmail.com>
Copyright 2010-2012, 2014, John Maguire <john.maguire@gmail.com>
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
Copyright 2011, Andrea Decorte <adecorte@gmail.com>
Copyright 2012, Anand <anandtp@live.in>
Copyright 2012, Arash Abedinzadeh <arash.abedinzadeh@gmail.com>
Copyright 2013, Andreas <asfa194@gmail.com>
Copyright 2013, Kevin Cox <kevincox.ca@gmail.com>
Copyright 2014, Mark Furneaux <mark@romaco.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

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