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;
|
||||
headerList.append(QApplication::translate("MainWindow", "Name"));
|
||||
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);
|
||||
// create items
|
||||
for (int i=0; i<profiles.count(); i++) {
|
||||
@ -424,9 +425,28 @@ void MainWindow::updateMainTab()
|
||||
ui->tableWidget_main->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||
ui->tableWidget_main->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
// status
|
||||
ui->tableWidget_main->setItem(i, 2, new QTableWidgetItem(profiles[i].status));
|
||||
if (profiles[i].active) {
|
||||
// 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->resizeRowsToContents();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<height>505</height>
|
||||
<width>475</width>
|
||||
<height>503</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -92,7 +92,15 @@
|
||||
</column>
|
||||
<column>
|
||||
<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 name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
@ -206,8 +214,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>349</height>
|
||||
<width>443</width>
|
||||
<height>347</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -367,7 +375,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<width>475</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -573,7 +581,9 @@
|
||||
</action>
|
||||
<action name="actionReport">
|
||||
<property name="icon">
|
||||
<iconset theme="tools-report-bug"/>
|
||||
<iconset theme="tools-report-bug">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Report a bug</string>
|
||||
|
@ -134,7 +134,8 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
|
||||
// description
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(profiles[i].description));
|
||||
ui->tableWidget->item(i, 1)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
if (profiles[i].status == QString("*")) {
|
||||
// status
|
||||
if (profiles[i].active) {
|
||||
// active
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
@ -144,7 +145,7 @@ void NetctlAutoWindow::netctlAutoUpdateTable()
|
||||
}
|
||||
else
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(QString("")));
|
||||
if (profiles[i].status == QString("!")) {
|
||||
if (profiles[i].enabled) {
|
||||
// disabled
|
||||
QFont font;
|
||||
font.setItalic(true);
|
||||
|
@ -40,14 +40,17 @@ class NetctlProfile;
|
||||
* profile name
|
||||
* @var netctlProfileInfo::description
|
||||
* profile description
|
||||
* @var netctlProfileInfo::status
|
||||
* @var netctlProfileInfo::active
|
||||
* profile status
|
||||
* @var netctlProfileInfo::enabled
|
||||
* profile status
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
QString status;
|
||||
bool active;
|
||||
bool enabled;
|
||||
} netctlProfileInfo;
|
||||
|
||||
/**
|
||||
|
@ -164,7 +164,8 @@ QList<netctlProfileInfo> Netctl::getProfileList()
|
||||
netctlProfileInfo profileInfo;
|
||||
profileInfo.name = output[i].mid(2, -1);
|
||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||
profileInfo.status = getProfileStatus(profileInfo.name);
|
||||
profileInfo.active = isProfileActive(profileInfo.name);
|
||||
profileInfo.enabled = isProfileEnabled(profileInfo.name);
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
|
||||
@ -186,7 +187,8 @@ QList<netctlProfileInfo> Netctl::getProfileListFromNetctlAuto()
|
||||
netctlProfileInfo profileInfo;
|
||||
profileInfo.name = output[i].mid(2, -1);
|
||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||
profileInfo.status = output[i].left(1);
|
||||
profileInfo.active = autoIsProfileActive(profileInfo.name);
|
||||
profileInfo.enabled = autoIsProfileEnabled(profileInfo.name);
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
|
||||
@ -272,7 +274,7 @@ bool Netctl::autoIsProfileActive(const QString profile)
|
||||
bool status = false;
|
||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@ -292,7 +294,7 @@ bool Netctl::autoIsProfileEnabled(const QString profile)
|
||||
bool status = true;
|
||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user