void IPFilterFrame::InitDocument() { if (WBGET(WB_IPFILTER_ENABLED)) { checkBox_ENABLE->setChecked(true); } else checkBox_ENABLE->setChecked(false); if (!model) model = new IPFilterModel(this); treeView_RULES->setModel(model); treeView_RULES->setContextMenuPolicy(Qt::CustomContextMenu); treeView_RULES->setAlternatingRowColors(true); slotCheckBoxClick(); connect(checkBox_ENABLE, SIGNAL(clicked()), this, SLOT(slotCheckBoxClick())); connect(pushButton_EXPORT, SIGNAL(clicked()), this, SLOT(slotExport())); connect(pushButton_IMPORT, SIGNAL(clicked()), this, SLOT(slotImport())); connect(pushButton_ADD, SIGNAL(clicked()), this, SLOT(slotAddRule())); connect(pushButton_UP, SIGNAL(clicked()), this, SLOT(slotUpDownClick())); connect(pushButton_DOWN, SIGNAL(clicked()), this, SLOT(slotUpDownClick())); connect(treeView_RULES, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotTreeViewContextMenu(QPoint))); }
RulesEditor::RulesEditor(DataBaseManager* db, ServiceManager* sv_man, QWidget *parent) : QWidget(parent) , database_manager_(db) , service_manager_(sv_man) { setWindowTitle("Редактор правил"); setFixedSize(400, 400); QGroupBox* field_names_combo = new QGroupBox("Имена полей"); QTextEdit* names = new QTextEdit(); names->setReadOnly(true); names->setText(QString("Время начала сессии: ") + "StartTime \n" + "Время конца сессии: " + "EndTime\n" + "Имя Exe файла: " + "ExeName \n" + "Название приложения: " + "Name\n" + "Тип приложения: " + "Type\n" + "Web адрес: " + "Uri\n" + "Заголовок окна: " + "Title \n\n Пример : \n Name LIKE \"%Skype%\" AND Type = \"Браузер\" \n!!!Идентификаторы должны быть в двойных кавычках!!!"); names->setStyleSheet(QString::fromUtf8("background-color: rgb(240, 240, 240);")); QHBoxLayout* l_names = new QHBoxLayout(); l_names->addWidget(names); field_names_combo->setLayout(l_names); QLabel* rule_label = new QLabel("Правило :"); rule_edit_ = new QLineEdit(); b_add_rule_ = new QPushButton("Добавить"); initRuleTypeBox(); priority_slider_ = new QSlider(Qt::Horizontal); priority_slider_->setRange(1,10); priority_slider_->setTickInterval(1); priority_slider_->setTickPosition(QSlider::TicksAbove); QLabel* slider_label = new QLabel("Приоритет"); QVBoxLayout* v_layout1 = new QVBoxLayout(); v_layout1->addWidget(slider_label); v_layout1->addWidget(priority_slider_); v_layout1->addWidget(b_add_rule_); QHBoxLayout* h_layout = new QHBoxLayout(); h_layout->addWidget(rule_type_box_); h_layout->addLayout(v_layout1); QVBoxLayout* v_layout = new QVBoxLayout(); v_layout->addWidget(field_names_combo); v_layout->addWidget(rule_label); v_layout->addWidget(rule_edit_); v_layout->addLayout(h_layout); setLayout(v_layout); QObject::connect(b_add_rule_, SIGNAL(clicked()), this, SLOT(slotAddRule())); }