Remove info frame from DeviceViewContainer

Was broken and caused yellow background on windows
This commit is contained in:
Jonas Kvinge 2018-08-09 22:30:18 +02:00
parent 08fcedd925
commit f5ba8da3c7
3 changed files with 5 additions and 98 deletions

View File

@ -22,48 +22,14 @@
#include <QtGlobal> #include <QtGlobal>
#include <QWidget> #include <QWidget>
#include <QColor>
#include <QFrame>
#include <QIcon>
#include <QLabel>
#include <QPalette>
#include <QToolButton>
#include <QShowEvent>
#include "core/iconloader.h"
#include "deviceviewcontainer.h" #include "deviceviewcontainer.h"
#include "ui_deviceviewcontainer.h" #include "ui_deviceviewcontainer.h"
DeviceViewContainer::DeviceViewContainer(QWidget *parent) : QWidget(parent), ui_(new Ui::DeviceViewContainer), loaded_icons_(false) { DeviceViewContainer::DeviceViewContainer(QWidget *parent) : QWidget(parent), ui_(new Ui_DeviceViewContainer) {
ui_->setupUi(this); 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_; } 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; } DeviceView *DeviceViewContainer::view() const { return ui_->view; }

View File

@ -30,11 +30,8 @@
#include <QString> #include <QString>
#include <QShowEvent> #include <QShowEvent>
namespace Ui {
class DeviceViewContainer;
}
class DeviceView; class DeviceView;
class Ui_DeviceViewContainer;
class DeviceViewContainer : public QWidget { class DeviceViewContainer : public QWidget {
Q_OBJECT Q_OBJECT
@ -43,14 +40,12 @@ class DeviceViewContainer : public QWidget {
explicit DeviceViewContainer(QWidget *parent = nullptr); explicit DeviceViewContainer(QWidget *parent = nullptr);
~DeviceViewContainer(); ~DeviceViewContainer();
DeviceView* view() const; DeviceView *view() const;
protected: protected:
void showEvent(QShowEvent *);
private: private:
Ui::DeviceViewContainer *ui_; Ui_DeviceViewContainer *ui_;
bool loaded_icons_;
}; };
#endif // DEVICEVIEWCONTAINER_H #endif // DEVICEVIEWCONTAINER_H

View File

@ -29,43 +29,6 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </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> <item>
<widget class="DeviceView" name="view" native="true"> <widget class="DeviceView" name="view" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@ -87,22 +50,5 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <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> </ui>