added settings window

This commit is contained in:
arcan1s 2014-02-27 03:53:09 +04:00
parent 710941c259
commit fbad5a6c7d
6 changed files with 599 additions and 9 deletions

View File

@ -27,12 +27,16 @@ PasswdWidget::PasswdWidget(MainWindow *wid)
ui(new Ui::PasswdWidget)
{
ui->setupUi(this);
okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
cancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
createActions();
}
PasswdWidget::~PasswdWidget()
{
delete cancelButton;
delete okButton;
delete ui;
}
@ -40,18 +44,16 @@ PasswdWidget::~PasswdWidget()
// ESC press event
void PasswdWidget::keyPressEvent(QKeyEvent *pressedKey)
{
if (pressedKey->key() == Qt::Key_Escape) {
hide();
parent->updateTabs(2);
this->~PasswdWidget();
}
if (pressedKey->key() == Qt::Key_Escape)
cancel();
}
void PasswdWidget::createActions()
{
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(passwdApply()));
connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(passwdApply()));
connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));
connect(okButton, SIGNAL(clicked(bool)), this, SLOT(passwdApply()));
}
@ -61,6 +63,14 @@ void PasswdWidget::setFocusToLineEdit()
}
void PasswdWidget::cancel()
{
hide();
parent->updateTabs(2);
this->~PasswdWidget();
}
void PasswdWidget::passwdApply()
{
hide();

View File

@ -19,6 +19,7 @@
#define PASSWDWIDGET_H
#include <QKeyEvent>
#include <QPushButton>
#include <QWidget>
@ -40,11 +41,14 @@ public slots:
void setFocusToLineEdit();
private slots:
void cancel();
void passwdApply();
private:
MainWindow *parent;
Ui::PasswdWidget *ui;
QPushButton *cancelButton;
QPushButton *okButton;
// ESC pressed event
void keyPressEvent(QKeyEvent *pressedKey);
void createActions();

View File

@ -80,9 +80,9 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Ok</string>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>

View File

@ -0,0 +1,33 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "settingswindow.h"
#include "ui_settingswindow.h"
SettingsWindow::SettingsWindow(QWidget *parent)
: QMainWindow(parent),
ui(new Ui::SettingsWindow)
{
ui->setupUi(this);
}
SettingsWindow::~SettingsWindow()
{
delete ui;
}

View File

@ -0,0 +1,41 @@
/***************************************************************************
* This file is part of netctl-plasmoid *
* *
* netctl-plasmoid is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-plasmoid is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-plasmoid. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef SETTINGSWINDOW_H
#define SETTINGSWINDOW_H
#include <QMainWindow>
namespace Ui {
class SettingsWindow;
}
class SettingsWindow : public QMainWindow
{
Q_OBJECT
public:
explicit SettingsWindow(QWidget *parent = 0);
~SettingsWindow();
private:
Ui::SettingsWindow *ui;
};
#endif /* SETTINGSWINDOW_H */

View File

@ -0,0 +1,502 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsWindow</class>
<widget class="QMainWindow" name="SettingsWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<height>287</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_general">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="layout_language">
<item>
<widget class="QLabel" name="label_language">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_language">
<property name="toolTip">
<string>Select a language</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_info">
<property name="text">
<string>You will need to restart the application</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer_general">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_netctl">
<attribute name="title">
<string>netctl</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="layout_netctlPath">
<item>
<widget class="QLabel" name="label_netctlPath">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>netctl path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_netctlPath">
<property name="toolTip">
<string>Path to netctl</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_netctlPath">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_profilePath">
<item>
<widget class="QLabel" name="label_profilePath">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Profile path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_profilePath">
<property name="toolTip">
<string>Path to profile directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_profilePath">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_netctl">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_sudo">
<attribute name="title">
<string>sudo</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="layout_sudo">
<item>
<widget class="QLabel" name="label_sudo">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>sudo path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_sudo">
<property name="toolTip">
<string>Path to sudo</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_sudo">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_sudo">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>192</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_wpaSup">
<attribute name="title">
<string>wpa_supplicant</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="layout_wpaSupPath">
<item>
<widget class="QLabel" name="label_wpaSupPath">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>wpa_supplicant path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wpaSupPath">
<property name="toolTip">
<string>Path to wpa_supplicant</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_wpaSupPath">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_wpaCliPath">
<item>
<widget class="QLabel" name="label_wpaCliPath">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>wpa_cli path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wpaCliPath">
<property name="toolTip">
<string>Path to wpa_cli</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_wpaCliPath">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_pid">
<item>
<widget class="QLabel" name="label_pid">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>PID file</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_pid">
<property name="toolTip">
<string>wpa_supplicant PID file</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_wpaSupDrivers">
<item>
<widget class="QLabel" name="label_wpaSupDrivers">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>wpa_supplicant drivers</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wpaSupDrivers">
<property name="toolTip">
<string>wpa_supplicant drivers comma separated</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_wpaDir">
<item>
<widget class="QLabel" name="label_wpaDir">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>ctrl_interface directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wpaDir">
<property name="toolTip">
<string>Path to control directory</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_wpaGroup">
<item>
<widget class="QLabel" name="label_wpaGroup">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>ctrl_interface group</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wpaGroup">
<property name="toolTip">
<string>Group of control directory</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_wpaSup">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_other">
<attribute name="title">
<string>Other</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="layout_interfacesDir">
<item>
<widget class="QLabel" name="label_interfacesDir">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Path to interface list</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_interfacesDir">
<property name="toolTip">
<string>Path to directory which contains network devices</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_interfaceDir">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_rfkill">
<item>
<widget class="QLabel" name="label_rfkill">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Path to rfkill device list</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_rfkill">
<property name="toolTip">
<string>Path to directory which contains rfkill devices</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_rfkill">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_interface">
<item>
<widget class="QLabel" name="label_interface">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Prefered wireless interface</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_interface">
<property name="toolTip">
<string>Prefered wireless interface</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="spacer_other">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>130</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>