Merge branch 'master' into grooveshark

This commit is contained in:
Arnaud Bienner 2011-09-02 00:35:40 +02:00
commit 99fdba877e
22 changed files with 715 additions and 251 deletions

View File

@ -239,7 +239,12 @@ void SpotifyClient::Login(const QString& username, const QString& password) {
sp_session_preferred_bitrate(session_, SP_BITRATE_320k);
sp_session_preferred_offline_bitrate(session_, SP_BITRATE_320k, false);
#if SPOTIFY_API_VERSION < 9
sp_session_login(session_, username.toUtf8().constData(), password.toUtf8().constData());
#else
sp_session_login(session_, username.toUtf8().constData(), password.toUtf8().constData(), true);
#endif
}
void SpotifyClient::SendLoginCompleted(bool success, const QString& error,

View File

@ -117,6 +117,7 @@ set(SOURCES
globalsearch/globalsearch.cpp
globalsearch/globalsearchitemdelegate.cpp
globalsearch/globalsearchpopup.cpp
globalsearch/globalsearchsortmodel.cpp
globalsearch/globalsearchwidget.cpp
globalsearch/librarysearchprovider.cpp
@ -358,6 +359,7 @@ set(HEADERS
globalsearch/librarysearchprovider.h
globalsearch/globalsearch.h
globalsearch/globalsearchpopup.h
globalsearch/globalsearchwidget.h
globalsearch/searchprovider.h
@ -524,6 +526,7 @@ set(UI
devices/deviceproperties.ui
globalsearch/globalsearchpopup.ui
globalsearch/globalsearchwidget.ui
internet/digitallyimportedsettingspage.ui
@ -702,6 +705,7 @@ if(APPLE)
list(APPEND HEADERS widgets/maclineedit.h)
list(APPEND SOURCES core/macglobalshortcutbackend.mm)
list(APPEND SOURCES devices/macdevicelister.mm)
list(APPEND SOURCES ui/globalshortcutgrabber.mm)
list(APPEND SOURCES ui/macscreensaver.cpp)
list(APPEND SOURCES ui/macsystemtrayicon.mm)
list(APPEND SOURCES widgets/maclineedit.mm)

View File

@ -60,6 +60,7 @@ GlobalShortcuts::GlobalShortcuts(QObject *parent)
AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode()));
AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode()));
AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling()));
AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch()));
AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0);
AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1);

View File

@ -73,6 +73,7 @@ signals:
void CycleShuffleMode();
void CycleRepeatMode();
void ToggleScrobbling();
void ShowGlobalSearch();
private:
void AddShortcut(const QString& id, const QString& name, const char* signal,

View File

@ -1,6 +1,8 @@
#ifndef MAC_STARTUP_H
#define MAC_STARTUP_H
#include <QKeySequence>
class MacGlobalShortcutBackend;
class QObject;

View File

@ -41,6 +41,7 @@
#include "globalshortcuts.h"
#include "mac_delegate.h"
#include "mac_startup.h"
#include "mac_utilities.h"
#include "macglobalshortcutbackend.h"
#include "utilities.h"
#include "core/logging.h"
@ -343,4 +344,105 @@ bool MigrateLegacyConfigFiles() {
return moved_dir;
}
static int MapFunctionKey(int keycode) {
switch (keycode) {
// Function keys
case NSInsertFunctionKey: return Qt::Key_Insert;
case NSDeleteFunctionKey: return Qt::Key_Delete;
case NSPauseFunctionKey: return Qt::Key_Pause;
case NSPrintFunctionKey: return Qt::Key_Print;
case NSSysReqFunctionKey: return Qt::Key_SysReq;
case NSHomeFunctionKey: return Qt::Key_Home;
case NSEndFunctionKey: return Qt::Key_End;
case NSLeftArrowFunctionKey: return Qt::Key_Left;
case NSUpArrowFunctionKey: return Qt::Key_Up;
case NSRightArrowFunctionKey: return Qt::Key_Right;
case NSDownArrowFunctionKey: return Qt::Key_Down;
case NSPageUpFunctionKey: return Qt::Key_PageUp;
case NSPageDownFunctionKey: return Qt::Key_PageDown;
case NSScrollLockFunctionKey: return Qt::Key_ScrollLock;
case NSF1FunctionKey: return Qt::Key_F1;
case NSF2FunctionKey: return Qt::Key_F2;
case NSF3FunctionKey: return Qt::Key_F3;
case NSF4FunctionKey: return Qt::Key_F4;
case NSF5FunctionKey: return Qt::Key_F5;
case NSF6FunctionKey: return Qt::Key_F6;
case NSF7FunctionKey: return Qt::Key_F7;
case NSF8FunctionKey: return Qt::Key_F8;
case NSF9FunctionKey: return Qt::Key_F9;
case NSF10FunctionKey: return Qt::Key_F10;
case NSF11FunctionKey: return Qt::Key_F11;
case NSF12FunctionKey: return Qt::Key_F12;
case NSF13FunctionKey: return Qt::Key_F13;
case NSF14FunctionKey: return Qt::Key_F14;
case NSF15FunctionKey: return Qt::Key_F15;
case NSF16FunctionKey: return Qt::Key_F16;
case NSF17FunctionKey: return Qt::Key_F17;
case NSF18FunctionKey: return Qt::Key_F18;
case NSF19FunctionKey: return Qt::Key_F19;
case NSF20FunctionKey: return Qt::Key_F20;
case NSF21FunctionKey: return Qt::Key_F21;
case NSF22FunctionKey: return Qt::Key_F22;
case NSF23FunctionKey: return Qt::Key_F23;
case NSF24FunctionKey: return Qt::Key_F24;
case NSF25FunctionKey: return Qt::Key_F25;
case NSF26FunctionKey: return Qt::Key_F26;
case NSF27FunctionKey: return Qt::Key_F27;
case NSF28FunctionKey: return Qt::Key_F28;
case NSF29FunctionKey: return Qt::Key_F29;
case NSF30FunctionKey: return Qt::Key_F30;
case NSF31FunctionKey: return Qt::Key_F31;
case NSF32FunctionKey: return Qt::Key_F32;
case NSF33FunctionKey: return Qt::Key_F33;
case NSF34FunctionKey: return Qt::Key_F34;
case NSF35FunctionKey: return Qt::Key_F35;
case NSMenuFunctionKey: return Qt::Key_Menu;
case NSHelpFunctionKey: return Qt::Key_Help;
}
return 0;
}
QKeySequence KeySequenceFromNSEvent(NSEvent* event) {
NSString* str = [event charactersIgnoringModifiers];
NSString* upper = [str uppercaseString];
const char* chars = [upper UTF8String];
NSUInteger modifiers = [event modifierFlags];
int key = 0;
unsigned char c = chars[0];
switch (c) {
case 0x1b: key = Qt::Key_Escape; break;
case 0x09: key = Qt::Key_Tab; break;
case 0x0d: key = Qt::Key_Return; break;
case 0x08: key = Qt::Key_Backspace; break;
case 0x03: key = Qt::Key_Enter; break;
}
if (key == 0) {
if (c >= 0x20 && c <= 0x7e) { // ASCII from space to ~
key = c;
} else {
key = MapFunctionKey([event keyCode]);
if (key == 0) {
return QKeySequence();
}
}
}
if (modifiers & NSShiftKeyMask) {
key += Qt::SHIFT;
}
if (modifiers & NSControlKeyMask) {
key += Qt::META;
}
if (modifiers & NSAlternateKeyMask) {
key += Qt::ALT;
}
if (modifiers & NSCommandKeyMask) {
key += Qt::CTRL;
}
return QKeySequence(key);
}
} // namespace mac

