Show a message in the Devices pane on Windows to say that most devices won't work. Fixes #4059

This commit is contained in:
David Sansome 2014-01-05 11:32:07 +11:00
parent 6579392d22
commit 8416188056
7 changed files with 211 additions and 2 deletions

View File

@ -134,6 +134,7 @@ set(SOURCES
devices/deviceproperties.cpp
devices/devicestatefiltermodel.cpp
devices/deviceview.cpp
devices/deviceviewcontainer.cpp
devices/filesystemdevice.cpp
engines/enginebase.cpp
@ -446,6 +447,7 @@ set(HEADERS
devices/deviceproperties.h
devices/devicestatefiltermodel.h
devices/deviceview.h
devices/deviceviewcontainer.h
devices/filesystemdevice.h
engines/enginebase.h
@ -672,6 +674,7 @@ set(UI
covers/coversearchstatisticsdialog.ui
devices/deviceproperties.ui
devices/deviceviewcontainer.ui
globalsearch/globalsearchsettingspage.ui
globalsearch/globalsearchview.ui

View File

@ -0,0 +1,56 @@
/* This file is part of Clementine.
Copyright 2012, 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 "deviceviewcontainer.h"
#include "ui_deviceviewcontainer.h"
#include "ui/iconloader.h"
DeviceViewContainer::DeviceViewContainer(QWidget *parent)
: QWidget(parent),
ui_(new Ui::DeviceViewContainer),
loaded_icons_(false) {
ui_->setupUi(this);
QPalette palette(ui_->windows_is_broken_frame->palette());
palette.setColor(QPalette::Background, QColor(255, 255, 222));
ui_->windows_is_broken_frame->setPalette(palette);
#ifdef Q_OS_WIN
ui_->windows_is_broken_frame->show();
#else
ui_->windows_is_broken_frame->hide();
#endif
}
DeviceViewContainer::~DeviceViewContainer() {
delete ui_;
}
void DeviceViewContainer::showEvent(QShowEvent* e) {
if (!loaded_icons_) {
loaded_icons_ = true;
ui_->close_frame_button->setIcon(IconLoader::Load("edit-delete"));
ui_->warning_icon->setPixmap(IconLoader::Load("dialog-warning").pixmap(22));
}
QWidget::showEvent(e);
}
DeviceView* DeviceViewContainer::view() const {
return ui_->view;
}

View File

@ -0,0 +1,46 @@
/* This file is part of Clementine.
Copyright 2012, 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 DEVICEVIEWCONTAINER_H
#define DEVICEVIEWCONTAINER_H
#include <QWidget>
namespace Ui {
class DeviceViewContainer;
}
class DeviceView;
class DeviceViewContainer : public QWidget {
Q_OBJECT
public:
explicit DeviceViewContainer(QWidget* parent = 0);
~DeviceViewContainer();
DeviceView* view() const;
protected:
void showEvent(QShowEvent*);
private:
Ui::DeviceViewContainer* ui_;
bool loaded_icons_;
};
#endif // DEVICEVIEWCONTAINER_H

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DeviceViewContainer</class>
<widget class="QWidget" name="DeviceViewContainer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>391</width>
<height>396</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="windows_is_broken_frame">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="warning_icon"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>iPods and USB devices currently don't work on Windows. Sorry!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="close_frame_button"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="DeviceView" name="view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DeviceView</class>
<extends>QWidget</extends>
<header>devices/deviceview.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>close_frame_button</sender>
<signal>clicked()</signal>
<receiver>windows_is_broken_frame</receiver>
<slot>hide()</slot>
<hints>
<hint type="sourcelabel">
<x>362</x>
<y>31</y>
</hint>
<hint type="destinationlabel">
<x>369</x>
<y>40</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -101,6 +101,7 @@ PlaylistListContainer::~PlaylistListContainer() {
void PlaylistListContainer::showEvent(QShowEvent* e) {
// Loading icons is expensive so only do it when the view is first opened
if (loaded_icons_) {
QWidget::showEvent(e);
return;
}
loaded_icons_ = true;

View File

@ -41,6 +41,7 @@
#include "devices/devicemanager.h"
#include "devices/devicestatefiltermodel.h"
#include "devices/deviceview.h"
#include "devices/deviceviewcontainer.h"
#include "engines/enginebase.h"
#include "engines/gstengine.h"
#include "globalsearch/globalsearch.h"
@ -172,7 +173,8 @@ MainWindow::MainWindow(Application* app,
file_view_(new FileView(this)),
playlist_list_(new PlaylistListContainer(this)),
internet_view_(new InternetViewContainer(this)),
device_view_(new DeviceView(this)),
device_view_container_(new DeviceViewContainer(this)),
device_view_(device_view_container_->view()),
song_info_view_(new SongInfoView(this)),
artist_info_view_(new ArtistInfoView(this)),
settings_dialog_(NULL),
@ -237,7 +239,7 @@ MainWindow::MainWindow(Application* app,
ui_->tabs->AddTab(file_view_, IconLoader::Load("document-open"), tr("Files"));
ui_->tabs->AddTab(playlist_list_, IconLoader::Load("view-media-playlist"), tr("Playlists"));
ui_->tabs->AddTab(internet_view_, IconLoader::Load("applications-internet"), tr("Internet"));
ui_->tabs->AddTab(device_view_, IconLoader::Load("multimedia-player-ipod-mini-blue"), tr("Devices"));
ui_->tabs->AddTab(device_view_container_, IconLoader::Load("multimedia-player-ipod-mini-blue"), tr("Devices"));
ui_->tabs->AddSpacer();
ui_->tabs->AddTab(song_info_view_, IconLoader::Load("view-media-lyrics"), tr("Song info"));
ui_->tabs->AddTab(artist_info_view_, IconLoader::Load("x-clementine-artist"), tr("Artist info"));

View File

@ -44,6 +44,7 @@ class CoverProviders;
class Database;
class DeviceManager;
class DeviceView;
class DeviceViewContainer;
class EditTagDialog;
class Equalizer;
class ErrorDialog;
@ -289,6 +290,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
FileView* file_view_;
PlaylistListContainer* playlist_list_;
InternetViewContainer* internet_view_;
DeviceViewContainer* device_view_container_;
DeviceView* device_view_;
SongInfoView* song_info_view_;
ArtistInfoView* artist_info_view_;