small changes before work on plasmoid

This commit is contained in:
arcan1s 2014-03-21 19:11:47 +04:00
parent 028b636d22
commit 80e4b3e3d3
5 changed files with 21 additions and 32 deletions

View File

@ -9,7 +9,7 @@ pkgver=1.0.0
pkgrel=1
pkgdesc="Qt4 GUI for netctl. Provides a plasmoid for KDE4"
arch=('i686' 'x86_64')
url="http://arcan1s.github.io/projects/netctlplasmoid"
url="http://arcanis.name/projects/netctl-gui"
license=('GPLv3')
depends=('netctl' 'qt4')
makedepends=('automoc4' 'cmake' 'desktop-file-utils' 'xdg-utils')
@ -18,7 +18,7 @@ optdepends=('kdebase-runtime: sudo support'
'wpa_supplicant: wifi support')
source=("https://github.com/arcan1s/netctlplasmoid/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
install="${pkgname}.install"
md5sums=('866d6b7b819a43f1661ef133f3b255da')
md5sums=('5e7573643d528f770fca2dc3e2122e69')
# flags
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"

View File

@ -15,19 +15,12 @@ configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ver
message (STATUS "Version: ${PROJECT_VERSION}")
# install options
option (WITH_DEBUG_MODE "Build with debug mode" OFF)
option (BUILD_GUI "Build GUI" ON)
option (BUILD_DATAENGINE "Build data engine" ON)
option (BUILD_PLASMOID "Build plasmoid" ON)
option (BUILD_SCRIPTS "Build special scripts" ON)
# verbose
set (CMAKE_VERBOSE_MAKEFILE ON)
# flags
if (WITH_DEBUG_MODE)
add_definitions (-DDEBUG_MODE=1)
endif ()
if (CMAKE_COMPILER_IS_GNUCXX)
set (ADD_CXX_FLAGS "-Wall")
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")

View File

@ -206,9 +206,9 @@ bool Netctl::updateSourceEvent(const QString &source)
QStringList profile = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profile.count(); i++)
if (profile[i].split(QString(" "), QString::SkipEmptyParts)[0] == QString("Loaded:")) {
if (profile[i].indexOf(QString("enabled")) > -1)
if (profile[i].contains(QString("enabled")))
value = QString("enabled");
else if (profile[i].indexOf(QString("static")) > -1)
else if (profile[i].contains(QString("static")))
value = QString("static");
break;
}

View File

@ -71,34 +71,31 @@ void Netctl::init()
iconFrame = new Plasma::Frame();
QGraphicsLinearLayout *iconLayout = new QGraphicsLinearLayout();
iconWidget = new Plasma::IconWidget(KIcon(""), QString(), this);
iconWidget->setPreferredWidth(30);
iconWidget->setPreferredHeight(30);
iconWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(iconWidget, SIGNAL(doubleClicked()), this, SLOT(showGui()));
iconFrame->setLayout(iconLayout);
iconLayout->addItem(iconWidget);
fullSpaceLayout->addItem(iconFrame);
// text
textFrame = new Plasma::Frame();
QGraphicsLinearLayout *textLayout = new QGraphicsLinearLayout();
textLabel = new Plasma::Label();
textLabel->setPreferredHeight(30);
textLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
textLayout->addItem(textLabel);
textFrame->setLayout(textLayout);
fullSpaceLayout->addItem(textFrame);
textFrame->hide();
// stretch
fullSpaceLayout->addStretch(1);
// read variables
configChanged();
}
void Netctl::addTextFrame(const bool state)
{
if (state) {
textFrame = new Plasma::Frame();
QGraphicsLinearLayout *textLayout = new QGraphicsLinearLayout();
textLabel = new Plasma::Label();
textLayout->addItem(textLabel);
textFrame->setLayout(textLayout);
fullSpaceLayout->addItem(textFrame);
}
else {
fullSpaceLayout->removeItem(textFrame);
delete textLabel;
delete textFrame;
}
}
void Netctl::updateWidget()
{
update();
@ -251,7 +248,7 @@ void Netctl::connectToEngine()
netctlEngine->connectSource(QString("intIp"), this, autoUpdateInterval);
if (showNetDev)
netctlEngine->connectSource(QString("interfaces"), this, autoUpdateInterval);
addTextFrame(true);
textFrame->show();
}
updateWidget();
}
@ -270,7 +267,7 @@ void Netctl::disconnectFromEngine()
netctlEngine->disconnectSource(QString("intIp"), this);
if (showNetDev)
netctlEngine->disconnectSource(QString("interfaces"), this);
addTextFrame(false);
textFrame->hide();
}
updateWidget();
}

View File

@ -53,7 +53,6 @@ public slots:
private slots:
// main interface
void addTextFrame(const bool state = true);
void updateWidget();
// configuration interface
void selectGuiExe();