28
src/core/mac_utilities.h Normal file
View File

@ -0,0 +1,28 @@
/* This file is part of Clementine.
Copyright 2011, 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
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/>.
*/
// Only include this from Objective-C++ files
#include <QKeySequence>
@class NSEvent;
namespace mac {
QKeySequence KeySequenceFromNSEvent(NSEvent* event);
}

View File

@ -20,6 +20,7 @@
#include "config.h"
#include "globalshortcuts.h"
#include "mac_startup.h"
#import "mac_utilities.h"
#include <boost/noncopyable.hpp>
@ -67,111 +68,11 @@ class MacGlobalShortcutBackendPrivate : boost::noncopyable {
}
private:
static QKeySequence GetSequence(NSEvent* event) {
NSString* str = [event charactersIgnoringModifiers];
NSString* upper = [str uppercaseString];
const char* chars = [upper UTF8String];
NSUInteger modifiers = [event modifierFlags];
int key = 0;
unsigned char c = chars[0];
switch (c) {
case 0x1b: key = Qt::Key_Escape; break;
case 0x09: key = Qt::Key_Tab; break;
case 0x0d: key = Qt::Key_Return; break;
case 0x08: key = Qt::Key_Backspace; break;
case 0x03: key = Qt::Key_Enter; break;
}
if (key == 0) {
if (c >= 0x20 && c <= 0x7e) { // ASCII from space to ~
key = c;
} else {
key = MapFunctionKey([event keyCode]);
if (key == 0) {
return QKeySequence();
}
}
}
if (modifiers & NSShiftKeyMask) {
key += Qt::SHIFT;
}
if (modifiers & NSControlKeyMask) {
key += Qt::META;
}
if (modifiers & NSAlternateKeyMask) {
key += Qt::ALT;
}
if (modifiers & NSCommandKeyMask) {
key += Qt::CTRL;
}
return QKeySequence(key);
}
bool HandleKeyEvent(NSEvent* event) {
QKeySequence sequence = GetSequence(event);
QKeySequence sequence = mac::KeySequenceFromNSEvent(event);
return backend_->KeyPressed(sequence);
}
static int MapFunctionKey(int keycode) {
switch (keycode) {
// Function keys
case NSInsertFunctionKey: return Qt::Key_Insert;
case NSDeleteFunctionKey: return Qt::Key_Delete;
case NSPauseFunctionKey: return Qt::Key_Pause;
case NSPrintFunctionKey: return Qt::Key_Print;
case NSSysReqFunctionKey: return Qt::Key_SysReq;
case NSHomeFunctionKey: return Qt::Key_Home;
case NSEndFunctionKey: return Qt::Key_End;
case NSLeftArrowFunctionKey: return Qt::Key_Left;
case NSUpArrowFunctionKey: return Qt::Key_Up;
case NSRightArrowFunctionKey: return Qt::Key_Right;
case NSDownArrowFunctionKey: return Qt::Key_Down;
case NSPageUpFunctionKey: return Qt::Key_PageUp;
case NSPageDownFunctionKey: return Qt::Key_PageDown;
case NSScrollLockFunctionKey: return Qt::Key_ScrollLock;
case NSF1FunctionKey: return Qt::Key_F1;
case NSF2FunctionKey: return Qt::Key_F2;
case NSF3FunctionKey: return Qt::Key_F3;
case NSF4FunctionKey: return Qt::Key_F4;
case NSF5FunctionKey: return Qt::Key_F5;
case NSF6FunctionKey: return Qt::Key_F6;
case NSF7FunctionKey: return Qt::Key_F7;
case NSF8FunctionKey: return Qt::Key_F8;
case NSF9FunctionKey: return Qt::Key_F9;
case NSF10FunctionKey: return Qt::Key_F10;
case NSF11FunctionKey: return Qt::Key_F11;
case NSF12FunctionKey: return Qt::Key_F12;
case NSF13FunctionKey: return Qt::Key_F13;
case NSF14FunctionKey: return Qt::Key_F14;
case NSF15FunctionKey: return Qt::Key_F15;
case NSF16FunctionKey: return Qt::Key_F16;
case NSF17FunctionKey: return Qt::Key_F17;
case NSF18FunctionKey: return Qt::Key_F18;
case NSF19FunctionKey: return Qt::Key_F19;
case NSF20FunctionKey: return Qt::Key_F20;
case NSF21FunctionKey: return Qt::Key_F21;
case NSF22FunctionKey: return Qt::Key_F22;
case NSF23FunctionKey: return Qt::Key_F23;
case NSF24FunctionKey: return Qt::Key_F24;
case NSF25FunctionKey: return Qt::Key_F25;
case NSF26FunctionKey: return Qt::Key_F26;
case NSF27FunctionKey: return Qt::Key_F27;
case NSF28FunctionKey: return Qt::Key_F28;
case NSF29FunctionKey: return Qt::Key_F29;
case NSF30FunctionKey: return Qt::Key_F30;
case NSF31FunctionKey: return Qt::Key_F31;
case NSF32FunctionKey: return Qt::Key_F32;
case NSF33FunctionKey: return Qt::Key_F33;
case NSF34FunctionKey: return Qt::Key_F34;
case NSF35FunctionKey: return Qt::Key_F35;
case NSMenuFunctionKey: return Qt::Key_Menu;
case NSHelpFunctionKey: return Qt::Key_Help;
}
return 0;
}
id global_monitor_;
id local_monitor_;

