mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-14 22:35:51 +00:00
small changes before work on plasmoid
This commit is contained in:
@ -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}")
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ public slots:
|
||||
|
||||
private slots:
|
||||
// main interface
|
||||
void addTextFrame(const bool state = true);
|
||||
void updateWidget();
|
||||
// configuration interface
|
||||
void selectGuiExe();
|
||||
|
Reference in New Issue
Block a user