mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
update netctlProfileInfo structure
This commit is contained in:
parent
067115280c
commit
0bade9c42f
@ -413,7 +413,8 @@ void MainWindow::updateMainTab()
|
|||||||
QStringList headerList;
|
QStringList headerList;
|
||||||
headerList.append(QApplication::translate("MainWindow", "Name"));
|
headerList.append(QApplication::translate("MainWindow", "Name"));
|
||||||
headerList.append(QApplication::translate("MainWindow", "Description"));
|
headerList.append(QApplication::translate("MainWindow", "Description"));
|
||||||
headerList.append(QApplication::translate("MainWindow", "Status"));
|
headerList.append(QApplication::translate("MainWindow", "Active"));
|
||||||
|
headerList.append(QApplication::translate("MainWindow", "Enabled"));
|
||||||
ui->tableWidget_main->setHorizontalHeaderLabels(headerList);
|
ui->tableWidget_main->setHorizontalHeaderLabels(headerList);
|
||||||
// create items
|
// create items
|
||||||
for (int i=0; i<profiles.count(); i++) {
|
for (int i=0; i<profiles.count(); i++) {
|
||||||
@ -424,8 +425,27 @@ void MainWindow::updateMainTab()
|
|||||||
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||||
ui->tableWidget_main->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
ui->tableWidget_main->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
// status
|
// status
|
||||||
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(profiles[i].status));
|
if (profiles[i].active) {
|
||||||
ui->tableWidget_main->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
// active
|
||||||
|
QFont font;
|
||||||
|
font.setBold(true);
|
||||||
|
ui->tableWidget_main->item(i, 0)->setFont(font);
|
||||||
|
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(QApplication::translate("MainWindow", "yes")));
|
||||||
|
ui->tableWidget_main->item(i, 2)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(QString("")));
|
||||||
|
if (profiles[i].enabled) {
|
||||||
|
// enabled
|
||||||
|
ui->tableWidget_main->setItem(i, 3, new QTableWidgetItem(QApplication::translate("MainWindow", "yes")));
|
||||||
|
ui->tableWidget_main->item(i, 3)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QFont font;
|
||||||
|
font.setItalic(true);
|
||||||
|
ui->tableWidget_main->item(i, 0)->setFont(font);
|
||||||
|
ui->tableWidget_main->setItem(i, 3, new QTableWidgetItem(QString("")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->tableWidget_main->setSortingEnabled(true);
|
ui->tableWidget_main->setSortingEnabled(true);
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>477</width>
|
<width>475</width>
|
||||||
<height>505</height>
|
<height>503</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -92,7 +92,15 @@
|
|||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Status</string>
|
<string>Active</string>
|
||||||
|
</property>
|
||||||
|
<property name="textAlignment">
|
||||||
|
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enabled</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textAlignment">
|
<property name="textAlignment">
|
||||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||||
@ -206,8 +214,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>445</width>
|
<width>443</width>
|
||||||
<height>349</height>
|
<height>347</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -367,7 +375,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>477</width>
|
<width>475</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -573,7 +581,9 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionReport">
|
<action name="actionReport">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="tools-report-bug"/>
|
<iconset theme="tools-report-bug">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Report a bug</string>
|
<string>Report a bug</string>
|
||||||
|
@ -134,7 +134,8 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
|
|||||||
// description
|
// description
|
||||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||||
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
if (profiles[i].status == QString("*")) {
|
// status
|
||||||
|
if (profiles[i].active) {
|
||||||
// active
|
// active
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
@ -144,7 +145,7 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(QString("")));
|
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(QString("")));
|
||||||
if (profiles[i].status == QString("!")) {
|
if (profiles[i].enabled) {
|
||||||
// disabled
|
// disabled
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setItalic(true);
|
font.setItalic(true);
|
||||||
|
@ -40,14 +40,17 @@ class NetctlProfile;
|
|||||||
* profile name
|
* profile name
|
||||||
* @var netctlProfileInfo::description
|
* @var netctlProfileInfo::description
|
||||||
* profile description
|
* profile description
|
||||||
* @var netctlProfileInfo::status
|
* @var netctlProfileInfo::active
|
||||||
|
* profile status
|
||||||
|
* @var netctlProfileInfo::enabled
|
||||||
* profile status
|
* profile status
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString status;
|
bool active;
|
||||||
|
bool enabled;
|
||||||
} netctlProfileInfo;
|
} netctlProfileInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +164,8 @@ QList<netctlProfileInfo> Netctl::getProfileList()
|
|||||||
netctlProfileInfo profileInfo;
|
netctlProfileInfo profileInfo;
|
||||||
profileInfo.name = output[i].mid(2, -1);
|
profileInfo.name = output[i].mid(2, -1);
|
||||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||||
profileInfo.status = getProfileStatus(profileInfo.name);
|
profileInfo.active = isProfileActive(profileInfo.name);
|
||||||
|
profileInfo.enabled = isProfileEnabled(profileInfo.name);
|
||||||
fullProfilesInfo.append(profileInfo);
|
fullProfilesInfo.append(profileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +187,8 @@ QList<netctlProfileInfo> Netctl::getProfileListFromNetctlAuto()
|
|||||||
netctlProfileInfo profileInfo;
|
netctlProfileInfo profileInfo;
|
||||||
profileInfo.name = output[i].mid(2, -1);
|
profileInfo.name = output[i].mid(2, -1);
|
||||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||||
profileInfo.status = output[i].left(1);
|
profileInfo.active = autoIsProfileActive(profileInfo.name);
|
||||||
|
profileInfo.enabled = autoIsProfileEnabled(profileInfo.name);
|
||||||
fullProfilesInfo.append(profileInfo);
|
fullProfilesInfo.append(profileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +274,7 @@ bool Netctl::autoIsProfileActive(const QString profile)
|
|||||||
bool status = false;
|
bool status = false;
|
||||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||||
for (int i=0; i<profiles.count(); i++)
|
for (int i=0; i<profiles.count(); i++)
|
||||||
if ((profiles[i].name == profile) && (profiles[i].status == QString("*"))) {
|
if ((profiles[i].name == profile) && (profiles[i].active)) {
|
||||||
status = true;
|
status = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -292,7 +294,7 @@ bool Netctl::autoIsProfileEnabled(const QString profile)
|
|||||||
bool status = true;
|
bool status = true;
|
||||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||||
for (int i=0; i<profiles.count(); i++)
|
for (int i=0; i<profiles.count(); i++)
|
||||||
if ((profiles[i].name == profile) && (profiles[i].status == QString("!"))) {
|
if ((profiles[i].name == profile) && (!profiles[i].enabled)) {
|
||||||
status = false;
|
status = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user