Skip to content

Commit d1af836

Browse files
committed
0.7.1
1 parent 7405c00 commit d1af836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1281
-1021
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<img src="https://raw.githubusercontent.com/linuxmint/mint-y-icons/master/usr/share/icons/Mint-Y/categories/22/cs-network.png"> Local IPv4 Indicator
2626

2727
<h2>Screenshots</h2>
28-
<img src="scr-0.7.png" width="853">
28+
<img src="scr-0.7.1.png" width="853">
2929

3030
<h2>Installation</h2>
3131
For the installation guide, refer to <a href="https://plainde.github.io/docs.github.io/installation.html">docs</a>.
@@ -35,7 +35,7 @@
3535

3636
<h2>How can I help you?</h2>
3737
<ul>
38-
<li>Create a new applet</li>
38+
<li>Develop a new applet</li>
3939
<li>Translate plainPanel into another language (soon)</li>
4040
<li>Report a bug</li>
4141
<li>Fix a bug or suggest solution for it</li>

applet.cpp

+42-38
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#include "applet.h"
22

3-
void Applet::setBlurredBackground(QWidget* internalWidget) {
4-
QScreen* screen = internalWidget->screen();
5-
QRect widgetGeometry = internalWidget->geometry();
3+
void Applet::setBlurredBackground() {
4+
QScreen* screen = mInternalWidget->screen();
5+
QRect screenGeometry = screen->geometry();
6+
QRect widgetGeometry = mInternalWidget->geometry();
67
QPixmap pixmap = screen->grabWindow(0,
78
widgetGeometry.x(),
89
widgetGeometry.y(),
910
widgetGeometry.width(),
1011
widgetGeometry.height());
11-
qDebug() << widgetGeometry;
1212
QGraphicsBlurEffect* blurEffect = new QGraphicsBlurEffect();
1313
blurEffect->setBlurRadius(15);
1414
blurEffect->setBlurHints(QGraphicsBlurEffect::QualityHint);
@@ -24,87 +24,91 @@ void Applet::setBlurredBackground(QWidget* internalWidget) {
2424
scene->render(&ptr, QRectF(), QRectF(0, 0, widgetGeometry.width(), widgetGeometry.height()));
2525

2626
QPalette palette;
27-
palette.setBrush(internalWidget->backgroundRole(),
27+
palette.setBrush(mInternalWidget->backgroundRole(),
2828
QBrush(QPixmap::fromImage(res)));
29-
internalWidget->setPalette(palette);
29+
mInternalWidget->setPalette(palette);
3030
}
3131

32-
QPair<int,int> Applet::getButtonCoordinates(QWidget* externalWidget, Panel* parentPanel) {
32+
QPair<int,int> Applet::getButtonCoordinates() {
3333
int buttonCoord1, buttonCoord2;
34-
if (parentPanel->mPanelLayout == Horizontal) {
35-
buttonCoord1 = externalWidget->x() + parentPanel->mAxisShift;
36-
buttonCoord2 = externalWidget->geometry().topRight().x() + parentPanel->mAxisShift;
34+
if (mParentPanel->mPanelLayout == Horizontal) {
35+
buttonCoord1 = mExternalWidget->x() + mParentPanel->mAxisShift;
36+
buttonCoord2 = mExternalWidget->geometry().topRight().x() +
37+
mParentPanel->mAxisShift;
3738
}
3839
else { // Vertical
39-
buttonCoord1 = externalWidget->y() + parentPanel->mAxisShift;
40-
buttonCoord2 = externalWidget->geometry().bottomRight().y() + parentPanel->mAxisShift;
40+
buttonCoord1 = mExternalWidget->y() + mParentPanel->mAxisShift;
41+
buttonCoord2 = mExternalWidget->geometry().bottomRight().y() +
42+
mParentPanel->mAxisShift;
4143
}
4244
return qMakePair(buttonCoord1, buttonCoord2);
4345
}
4446

45-
void Applet::externalWidgetSetup(ConfigManager*, Panel*) {
46-
47-
}
48-
49-
void Applet::preliminaryInternalWidgetSetup(QWidget* internalWidget,
50-
QWidget* externalWidget,
51-
ConfigManager* cfgMan,
52-
Panel* parentPanel,
53-
int width,
47+
void Applet::preliminaryInternalWidgetSetup(int width,
5448
int height,
5549
bool canBeTransparent) {
5650
// Window flags
57-
internalWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
51+
mInternalWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
5852

5953
// Geometry
60-
QScreen* screen = parentPanel->mPanelScreen;
54+
QScreen* screen = mParentPanel->mPanelScreen;
6155
QRect screenGeometry = screen->geometry();
6256
int ax = 0, ay = 0;
63-
QPair<int,int> buttonCoords = getButtonCoordinates(externalWidget, parentPanel);
57+
QPair<int,int> buttonCoords = getButtonCoordinates();
6458
int buttonCoord1 = buttonCoords.first, buttonCoord2 = buttonCoords.second;
65-
switch (parentPanel->mPanelLocation) {
59+
switch (mParentPanel->mPanelLocation) {
6660
case Top:
6761
ax = (screenGeometry.width() - buttonCoord1 >= width) ? buttonCoord1 : buttonCoord2 - width;
68-
ay = parentPanel->mPanelThickness + 5;
62+
ay = mParentPanel->mPanelThickness + 5;
6963
break;
7064

7165
case Bottom:
7266
ax = (screenGeometry.width() - buttonCoord1 >= width) ? buttonCoord1 : buttonCoord2 - width;
73-
ay = screenGeometry.height() - parentPanel->mPanelThickness - height - 5;
67+
ay = screenGeometry.height() - mParentPanel->mPanelThickness - height - 5;
7468
break;
7569

7670
case Left:
77-
ax = parentPanel->mPanelThickness + 5;
71+
ax = mParentPanel->mPanelThickness + 5;
7872
ay = (screenGeometry.height() - buttonCoord1 >= height) ? buttonCoord1 : buttonCoord2 - height;
7973
break;
8074

8175
case Right:
82-
ax = screenGeometry.width() - parentPanel->mPanelThickness - width - 5;
76+
ax = screenGeometry.width() - mParentPanel->mPanelThickness - width - 5;
8377
ay = (screenGeometry.height() - buttonCoord1 >= height) ? buttonCoord1 : buttonCoord2 - height;
8478
break;
8579
}
8680

8781
ax += screenGeometry.x();
8882
ay += screenGeometry.y();
89-
internalWidget->setFixedSize(width, height);
90-
internalWidget->move(ax, ay);
83+
mInternalWidget->setFixedSize(width, height);
84+
mInternalWidget->move(ax, ay);
9185

9286
// Font
93-
internalWidget->setFont(cfgMan->mFont);
87+
mInternalWidget->setFont(mCfgMan->mFont);
9488

9589
// Theme
96-
QFile stylesheetReader("/usr/share/plainDE/styles/" + cfgMan->mStylesheet);
90+
QFile stylesheetReader("/usr/share/plainDE/styles/" + mCfgMan->mStylesheet);
9791
stylesheetReader.open(QIODevice::ReadOnly | QIODevice::Text);
9892
QTextStream styleSheet(&stylesheetReader);
99-
internalWidget->setStyleSheet(styleSheet.readAll());
100-
if (cfgMan->mTransparent && canBeTransparent) {
101-
setBlurredBackground(internalWidget);
93+
mInternalWidget->setStyleSheet(styleSheet.readAll());
94+
if (mCfgMan->mTransparent && canBeTransparent) {
95+
setBlurredBackground();
10296
}
10397

10498
// Opacity
105-
internalWidget->setWindowOpacity(parentPanel->mOpacity);
99+
mInternalWidget->setWindowOpacity(mParentPanel->mOpacity);
106100
}
107101

108-
Applet::Applet(ConfigManager*, Panel*, QString) {
102+
void Applet::externalWidgetSetup() {
103+
104+
}
105+
106+
void Applet::internalWidgetSetup() {
107+
108+
}
109109

110+
Applet::Applet(QString appletID, ConfigManager* cfgMan, Panel* parentPanel) {
111+
mAppletID = appletID;
112+
mCfgMan = cfgMan;
113+
mParentPanel = parentPanel;
110114
}

applet.h

+23-16
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,35 @@
1313
#include "configman.h"
1414
#include "panel.h"
1515

16+
enum AppletType {
17+
Static,
18+
Dynamic
19+
};
20+
1621
class Applet : public QObject {
1722
Q_OBJECT
1823
public:
19-
Applet(ConfigManager* cfgMan,
20-
Panel* parentPanel,
21-
QString additionalInfo);
22-
void externalWidgetSetup(ConfigManager* cfgMan, Panel* parentPanel);
23-
void internalWidgetSetup(ConfigManager* cfgMan, Panel* parentPanel);
24-
void repeatingAction(ConfigManager* cfgMan, Panel* parentPanel);
25-
void activate(ConfigManager* cfgMan, Panel* parentPanel);
26-
27-
void setBlurredBackground(QWidget* internalWidget);
28-
QPair<int,int> getButtonCoordinates(QWidget* externalWidget,
29-
Panel* parentPanel);
30-
void preliminaryInternalWidgetSetup(QWidget* internalWidget,
31-
QWidget* externalWidget,
32-
ConfigManager* cfgMan,
33-
Panel* parentPanel,
34-
int width,
24+
QString mAppletID;
25+
AppletType mAppletType;
26+
27+
Applet(QString appletID,
28+
ConfigManager* cfgMan,
29+
Panel* parentPanel);
30+
31+
virtual void externalWidgetSetup();
32+
virtual void internalWidgetSetup();
33+
34+
void preliminaryInternalWidgetSetup(int width,
3535
int height,
3636
bool canBeTransparent);
3737

38+
void setBlurredBackground();
39+
40+
QPair<int,int> getButtonCoordinates();
41+
42+
ConfigManager* mCfgMan;
43+
Panel* mParentPanel;
44+
3845
QWidget* mExternalWidget;
3946
QWidget* mInternalWidget;
4047
};

0 commit comments

Comments
 (0)