mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-19 21:29:59 +01:00
got Users menu working
This commit is contained in:
@@ -42,6 +42,7 @@ void generate_map() {
|
|||||||
std::string name = "plugin " + plugins.plugin_list[j]->name();
|
std::string name = "plugin " + plugins.plugin_list[j]->name();
|
||||||
filter_map[name] = FilterValue(2, j, -1);
|
filter_map[name] = FilterValue(2, j, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void custom_filter(cv::Mat &) {
|
void custom_filter(cv::Mat &) {
|
||||||
@@ -60,6 +61,7 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||||||
generate_map();
|
generate_map();
|
||||||
ac::init_filter_menu_map();
|
ac::init_filter_menu_map();
|
||||||
ac::SortFilters();
|
ac::SortFilters();
|
||||||
|
ac::filter_menu_map["User"].menu_list->push_back("No Filter");
|
||||||
setGeometry(100, 100, 800, 700);
|
setGeometry(100, 100, 800, 700);
|
||||||
setFixedSize(800, 700);
|
setFixedSize(800, 700);
|
||||||
setWindowTitle(tr("Acid Cam v2 - Qt"));
|
setWindowTitle(tr("Acid Cam v2 - Qt"));
|
||||||
@@ -107,6 +109,7 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||||||
chroma_window->hide();
|
chroma_window->hide();
|
||||||
define_window = new DefineWindow(this);
|
define_window = new DefineWindow(this);
|
||||||
define_window->hide();
|
define_window->hide();
|
||||||
|
define_window->main_window = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -648,9 +651,7 @@ void AC_MainWindow::colorMapChanged(int pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::comboFilterChanged(int) {
|
void AC_MainWindow::comboFilterChanged(int) {
|
||||||
|
|
||||||
if(loading == true) return;
|
if(loading == true) return;
|
||||||
|
|
||||||
playback->setIndexChanged(filters->currentText().toStdString());
|
playback->setIndexChanged(filters->currentText().toStdString());
|
||||||
QString str;
|
QString str;
|
||||||
QTextStream stream(&str);
|
QTextStream stream(&str);
|
||||||
@@ -1258,8 +1259,8 @@ void AC_MainWindow::openColorWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::menuFilterChanged(int index) {
|
void AC_MainWindow::menuFilterChanged(int index) {
|
||||||
loading = true;
|
if(index >= 0) {
|
||||||
if(index >= 0 && index < menu_cat->count()) {
|
loading = true;
|
||||||
const char *menu_n = menuNames[index];
|
const char *menu_n = menuNames[index];
|
||||||
filters->clear();
|
filters->clear();
|
||||||
auto v = ac::filter_menu_map[menu_n].menu_list;
|
auto v = ac::filter_menu_map[menu_n].menu_list;
|
||||||
@@ -1267,10 +1268,19 @@ void AC_MainWindow::menuFilterChanged(int index) {
|
|||||||
filters->addItem(in->c_str());
|
filters->addItem(in->c_str());
|
||||||
}
|
}
|
||||||
filters->setCurrentIndex(0);
|
filters->setCurrentIndex(0);
|
||||||
|
loading = false;
|
||||||
}
|
}
|
||||||
loading = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AC_MainWindow::show_Favorites() {
|
void AC_MainWindow::show_Favorites() {
|
||||||
define_window->show();
|
define_window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AC_MainWindow::resetMenu() {
|
||||||
|
int index = menu_cat->currentIndex();
|
||||||
|
if(menuNames[index] == std::string("User")) {
|
||||||
|
menuFilterChanged(index);
|
||||||
|
filters->setCurrentIndex(0);
|
||||||
|
comboFilterChanged(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
void updateList();
|
void updateList();
|
||||||
void setSubFilter(const QString &num);
|
void setSubFilter(const QString &num);
|
||||||
void setFrameIndex(int i);
|
void setFrameIndex(int i);
|
||||||
|
void resetMenu();
|
||||||
public slots:
|
public slots:
|
||||||
void addClicked();
|
void addClicked();
|
||||||
void rmvClicked();
|
void rmvClicked();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#ifndef _QT_HEADERS__
|
#ifndef _QT_HEADERS__
|
||||||
#define _QT_HEADERS__
|
#define _QT_HEADERS__
|
||||||
#define ac_version "v1.21.0"
|
#define ac_version "v1.22.0"
|
||||||
#include<QApplication>
|
#include<QApplication>
|
||||||
#include<QMainWindow>
|
#include<QMainWindow>
|
||||||
#include<QDialog>
|
#include<QDialog>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
#include "user_define.h"
|
#include "user_define.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
DefineWindow::DefineWindow(QWidget *p) : QMainWindow(p) {
|
DefineWindow::DefineWindow(QWidget *p) : QMainWindow(p) {
|
||||||
setFixedSize(640, 320);
|
setFixedSize(640, 320);
|
||||||
@@ -26,8 +27,36 @@ void DefineWindow::createControls() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DefineWindow::setFilterName() {
|
void DefineWindow::setFilterName() {
|
||||||
|
QString filter_name = def_filters->currentText();
|
||||||
|
QString filter_text = def_newname->text();
|
||||||
|
if(filter_text.length() > 0) {
|
||||||
|
std::string real_final_name = "User_";
|
||||||
|
real_final_name += filter_text.toStdString();
|
||||||
|
std::string sval = filter_name.toStdString();
|
||||||
|
if(sval.find("Image") != std::string::npos)
|
||||||
|
real_final_name += "_Image";
|
||||||
|
if(sval.find("SubFilter") != std::string::npos)
|
||||||
|
real_final_name += "_SubFilter";
|
||||||
|
std::vector<std::string> *v = ac::filter_menu_map["User"].menu_list;
|
||||||
|
v->push_back(real_final_name);
|
||||||
|
std::string ft = filter_name.toStdString();
|
||||||
|
std::string fn = real_final_name;
|
||||||
|
filter_map[fn].index = 0;
|
||||||
|
filter_map[fn].filter = filter_map[ft].filter;
|
||||||
|
filter_map[fn].subfilter = -1;
|
||||||
|
main_window->resetMenu();
|
||||||
|
def_list->addItem(real_final_name.c_str());
|
||||||
|
def_newname->setText("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void DefineWindow::clearFilterNames() {
|
void DefineWindow::clearFilterNames() {
|
||||||
|
std::vector<std::string> *v = ac::filter_menu_map["User"].menu_list;
|
||||||
|
if(!v->empty()) {
|
||||||
|
v->erase(v->begin(), v->end());
|
||||||
|
v->push_back("No Filter");
|
||||||
|
while(def_list->count() > 0) {
|
||||||
|
def_list->takeItem(0);
|
||||||
|
}
|
||||||
|
main_window->resetMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,17 @@
|
|||||||
|
|
||||||
#include "qtheaders.h"
|
#include "qtheaders.h"
|
||||||
|
|
||||||
|
class AC_MainWindow;
|
||||||
|
|
||||||
class DefineWindow : public QMainWindow {
|
class DefineWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DefineWindow(QWidget *p);
|
DefineWindow(QWidget *p);
|
||||||
void createControls();
|
void createControls();
|
||||||
|
AC_MainWindow *main_window;
|
||||||
public slots:
|
public slots:
|
||||||
void setFilterName();
|
void setFilterName();
|
||||||
void clearFilterNames();
|
void clearFilterNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QComboBox *def_filters;
|
QComboBox *def_filters;
|
||||||
QListWidget *def_list;
|
QListWidget *def_list;
|
||||||
|
|||||||
Reference in New Issue
Block a user