예제 #1
0
void OptionsWindow::SaveAConfig(int step, bool nomesseage = true) {
	QSettings *GlobalSettings = new QSettings("/root/.WiFiHostapdAP/WiFi_Hostapd_AP.conf",QSettings::NativeFormat); // creating a new object
	// Функция сохраения конфигурационных файлов по маске
	// №1 - что сохраняем - 0 = только HOSTAPD; 1 - DNSMASQ
		QString temp;
		QDateTime TimeNow;
		QString dateUNIXNow;
	if(step == 0) {
		//  Save only HOSTAPD
		temp = getMaskToConfig(0);
		QFile::remove("/etc/hostapd/hostapd.conf");
		QFile hostapd_config("/etc/hostapd/hostapd.conf");
		hostapd_config.open(QIODevice::WriteOnly);
		QTextStream out(&hostapd_config);
		out << temp;
		hostapd_config.close();


		dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
		emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Hostapd config succesfully update."), QString("1")));

		// Hostapd
		if(!nomesseage) {
		QMessageBox msgBoxHostapd;
		msgBoxHostapd.setText(tr("The configuration file is updated"));
		msgBoxHostapd.setIcon(QMessageBox::Information);
		msgBoxHostapd.setInformativeText(tr("Hostapd Settings saved successfully. To enter into force, please restart the access point."));
		msgBoxHostapd.setStandardButtons(QMessageBox::Ok);
		msgBoxHostapd.setDefaultButton(QMessageBox::Ok);
		msgBoxHostapd.exec(); }
		temp.clear();
	} else {
		//  Сохраняемфайл DNSMASQ
		// 1
		temp = getMaskToConfig(1);
		QFile::remove("/etc/dnsmasq.conf");
		QFile firstDHCPConfig("/etc/dnsmasq.conf");
		firstDHCPConfig.open(QIODevice::WriteOnly);
		QTextStream out1(&firstDHCPConfig);
		out1 << temp;
		firstDHCPConfig.close();
		temp.clear();
		dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
		emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("DNSMASQ config succesfully update."), QString("1")));

		// DHCP
		if(!nomesseage) {
		QMessageBox msgBoxDHCP;
		msgBoxDHCP.setText(tr("The configuration file is updated"));
		msgBoxDHCP.setIcon(QMessageBox::Information);
		msgBoxDHCP.setInformativeText(tr("DHCP Settings saved successfully. To enter into force, please restart the access point."));
		msgBoxDHCP.setStandardButtons(QMessageBox::Ok);
		msgBoxDHCP.setDefaultButton(QMessageBox::Ok);
		msgBoxDHCP.exec(); }
		temp.clear();
	}
	delete GlobalSettings;
}
예제 #2
0
void OptionsWindow::SaveAConfig(int step, bool nomesseage = true) {
    QSettings *GlobalSettings = new QSettings("/root/.WiFiHostapdAP/WiFi_Hostapd_AP.conf",QSettings::NativeFormat); // создание нового объекта
    // Функция сохраения конфигурационных файлов по маске
    // №1 - что сохраняем - 0 = только HOSTAPD; 1 - DNSMASQ
    QString temp;
    QDateTime TimeNow;
    QString dateUNIXNow;
    if(step == 0) {
        //  Сохраняем только HOSTAPD
        temp = getMaskToConfig(0);
        QFile::remove("/etc/hostapd/hostapd.conf");
        QFile hostapd_config("/etc/hostapd/hostapd.conf");
        hostapd_config.open(QIODevice::WriteOnly);
        QTextStream out(&hostapd_config);
        out << temp;
        hostapd_config.close();


        dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
        emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Hostapd config succesfully update."), QString("1")));

        // Hostapd
        if(!nomesseage) {
            QMessageBox msgBoxHostapd;
            msgBoxHostapd.setText(tr("Конфигурационный файл обновлён"));
            msgBoxHostapd.setIcon(QMessageBox::Information);
            msgBoxHostapd.setInformativeText(tr("Настройки Hostapd успешно сохранены. Для вступления их в силу, пожалуйста, перезапустите точку доступа."));
            msgBoxHostapd.setStandardButtons(QMessageBox::Ok);
            msgBoxHostapd.setDefaultButton(QMessageBox::Ok);
            msgBoxHostapd.exec(); }
        temp.clear();
    } else {
        //  Сохраняемфайл DNSMASQ
        // 1
        temp = getMaskToConfig(1);
        QFile::remove("/etc/dnsmasq.conf");
        QFile firstDHCPConfig("/etc/dnsmasq.conf");
        firstDHCPConfig.open(QIODevice::WriteOnly);
        QTextStream out1(&firstDHCPConfig);
        out1 << temp;
        firstDHCPConfig.close();
        temp.clear();
        dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
        emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("DNSMASQ config succesfully update."), QString("1")));

        // DHCP
        if(!nomesseage) {
            QMessageBox msgBoxDHCP;
            msgBoxDHCP.setText(tr("Конфигурационный файл обновлён"));
            msgBoxDHCP.setIcon(QMessageBox::Information);
            msgBoxDHCP.setInformativeText(tr("Настройки DHCP успешно сохранены. Для вступления их в силу, пожалуйста, перезапустите точку доступа."));
            msgBoxDHCP.setStandardButtons(QMessageBox::Ok);
            msgBoxDHCP.setDefaultButton(QMessageBox::Ok);
            msgBoxDHCP.exec(); }
        temp.clear();
    }
    delete GlobalSettings;
}
예제 #3
0
void OptionsWindow::on_RestoreDHCP_clicked()
{
    /* Resets all values tab "DHCP" */
    QMessageBox msgBox;
    msgBox.setText(tr("factory reset"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Caution All settings will be reset to the original. proceed?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();
	switch (ret) {
		case QMessageBox::Ok:

		ui->IP_CLIENT1->setText("192.168.0.2");
		ui->IP_CLIENT2->setText("192.168.0.255");
		ui->Internet_iface->setCurrentIndex(0);
		ui->ip_time->setCurrentIndex(2);
		ui->UseGoogle->setChecked(true);
		QDateTime TimeNow;
		QString dateUNIXNow;
		dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
		emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("DNSMASQ settings set to default."), QString("1")));

		on_DHCPSave_clicked(false);
		break;
	}
}
예제 #4
0
void OptionsWindow::on_RestoreAP_clicked()
{
    /* Resets all values tab "Hostapd" */
    QMessageBox msgBox;
    msgBox.setText(tr("factory reset"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Caution All settings will be reset to the original. proceed?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();

    switch (ret) {
		case QMessageBox::Ok:
			ui->IP_SERVER->setText("192.168.0.1");
			ui->MASKA->setText("255.255.255.0");
			ui->SSID->setText("MyWiFI_AP");
			ui->ShowSSID->setChecked(false);
			ui->driver->setCurrentIndex(1);
			ui->Iface->setCurrentIndex(0);
			ui->TypeAP->setCurrentIndex(0);
			ui->Protection->setCurrentIndex(1);
			ui->CountryCode->setCurrentIndex(0);
			ui->Channels->setCurrentIndex(6);

			QDateTime TimeNow;
			QString dateUNIXNow;
			dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
			emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Hostapd settings set to default."), QString("1")));

			on_APSave_clicked(false);
			break; 
    }
}
예제 #5
0
void OptionsWindow::on_RestoreProg_clicked()
{
/* Resets all values in the "application" */
    QMessageBox msgBox;
    msgBox.setText(tr("factory reset"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Caution All settings will be reset to the original. proceed?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();

    switch (ret) {
		case QMessageBox::Ok:
			ui->UpdateTraffic->setValue(1);
			ui->Language->setCurrentIndex(0);
			ui->ClientPriceUpdate->setValue(5);

			QDateTime TimeNow;
			QString dateUNIXNow;
			dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
			emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Programm settings set to default."), QString("1")));

			on_ProgSave_clicked();
			break;
    }
    OptionsWindow::on_ProgSave_clicked();
}
예제 #6
0
void OptionsWindow::on_RestoreDHCP_clicked()
{
    /* Обнуляем все значения на вкладке "DHCP" */
    QMessageBox msgBox;
    msgBox.setText(tr("Сброс данных"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Внимание! Все настройки будут сброшены до первоначальных. Продолжить?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();
    switch (ret) {
    case QMessageBox::Ok:

        ui->IP_CLIENT1->setText("192.168.0.2");
        ui->IP_CLIENT2->setText("192.168.0.255");
        ui->Internet_iface->setCurrentIndex(0);
        ui->ip_time->setCurrentIndex(2);
        ui->UseGoogle->setChecked(true);
        QDateTime TimeNow;
        QString dateUNIXNow;
        dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
        emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("DNSMASQ settings set to default."), QString("1")));

        on_DHCPSave_clicked(false);
        break;
    }
}
예제 #7
0
void OptionsWindow::on_RestoreAP_clicked()
{
    /* Обнуляем все значения на вкладке "Hostapd" */
    QMessageBox msgBox;
    msgBox.setText(tr("Сброс данных"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Внимание! Все настройки будут сброшены до первоначальных. Продолжить?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();

    switch (ret) {
    case QMessageBox::Ok:
        ui->IP_SERVER->setText("192.168.0.1");
        ui->MASKA->setText("255.255.255.0");
        ui->SSID->setText("MyWiFI_AP");
        ui->ShowSSID->setChecked(false);
        ui->driver->setCurrentIndex(1);
        ui->Iface->setCurrentIndex(0);
        ui->TypeAP->setCurrentIndex(0);
        ui->Protection->setCurrentIndex(1);
        ui->CountryCode->setCurrentIndex(0);
        ui->Channels->setCurrentIndex(6);

        QDateTime TimeNow;
        QString dateUNIXNow;
        dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
        emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Hostapd settings set to default."), QString("1")));

        on_APSave_clicked(false);
        break; }
}
예제 #8
0
void OptionsWindow::on_RestoreProg_clicked()
{
    /* Обнуляем все значения на вкладке "Приложение" */
    QMessageBox msgBox;
    msgBox.setText(tr("Сброс данных"));
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setInformativeText(tr("Внимание! Все настройки будут сброшены до первоначальных. Продолжить?"));
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Cancel);
    int ret = msgBox.exec();

    switch (ret) {
    case QMessageBox::Ok:
        ui->UpdateTraffic->setValue(1);
        ui->Language->setCurrentIndex(0);
        ui->ClientPriceUpdate->setValue(5);

        QDateTime TimeNow;
        QString dateUNIXNow;
        dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
        emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Programm settings set to default."), QString("1")));

        on_ProgSave_clicked();
        break;
    }
    OptionsWindow::on_ProgSave_clicked();
}
예제 #9
0
// Save the settings from the first tab
void OptionsWindow::on_ProgSave_clicked()
{
    QSettings *GlobalSettings = new QSettings("/root/.WiFiHostapdAP/WiFi_Hostapd_AP.conf",QSettings::NativeFormat); // creating a new object
    QDateTime TimeNow;
    QString dateUNIXNow;

	GlobalSettings->setValue("Programm/UpdateTraffic", ui->UpdateTraffic->value());
	GlobalSettings->setValue("Programm/Language", ui->Language->currentIndex());
	GlobalSettings->setValue("Programm/ClientsPriceUpdateTime", ui->ClientPriceUpdate->value());

	dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
	emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Programm settings succesfully update."), QString("1")));

	// Programm settings
	QMessageBox msgBoxProgramm;
	msgBoxProgramm.setText(tr("Your settings are successfully updated"));
	msgBoxProgramm.setIcon(QMessageBox::Information);
	msgBoxProgramm.setInformativeText(tr("Changes will take effect after restarting the application."));
	msgBoxProgramm.setStandardButtons(QMessageBox::Ok);
	msgBoxProgramm.setDefaultButton(QMessageBox::Ok);
	msgBoxProgramm.exec();

    delete GlobalSettings;
}
예제 #10
0
// Сохраняем настройки из первой вкладки
void OptionsWindow::on_ProgSave_clicked()
{
    QSettings *GlobalSettings = new QSettings("/root/.WiFiHostapdAP/WiFi_Hostapd_AP.conf",QSettings::NativeFormat); // создание нового объекта
    QDateTime TimeNow;
    QString dateUNIXNow;

    GlobalSettings->setValue("Programm/UpdateTraffic", ui->UpdateTraffic->value());
    GlobalSettings->setValue("Programm/Language", ui->Language->currentIndex());
    GlobalSettings->setValue("Programm/ClientsPriceUpdateTime", ui->ClientPriceUpdate->value());

    dateUNIXNow = QString::number(TimeNow.currentDateTime().toTime_t());
    emit  toMainLog(QString("%1|%2|%3|%4").arg(tr("Options"), dateUNIXNow, tr("Programm settings succesfully update."), QString("1")));

    // Programm settings
    QMessageBox msgBoxProgramm;
    msgBoxProgramm.setText(tr("Настройки успешно обновлены"));
    msgBoxProgramm.setIcon(QMessageBox::Information);
    msgBoxProgramm.setInformativeText(tr("Изменения вступят в силу после перезапуска приложения."));
    msgBoxProgramm.setStandardButtons(QMessageBox::Ok);
    msgBoxProgramm.setDefaultButton(QMessageBox::Ok);
    msgBoxProgramm.exec();

    delete GlobalSettings;
}
예제 #11
0
void MainWindow::on_OptW_triggered()
{
    OptionsWindow OptW;
    connect(&OptW, SIGNAL(toMainLog(QString)), this, SLOT(LogSystemAppend(QString)));
    OptW.exec();
}