Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improving the appearance of the mount popup - 2.

  • Loading branch information...
commit 317860309cfeee56790ee2d50e1d3f831513ec29 1 parent fdfb483
@SokoloffA SokoloffA authored
View
1  razorqt-panel/plugin-mount/CMakeLists.txt
@@ -38,7 +38,6 @@ set(MOCS
)
set(UIS
- menudiskitem.ui
razormountconfiguration.ui
)
View
57 razorqt-panel/plugin-mount/menudiskitem.cpp
@@ -31,6 +31,9 @@
#include <qtxdg/xdgicon.h>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
+#include <QHBoxLayout>
+#include <QToolButton>
+#include <QEvent>
/************************************************
@@ -39,8 +42,25 @@ MenuDiskItem::MenuDiskItem(RazorMountDevice *device, QWidget *parent):
QFrame(parent),
mDevice(device)
{
- setupUi(this);
- eject->setIcon(XdgIcon::fromTheme("media-eject"));
+ mDiskButton = new QToolButton(this);
+ mDiskButton->setObjectName("DiskButton");
+ mDiskButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ mDiskButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ connect(mDiskButton, SIGNAL(clicked()), this, SLOT(diskButtonClicked()));
+
+ mEjectButton = new QToolButton(this);
+ mEjectButton->setObjectName("EjectButton");
+ connect(mEjectButton, SIGNAL(clicked()), this, SLOT(ejectButtonClicked()));
+
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->addWidget(mDiskButton);
+ layout->addWidget(mEjectButton);
+ this->setLayout(layout);
+
+ layout->setMargin(0);
+ layout->setSpacing(0);
+
+ mEjectButton->setIcon(XdgIcon::fromTheme("media-eject"));
connect(device, SIGNAL(destroyed()),
this, SLOT(free()));
@@ -72,14 +92,13 @@ void MenuDiskItem::free()
************************************************/
void MenuDiskItem::update()
{
- diskButton->setIcon(XdgIcon::fromTheme(QStringList()
- << mDevice->iconName()
- << "drive-removable-media-usb"
- )
- );
+ mDiskButton->setIcon(XdgIcon::fromTheme(QStringList()
+ << mDevice->iconName()
+ << "drive-removable-media-usb"
+ ));
QString label = mDevice->label();
- diskButton->setText(label);
+ mDiskButton->setText(label);
setMountStatus(mDevice->isMounted());
}
@@ -115,32 +134,16 @@ bool MenuDiskItem::isUsableDevice(const RazorMountDevice *device)
/************************************************
************************************************/
-void MenuDiskItem::changeEvent(QEvent *e)
-{
- QWidget::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- retranslateUi(this);
- break;
- default:
- break;
- }
-}
-
-
-/************************************************
-
- ************************************************/
void MenuDiskItem::setMountStatus(bool is_mount)
{
- eject->setEnabled(is_mount);
+ mEjectButton->setEnabled(is_mount);
}
/************************************************
************************************************/
-void MenuDiskItem::on_diskButton_clicked()
+void MenuDiskItem::diskButtonClicked()
{
if (!mDevice->isMounted())
mDevice->mount();
@@ -163,7 +166,7 @@ void MenuDiskItem::mounted()
/************************************************
************************************************/
-void MenuDiskItem::on_eject_clicked()
+void MenuDiskItem::ejectButtonClicked()
{
mDevice->unmount();
setMountStatus(mDevice->isMounted());
View
16 razorqt-panel/plugin-mount/menudiskitem.h
@@ -28,11 +28,12 @@
#ifndef MENUDISKITEM_H
#define MENUDISKITEM_H
-#include "ui_menudiskitem.h"
-class RazorMountDevice;
+#include <QFrame>
+class RazorMountDevice;
+class QToolButton;
-class MenuDiskItem : public QFrame, private Ui::MenuDiskItem
+class MenuDiskItem : public QFrame
{
Q_OBJECT
@@ -46,12 +47,9 @@ class MenuDiskItem : public QFrame, private Ui::MenuDiskItem
signals:
void error(const QString &msg);
-protected:
- void changeEvent(QEvent *e);
-
private slots:
- void on_eject_clicked();
- void on_diskButton_clicked();
+ void ejectButtonClicked();
+ void diskButtonClicked();
void update();
void free();
void mounted();
@@ -59,6 +57,8 @@ private slots:
private:
RazorMountDevice *mDevice;
+ QToolButton *mDiskButton;
+ QToolButton *mEjectButton;
};
#endif // MENUDISKITEM_H
View
71 razorqt-panel/plugin-mount/menudiskitem.ui
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MenuDiskItem</class>
- <widget class="QWidget" name="MenuDiskItem">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>225</width>
- <height>35</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string notr="true">Form</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>4</number>
- </property>
- <property name="topMargin">
- <number>2</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>2</number>
- </property>
- <item>
- <widget class="QToolButton" name="diskButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Click to access this device from other applications.</string>
- </property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonTextBesideIcon</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="eject">
- <property name="toolTip">
- <string>Click to eject this disc.</string>
- </property>
- <property name="iconSize">
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
View
1  razorqt-panel/plugin-mount/popup.cpp
@@ -54,6 +54,7 @@ Popup::Popup(RazorMountManager *manager, IRazorPanelPlugin *plugin, QWidget* par
this, SLOT(removeItem(RazorMountDevice*)));
mPlaceholder = new QLabel(tr("No devices are available"), this);
+ mPlaceholder->setObjectName("NoDiskLabel");
layout()->addWidget(mPlaceholder);
mPlaceholder->hide();
Please sign in to comment.
Something went wrong with that request. Please try again.