View File

@ -0,0 +1,57 @@
/* This file is part of Clementine.
Copyright 2011, 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
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 "globalsearchpopup.h"
#include <QShortcut>
#include "core/player.h"
#include "ui/iconloader.h"
GlobalSearchPopup::GlobalSearchPopup(QWidget* parent)
: QDialog(parent),
ui_(new Ui_GlobalSearchPopup) {
ui_->setupUi(this);
Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Popup;
setWindowFlags(flags);
ui_->previous->setIcon(IconLoader::Load("media-skip-backward"));
ui_->next->setIcon(IconLoader::Load("media-skip-forward"));
ui_->play_pause->setIcon(IconLoader::Load("media-playback-start"));
ui_->stop->setIcon(IconLoader::Load("media-playback-stop"));
QShortcut* shortcut = new QShortcut(QKeySequence::Close, this);
connect(shortcut, SIGNAL(activated()), SLOT(close()));
}
void GlobalSearchPopup::Init(LibraryBackendInterface* library, Player* player) {
ui_->search_widget->Init(library);
// Forward AddToPlaylist signal.
connect(ui_->search_widget, SIGNAL(AddToPlaylist(QMimeData*)),
SIGNAL(AddToPlaylist(QMimeData*)));
connect(ui_->previous, SIGNAL(clicked(bool)), player, SLOT(Previous()));
connect(ui_->next, SIGNAL(clicked(bool)), player, SLOT(Next()));
connect(ui_->play_pause, SIGNAL(clicked(bool)), player, SLOT(PlayPause()));
connect(ui_->stop, SIGNAL(clicked(bool)), player, SLOT(Stop()));
}
void GlobalSearchPopup::setFocus(Qt::FocusReason reason) {
ui_->search_widget->setFocus(reason);
}

View File

@ -0,0 +1,47 @@
/* This file is part of Clementine.
Copyright 2011, 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
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 GLOBALSEARCHPOPUP_H
#define GLOBALSEARCHPOPUP_H
#include <boost/scoped_ptr.hpp>
#include <QDialog>
#include "ui_globalsearchpopup.h"
class LibraryBackendInterface;
class Player;
class GlobalSearchPopup : public QDialog {
Q_OBJECT
public:
explicit GlobalSearchPopup(QWidget* parent = 0);
void Init(LibraryBackendInterface* library, Player* player);
// QWidget
void setFocus(Qt::FocusReason reason = Qt::PopupFocusReason);
signals:
void AddToPlaylist(QMimeData*);
private:
boost::scoped_ptr<Ui_GlobalSearchPopup> ui_;
};
#endif // GLOBALSEARCHPOPUP_H

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GlobalSearchPopup</class>
<widget class="QDialog" name="GlobalSearchPopup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>253</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="GlobalSearchWidget" name="search_widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="previous">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="play_pause">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="stop">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="next">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GlobalSearchWidget</class>
<extends>QWidget</extends>
<header>globalsearch/globalsearchwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -318,6 +318,10 @@ bool GlobalSearchWidget::eventFilter(QObject* o, QEvent* e) {
return false;
}
void GlobalSearchWidget::setFocus(Qt::FocusReason reason) {
ui_->search->setFocus(reason);
}
void GlobalSearchWidget::LazyLoadArt(const QModelIndex& proxy_index) {
if (!proxy_index.isValid() || proxy_index.data(Role_LazyLoadingArt).isValid()) {
return;
@ -351,6 +355,7 @@ void GlobalSearchWidget::AddCurrent() {
return;
engine_->LoadTracksAsync(index.data(Role_Result).value<SearchProvider::Result>());
static_cast<LineEditInterface*>(ui_->search)->clear();
}
void GlobalSearchWidget::TracksLoaded(int id, MimeData* mime_data) {

View File

@ -55,6 +55,7 @@ public:
// QWidget
bool eventFilter(QObject* o, QEvent* e);
void setFocus(Qt::FocusReason reason);
signals:
void AddToPlaylist(QMimeData* data);

View File

@ -141,6 +141,9 @@ msgstr ""
msgid "(different across multiple songs)"
msgstr ""
msgid "..."
msgstr ""
msgid "...and all the Amarok contributors"
msgstr ""
@ -162,6 +165,9 @@ msgstr ""
msgid "50 random tracks"
msgstr ""
msgid "<a href=\"http://www.di.fm/premium/\">Upgrade to Premium now</a>"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
@ -187,6 +193,15 @@ msgstr ""
msgid "AAC"
msgstr ""
msgid "AAC 128k (Premium only)"
msgstr ""
msgid "AAC 32k"
msgstr ""
msgid "AAC 64k (Premium only)"
msgstr ""
msgid "AIFF"
msgstr ""
@ -206,6 +221,9 @@ msgstr ""
msgid "Account details"
msgstr ""
msgid "Account details (Premium)"
msgstr ""
msgid "Action"
msgstr ""
@ -428,9 +446,6 @@ msgstr ""
msgid "Are you sure you want to delete the \"%1\" preset?"
msgstr ""
msgid "Are you sure you want to install the following scripts?"
msgstr ""
msgid "Are you sure you want to reset this song's statistics?"
msgstr ""
@ -452,6 +467,9 @@ msgstr ""
msgid "Audio format"
msgstr ""
msgid "Audio type"
msgstr ""
msgid "Authenticating..."
msgstr ""
@ -642,9 +660,6 @@ msgstr ""
msgid "Clementine image viewer"
msgstr ""
msgid "Clementine scripts"
msgstr ""
msgid "Clementine was unable to find results for this file"
msgstr ""
@ -702,6 +717,9 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Configure..."
msgstr ""
msgid "Connect Wii Remotes using active/deactive action"
msgstr ""
@ -714,9 +732,6 @@ msgstr ""
msgid "Constant bitrate"
msgstr ""
msgid "Context:"
msgstr ""
msgid "Convert all music"
msgstr ""
@ -916,9 +931,6 @@ msgstr ""
msgid "Details..."
msgstr ""
msgid "Developer mode"
msgstr ""
msgid "Device"
msgstr ""
@ -934,18 +946,27 @@ msgstr ""
msgid "Devices"
msgstr ""
msgid "Dialog"
msgstr ""
msgid "Did you mean"
msgstr ""
msgid "Digitally Imported"
msgstr ""
msgid "Digitally Imported password"
msgstr ""
msgid "Digitally Imported username"
msgstr ""
msgid "Direct internet connection"
msgstr ""
msgid "Directory"
msgstr ""
msgid "Disable"
msgstr ""
msgid "Disable duration"
msgstr ""
@ -1055,9 +1076,6 @@ msgstr "Edit track information..."
msgid "Edit..."
msgstr ""
msgid "Enable"
msgstr ""
msgid "Enable Wii Remote support"
msgstr ""
@ -1125,14 +1143,11 @@ msgstr ""
msgid "Error downloading Spotify plugin"
msgstr ""
msgid "Error installing script"
msgstr ""
#, qt-format
msgid "Error loading %1"
msgstr ""
msgid "Error opening script archive"
msgid "Error loading di.fm playlist"
msgstr ""
#, qt-format
@ -1300,16 +1315,13 @@ msgstr ""
msgid "Genre"
msgstr ""
msgid "Get new scripts"
msgstr ""
msgid "Getting channels"
msgstr ""
msgid "Give it a name:"
msgid "Getting streams"
msgstr ""
msgid "Global Shortcuts"
msgid "Give it a name:"
msgstr ""
msgid "Go to next playlist tab"
@ -1428,6 +1440,9 @@ msgstr ""
msgid "Include all songs"
msgstr ""
msgid "Include:"
msgstr ""
msgid "Increase the volume by 4%"
msgstr ""
@ -1440,15 +1455,6 @@ msgstr ""
msgid "Insert..."
msgstr ""
msgid "Install from file..."
msgstr ""
msgid "Install script file"
msgstr ""
msgid "Install scripts"
msgstr ""
msgid "Installed"
msgstr ""
@ -1458,6 +1464,12 @@ msgstr ""
msgid "Invalid API key"
msgstr ""
msgid "Invalid SKY.fm username or password"
msgstr ""
msgid "Invalid di.fm username or password"
msgstr ""
msgid "Invalid format"
msgstr ""
@ -1688,6 +1700,12 @@ msgstr ""
msgid "MP3"
msgstr ""
msgid "MP3 256k (Premium only)"
msgstr ""
msgid "MP3 96k"
msgstr ""
msgid "MP4 AAC"
msgstr ""
@ -1758,9 +1776,6 @@ msgstr ""
msgid "Most played"
msgstr ""
msgid "Mount point"
msgstr ""
msgid "Mount points"
msgstr ""
@ -1809,9 +1824,6 @@ msgstr ""
msgid "My Recommendations"
msgstr ""
msgid "My scripts"
msgstr ""
msgid "Name"
msgstr ""
@ -1930,6 +1942,10 @@ msgstr ""
msgid "Only show the first"
msgstr ""
#, qt-format
msgid "Open %1 in browser"
msgstr ""
msgid "Open &audio CD..."
msgstr ""
@ -2083,9 +2099,6 @@ msgstr ""
msgid "Playlist type"
msgstr ""
msgid "Please fill in the blanks to login into Last.fm"
msgstr ""
msgid "Plugin status:"
msgstr ""
@ -2156,9 +2169,6 @@ msgstr ""
msgid "Put songs in a random order"
msgstr ""
msgid "Python console"
msgstr ""
msgid "Quality"
msgstr ""
@ -2216,10 +2226,10 @@ msgstr ""
msgid "Refresh station list"
msgstr ""
msgid "Reggae"
msgid "Refresh streams"
msgstr ""
msgid "Reload"
msgid "Reggae"
msgstr ""
msgid "Remember Wii remote swing"
@ -2345,15 +2355,17 @@ msgstr ""
msgid "Score"
msgstr ""
msgid "Script Manager"
msgstr ""
msgid "Scrobble tracks that I listen to"
msgstr ""
msgid "Search"
msgstr ""
msgid ""
"Search <b>ALL THE THINGS</b> in your library, connected devices and on the "
"Internet."
msgstr ""
msgid "Search Icecast stations"
msgstr ""
@ -2433,9 +2445,6 @@ msgstr ""
msgid "Settings"
msgstr ""
msgid "Settings..."
msgstr ""
msgid "Shortcut"
msgstr ""
@ -2450,6 +2459,9 @@ msgstr ""
msgid "Show"
msgstr ""
msgid "Show Global Search Popup"
msgstr ""
msgid "Show OSD"
msgstr ""
@ -2531,6 +2543,9 @@ msgstr ""
msgid "Sign out"
msgstr ""
msgid "Signing in..."
msgstr ""
msgid "Similar artists"
msgstr ""
@ -2564,9 +2579,6 @@ msgstr ""
msgid "Soft Rock"
msgstr ""
msgid "Some files failed to install. The script may not work correctly."
msgstr ""
msgid "Song Information"
msgstr ""
@ -2712,10 +2724,6 @@ msgstr ""
msgid "The \"%1\" command could not be started."
msgstr ""
#, qt-format
msgid "The '%1' script was modified, you might have to reload it"
msgstr ""
#, qt-format
msgid "The directory %1 is not valid"
msgstr ""
@ -2797,9 +2805,6 @@ msgstr ""
msgid "This is an iPod, but you compiled Clementine without libgpod support."
msgstr ""
msgid "This is not a valid Clementine script file."
msgstr ""
msgid ""
"This is the first time you have connected this device. Clementine will now "
"scan the device to find music files - this may take some time."
@ -2878,9 +2883,6 @@ msgstr ""
msgid "Turn off"
msgstr ""
msgid "URI"
msgstr ""
msgid "URL(s)"
msgstr ""
@ -3009,11 +3011,6 @@ msgstr ""
msgid "WMA"
msgstr ""
msgid ""
"Warning: scripts have full access to your computer and your music. Only "
"install scripts that you trust."
msgstr ""
msgid "Wav"
msgstr ""
@ -3059,6 +3056,18 @@ msgstr ""
msgid "Wii Remote %1: low battery (%2%)"
msgstr ""
msgid "Wiimotedev"
msgstr ""
msgid "Windows Media 128k (Premium only)"
msgstr ""
msgid "Windows Media 40k"
msgstr ""
msgid "Windows Media 64k (Premium only)"
msgstr ""
msgid "Windows Media audio"
msgstr ""
@ -3080,9 +3089,24 @@ msgstr ""
msgid "You are about to download the following albums"
msgstr ""
msgid "You are not signed in."
msgstr ""
#, qt-format
msgid "You are signed in as %1."
msgstr ""
msgid "You are signed in."
msgstr ""
msgid "You can change the way the songs in the library are organised."
msgstr ""
msgid ""
"You can listen for free without an account, but Premium members can listen "
"to higher quality streams without advertisements."
msgstr ""
msgid ""
"You can listen to Magnatune songs for free without an account. Purchasing a "
"membership removes the messages at the end of each track."
@ -3102,6 +3126,17 @@ msgid ""
"wiki</a> for more information.\n"
msgstr ""
msgid "You do not have a Spotify Premium account."
msgstr ""
msgid ""
"You have selected a Premium-only audio type but do not have any account "
"details entered"
msgstr ""
msgid "You have selected an invalid audio type setting"
msgstr ""
msgid "You love this track"
msgstr ""
@ -3148,6 +3183,9 @@ msgstr ""
msgid "Your scrobbles: %1"
msgstr ""
msgid "Your username or password was incorrect."
msgstr ""
msgid "Z-A"
msgstr ""
@ -3259,6 +3297,9 @@ msgstr ""
msgid "stop"
msgstr ""
msgid "track"
msgstr ""
#, qt-format
msgid "track %1"
msgstr ""

View File

@ -131,6 +131,9 @@ msgstr ""
msgid "(different across multiple songs)"
msgstr ""
msgid "..."
msgstr ""
msgid "...and all the Amarok contributors"
msgstr ""
@ -152,6 +155,9 @@ msgstr ""
msgid "50 random tracks"
msgstr ""
msgid "<a href=\"http://www.di.fm/premium/\">Upgrade to Premium now</a>"
msgstr ""
msgid ""
"<p>Tokens start with %, for example: %artist %album %title </p>\n"
"\n"
@ -177,6 +183,15 @@ msgstr ""
msgid "AAC"
msgstr ""
msgid "AAC 128k (Premium only)"
msgstr ""
msgid "AAC 32k"
msgstr ""
msgid "AAC 64k (Premium only)"
msgstr ""
msgid "AIFF"
msgstr ""
@ -196,6 +211,9 @@ msgstr ""
msgid "Account details"
msgstr ""
msgid "Account details (Premium)"
msgstr ""
msgid "Action"
msgstr ""
@ -418,9 +436,6 @@ msgstr ""
msgid "Are you sure you want to delete the \"%1\" preset?"
msgstr ""
msgid "Are you sure you want to install the following scripts?"
msgstr ""
msgid "Are you sure you want to reset this song's statistics?"
msgstr ""
@ -442,6 +457,9 @@ msgstr ""
msgid "Audio format"
msgstr ""
msgid "Audio type"
msgstr ""
msgid "Authenticating..."
msgstr ""
@ -632,9 +650,6 @@ msgstr ""
msgid "Clementine image viewer"
msgstr ""
msgid "Clementine scripts"
msgstr ""
msgid "Clementine was unable to find results for this file"
msgstr ""
@ -692,6 +707,9 @@ msgstr ""
msgid "Configure library..."
msgstr ""
msgid "Configure..."
msgstr ""
msgid "Connect Wii Remotes using active/deactive action"
msgstr ""
@ -704,9 +722,6 @@ msgstr ""
msgid "Constant bitrate"
msgstr ""
msgid "Context:"
msgstr ""
msgid "Convert all music"
msgstr ""
@ -906,9 +921,6 @@ msgstr ""
msgid "Details..."
msgstr ""
msgid "Developer mode"
msgstr ""
msgid "Device"
msgstr ""
@ -924,18 +936,27 @@ msgstr ""
msgid "Devices"
msgstr ""
msgid "Dialog"
msgstr ""
msgid "Did you mean"
msgstr ""
msgid "Digitally Imported"
msgstr ""
msgid "Digitally Imported password"
msgstr ""
msgid "Digitally Imported username"
msgstr ""
msgid "Direct internet connection"
msgstr ""
msgid "Directory"
msgstr ""
msgid "Disable"
msgstr ""
msgid "Disable duration"
msgstr ""
@ -1045,9 +1066,6 @@ msgstr ""
msgid "Edit..."
msgstr ""
msgid "Enable"
msgstr ""
msgid "Enable Wii Remote support"
msgstr ""
@ -1115,14 +1133,11 @@ msgstr ""
msgid "Error downloading Spotify plugin"
msgstr ""
msgid "Error installing script"
msgstr ""
#, qt-format
msgid "Error loading %1"
msgstr ""
msgid "Error opening script archive"
msgid "Error loading di.fm playlist"
msgstr ""
#, qt-format
@ -1290,16 +1305,13 @@ msgstr ""
msgid "Genre"
msgstr ""
msgid "Get new scripts"
msgstr ""
msgid "Getting channels"
msgstr ""
msgid "Give it a name:"
msgid "Getting streams"
msgstr ""
msgid "Global Shortcuts"
msgid "Give it a name:"
msgstr ""
msgid "Go to next playlist tab"
@ -1418,6 +1430,9 @@ msgstr ""
msgid "Include all songs"
msgstr ""
msgid "Include:"
msgstr ""
msgid "Increase the volume by 4%"
msgstr ""
@ -1430,15 +1445,6 @@ msgstr ""
msgid "Insert..."
msgstr ""
msgid "Install from file..."
msgstr ""
msgid "Install script file"
msgstr ""
msgid "Install scripts"
msgstr ""
msgid "Installed"
msgstr ""
@ -1448,6 +1454,12 @@ msgstr ""
msgid "Invalid API key"
msgstr ""
msgid "Invalid SKY.fm username or password"
msgstr ""
msgid "Invalid di.fm username or password"
msgstr ""
msgid "Invalid format"
msgstr ""
@ -1678,6 +1690,12 @@ msgstr ""
msgid "MP3"
msgstr ""
msgid "MP3 256k (Premium only)"
msgstr ""
msgid "MP3 96k"
msgstr ""
msgid "MP4 AAC"
msgstr ""
@ -1748,9 +1766,6 @@ msgstr ""
msgid "Most played"
msgstr ""
msgid "Mount point"
msgstr ""
msgid "Mount points"
msgstr ""
@ -1799,9 +1814,6 @@ msgstr ""
msgid "My Recommendations"
msgstr ""
msgid "My scripts"
msgstr ""
msgid "Name"
msgstr ""
@ -1920,6 +1932,10 @@ msgstr ""
msgid "Only show the first"
msgstr ""
#, qt-format
msgid "Open %1 in browser"
msgstr ""
msgid "Open &audio CD..."
msgstr ""
@ -2073,9 +2089,6 @@ msgstr ""
msgid "Playlist type"
msgstr ""
msgid "Please fill in the blanks to login into Last.fm"
msgstr ""
msgid "Plugin status:"
msgstr ""
@ -2146,9 +2159,6 @@ msgstr ""
msgid "Put songs in a random order"
msgstr ""
msgid "Python console"
msgstr ""
msgid "Quality"
msgstr ""
@ -2206,10 +2216,10 @@ msgstr ""
msgid "Refresh station list"
msgstr ""
msgid "Reggae"
msgid "Refresh streams"
msgstr ""
msgid "Reload"
msgid "Reggae"
msgstr ""
msgid "Remember Wii remote swing"
@ -2335,15 +2345,17 @@ msgstr ""
msgid "Score"
msgstr ""
msgid "Script Manager"
msgstr ""
msgid "Scrobble tracks that I listen to"
msgstr ""
msgid "Search"
msgstr ""
msgid ""
"Search <b>ALL THE THINGS</b> in your library, connected devices and on the "
"Internet."
msgstr ""
msgid "Search Icecast stations"
msgstr ""
@ -2423,9 +2435,6 @@ msgstr ""
msgid "Settings"
msgstr ""
msgid "Settings..."
msgstr ""
msgid "Shortcut"
msgstr ""
@ -2440,6 +2449,9 @@ msgstr ""
msgid "Show"
msgstr ""
msgid "Show Global Search Popup"
msgstr ""
msgid "Show OSD"
msgstr ""
@ -2521,6 +2533,9 @@ msgstr ""
msgid "Sign out"
msgstr ""
msgid "Signing in..."
msgstr ""
msgid "Similar artists"
msgstr ""
@ -2554,9 +2569,6 @@ msgstr ""
msgid "Soft Rock"
msgstr ""
msgid "Some files failed to install. The script may not work correctly."
msgstr ""
msgid "Song Information"
msgstr ""
@ -2702,10 +2714,6 @@ msgstr ""
msgid "The \"%1\" command could not be started."
msgstr ""
#, qt-format
msgid "The '%1' script was modified, you might have to reload it"
msgstr ""
#, qt-format
msgid "The directory %1 is not valid"
msgstr ""
@ -2787,9 +2795,6 @@ msgstr ""
msgid "This is an iPod, but you compiled Clementine without libgpod support."
msgstr ""
msgid "This is not a valid Clementine script file."
msgstr ""
msgid ""
"This is the first time you have connected this device. Clementine will now "
"scan the device to find music files - this may take some time."
@ -2868,9 +2873,6 @@ msgstr ""
msgid "Turn off"
msgstr ""
msgid "URI"
msgstr ""
msgid "URL(s)"
msgstr ""
@ -2999,11 +3001,6 @@ msgstr ""
msgid "WMA"
msgstr ""
msgid ""
"Warning: scripts have full access to your computer and your music. Only "
"install scripts that you trust."
msgstr ""
msgid "Wav"
msgstr ""
@ -3049,6 +3046,18 @@ msgstr ""
msgid "Wii Remote %1: low battery (%2%)"
msgstr ""
msgid "Wiimotedev"
msgstr ""
msgid "Windows Media 128k (Premium only)"
msgstr ""
msgid "Windows Media 40k"
msgstr ""
msgid "Windows Media 64k (Premium only)"
msgstr ""
msgid "Windows Media audio"
msgstr ""
@ -3070,9 +3079,24 @@ msgstr ""
msgid "You are about to download the following albums"
msgstr ""
msgid "You are not signed in."
msgstr ""
#, qt-format
msgid "You are signed in as %1."
msgstr ""
msgid "You are signed in."
msgstr ""
msgid "You can change the way the songs in the library are organised."
msgstr ""
msgid ""
"You can listen for free without an account, but Premium members can listen "
"to higher quality streams without advertisements."
msgstr ""
msgid ""
"You can listen to Magnatune songs for free without an account. Purchasing a "
"membership removes the messages at the end of each track."
@ -3092,6 +3116,17 @@ msgid ""
"wiki</a> for more information.\n"
msgstr ""
msgid "You do not have a Spotify Premium account."
msgstr ""
msgid ""
"You have selected a Premium-only audio type but do not have any account "
"details entered"
msgstr ""
msgid "You have selected an invalid audio type setting"
msgstr ""
msgid "You love this track"
msgstr ""
@ -3138,6 +3173,9 @@ msgstr ""
msgid "Your scrobbles: %1"
msgstr ""
msgid "Your username or password was incorrect."
msgstr ""
msgid "Z-A"
msgstr ""
@ -3249,6 +3287,9 @@ msgstr ""
msgid "stop"
msgstr ""
msgid "track"
msgstr ""
#, qt-format
msgid "track %1"
msgstr ""

View File

@ -76,7 +76,8 @@ QString About::MakeHtml() const {
ret += QString("<br />%1</p>").arg(tr("...and all the Amarok contributors"));
ret += QString("<p><b>%1</b>").arg(tr("And:"));
ret += QString("<br /><a href=\"http://rainymood.com\">Rainy Mood</a>");
ret += QString("<br /><a href=\"http://www.smitelli.com/?page=blog&p=54\">Scott Smitelli</a></p>");
ret += QString("<br /><a href=\"http://www.smitelli.com/?page=blog&p=54\">Scott Smitelli</a>");
ret += QString("<br /><a href=\"http://hyperboleandahalf.blogspot.com\">Allie Brosh</a></p>");
#ifdef HAVE_SPOTIFY
ret += "<p>This product uses SPOTIFY(R) CORE but is not endorsed, certified "

View File

@ -56,6 +56,20 @@ void GlobalShortcutGrabber::hideEvent(QHideEvent* e) {
QDialog::hideEvent(e);
}
void GlobalShortcutGrabber::grabKeyboard() {
#ifdef Q_OS_DARWIN
SetupMacEventHandler();
#endif
QDialog::grabKeyboard();
}
void GlobalShortcutGrabber::releaseKeyboard() {
#ifdef Q_OS_DARWIN
TeardownMacEventHandler();
#endif
QDialog::releaseKeyboard();
}
bool GlobalShortcutGrabber::event(QEvent* e) {
if (e->type() == QEvent::ShortcutOverride) {
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
@ -65,7 +79,7 @@ bool GlobalShortcutGrabber::event(QEvent* e) {
else
ret_ = QKeySequence(ke->modifiers() | ke->key());
ui_->combo->setText("<b>" + ret_.toString(QKeySequence::NativeText) + "</b>");
UpdateText();
if (!modifier_keys_.contains(ke->key()))
accept();
@ -74,4 +88,8 @@ bool GlobalShortcutGrabber::event(QEvent* e) {
return QDialog::event(e);
}
void GlobalShortcutGrabber::UpdateText() {
ui_->combo->setText("<b>" + ret_.toString(QKeySequence::NativeText) + "</b>");
}

View File

@ -20,6 +20,8 @@
#include <QDialog>
class MacMonitorWrapper;
class NSEvent;
class Ui_GlobalShortcutGrabber;
class GlobalShortcutGrabber : public QDialog {
@ -35,12 +37,21 @@ class GlobalShortcutGrabber : public QDialog {
bool event(QEvent *);
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
void grabKeyboard();
void releaseKeyboard();
private:
void UpdateText();
void SetupMacEventHandler();
void TeardownMacEventHandler();
bool HandleMacEvent(NSEvent*);
Ui_GlobalShortcutGrabber* ui_;
QKeySequence ret_;
QList<int> modifier_keys_;
MacMonitorWrapper* wrapper_;
};
#endif // GLOBALSHORTCUTGRABBER_H

View File

@ -0,0 +1,65 @@
/* This file is part of Clementine.
Copyright 2011, 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
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 "globalshortcutgrabber.h"
#import <AppKit/NSEvent.h>
#import <AppKit/NSGraphics.h>
#import <AppKit/NSViewController.h>
#import <QuartzCore/CALayer.h>
#include <QKeySequence>
#include <boost/noncopyable.hpp>
#import "core/mac_utilities.h"
class MacMonitorWrapper : boost::noncopyable {
public:
explicit MacMonitorWrapper(id monitor)
: local_monitor_(monitor) {
}
~MacMonitorWrapper() {
[NSEvent removeMonitor: local_monitor_];
}
private:
id local_monitor_;
};
bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) {
ret_ = mac::KeySequenceFromNSEvent(event);
UpdateText();
if ([[event charactersIgnoringModifiers] length] != 0) {
accept();
return true;
}
return ret_ == QKeySequence(Qt::Key_Escape);
}
void GlobalShortcutGrabber::SetupMacEventHandler() {
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSKeyDownMask
handler:^(NSEvent* event) {
return HandleMacEvent(event) ? event : nil;
}];
wrapper_ = new MacMonitorWrapper(monitor);
}
void GlobalShortcutGrabber::TeardownMacEventHandler() {
delete wrapper_;
}

View File

@ -40,6 +40,7 @@
#include "devices/deviceview.h"
#include "engines/enginebase.h"
#include "engines/gstengine.h"
#include "globalsearch/globalsearchpopup.h"
#include "internet/magnatuneservice.h"
#include "internet/internetmodel.h"
#include "internet/internetview.h"
@ -619,6 +620,7 @@ MainWindow::MainWindow(
connect(global_shortcuts_, SIGNAL(ShowHide()), SLOT(ToggleShowHide()));
connect(global_shortcuts_, SIGNAL(ShowOSD()), player_, SLOT(ShowOSD()));
connect(global_shortcuts_, SIGNAL(TogglePrettyOSD()), player_, SLOT(TogglePrettyOSD()));
connect(global_shortcuts_, SIGNAL(ShowGlobalSearch()), SLOT(ShowGlobalSearch()));
#ifdef HAVE_LIBLASTFM
connect(global_shortcuts_, SIGNAL(ToggleScrobbling()), internet_model->InternetModel::Service<LastFMService>(), SLOT(ToggleScrobbling()));
#endif
@ -2240,3 +2242,15 @@ void MainWindow::HandleNotificationPreview(OSD::Behaviour type, QString line1, Q
osd_->ShowPreview(type, line1, line2, fake);
}
}
void MainWindow::ShowGlobalSearch() {
if (!search_popup_) {
search_popup_.reset(new GlobalSearchPopup);
search_popup_->Init(library_->backend(), player_);
StyleSheetLoader* css_loader = new StyleSheetLoader(search_popup_.get());
css_loader->SetStyleSheet(search_popup_.get(), ":mainwindow.css");
connect(search_popup_.get(), SIGNAL(AddToPlaylist(QMimeData*)), SLOT(AddToPlaylist(QMimeData*)));
}
search_popup_->show();
search_popup_->setFocus();
}

View File

@ -46,6 +46,7 @@ class EditTagDialog;
class Equalizer;
class ErrorDialog;
class FileView;
class GlobalSearchPopup;
class GlobalShortcuts;
class GroupByDialog;
class Library;
@ -234,6 +235,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void OpenSettingsDialog();
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
void ShowSongInfoConfig();
void ShowGlobalSearch();
void SaveGeometry();
@ -300,6 +302,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
boost::scoped_ptr<TrackSelectionDialog> track_selection_dialog_;
PlaylistItemList autocomplete_tag_items_;
boost::scoped_ptr<GlobalSearchPopup> search_popup_;
#ifdef ENABLE_VISUALISATIONS
boost::scoped_ptr<VisualisationContainer> visualisation_;
#endif

View File

@ -24,6 +24,8 @@
class MockLibraryBackend : public LibraryBackendInterface {
public:
MOCK_CONST_METHOD0(songs_table, QString());
// Get a list of directories in the library. Emits DirectoriesDiscovered.
MOCK_METHOD0(LoadDirectoriesAsync, void());