Initial commit
57
appinit.cpp
Executable file
@@ -0,0 +1,57 @@
|
||||
#include "appinit.h"
|
||||
#include "qmutex.h"
|
||||
#include "qapplication.h"
|
||||
#include "qevent.h"
|
||||
#include "qwidget.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QScopedPointer<AppInit> AppInit::self;
|
||||
AppInit *AppInit::Instance()
|
||||
{
|
||||
if (self.isNull()) {
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (self.isNull()) {
|
||||
self.reset(new AppInit);
|
||||
}
|
||||
}
|
||||
|
||||
return self.data();
|
||||
}
|
||||
|
||||
AppInit::AppInit(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool AppInit::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
QWidget *w = (QWidget *)watched;
|
||||
if (!w->property("canMove").toBool()) {
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
static QPoint mousePoint;
|
||||
static bool mousePressed = false;
|
||||
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
mousePressed = true;
|
||||
mousePoint = mouseEvent->globalPos() - w->pos();
|
||||
}
|
||||
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
||||
mousePressed = false;
|
||||
} else if (mouseEvent->type() == QEvent::MouseMove) {
|
||||
if (mousePressed) {
|
||||
w->move(mouseEvent->globalPos() - mousePoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void AppInit::start()
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
22
appinit.h
Executable file
@@ -0,0 +1,22 @@
|
||||
#ifndef APPINIT_H
|
||||
#define APPINIT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class AppInit : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AppInit *Instance();
|
||||
explicit AppInit(QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
static QScopedPointer<AppInit> self;
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
};
|
||||
#endif // APPINIT_H
|
||||
597
cJSON.c
Executable file
@@ -0,0 +1,597 @@
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* cJSON */
|
||||
/* JSON parser in C. */
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include "cJSON.h"
|
||||
|
||||
static const char *ep;
|
||||
|
||||
const char *cJSON_GetErrorPtr(void) {return ep;}
|
||||
|
||||
static int cJSON_strcasecmp(const char *s1,const char *s2)
|
||||
{
|
||||
if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
|
||||
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0;
|
||||
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
|
||||
}
|
||||
|
||||
static void *(*cJSON_malloc)(size_t sz) = malloc;
|
||||
static void (*cJSON_free)(void *ptr) = free;
|
||||
|
||||
static char* cJSON_strdup(const char* str)
|
||||
{
|
||||
size_t len;
|
||||
char* copy;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
if (!(copy = (char*)cJSON_malloc(len))) return 0;
|
||||
memcpy(copy,str,len);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void cJSON_InitHooks(cJSON_Hooks* hooks)
|
||||
{
|
||||
if (!hooks) { /* Reset hooks */
|
||||
cJSON_malloc = malloc;
|
||||
cJSON_free = free;
|
||||
return;
|
||||
}
|
||||
|
||||
cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
|
||||
cJSON_free = (hooks->free_fn)?hooks->free_fn:free;
|
||||
}
|
||||
|
||||
/* Internal constructor. */
|
||||
static cJSON *cJSON_New_Item(void)
|
||||
{
|
||||
cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));
|
||||
if (node) memset(node,0,sizeof(cJSON));
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Delete a cJSON structure. */
|
||||
void cJSON_Delete(cJSON *c)
|
||||
{
|
||||
cJSON *next;
|
||||
while (c)
|
||||
{
|
||||
next=c->next;
|
||||
if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child);
|
||||
if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
|
||||
if (c->string) cJSON_free(c->string);
|
||||
cJSON_free(c);
|
||||
c=next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the input text to generate a number, and populate the result into item. */
|
||||
static const char *parse_number(cJSON *item,const char *num)
|
||||
{
|
||||
double n=0,sign=1,scale=0;int subscale=0,signsubscale=1;
|
||||
|
||||
if (*num=='-') sign=-1,num++; /* Has sign? */
|
||||
if (*num=='0') num++; /* is zero */
|
||||
if (*num>='1' && *num<='9') do n=(n*10.0)+(*num++ -'0'); while (*num>='0' && *num<='9'); /* Number? */
|
||||
if (*num=='.' && num[1]>='0' && num[1]<='9') {num++; do n=(n*10.0)+(*num++ -'0'),scale--; while (*num>='0' && *num<='9');} /* Fractional part? */
|
||||
if (*num=='e' || *num=='E') /* Exponent? */
|
||||
{ num++;if (*num=='+') num++; else if (*num=='-') signsubscale=-1,num++; /* With sign? */
|
||||
while (*num>='0' && *num<='9') subscale=(subscale*10)+(*num++ - '0'); /* Number? */
|
||||
}
|
||||
|
||||
n=sign*n*pow(10.0,(scale+subscale*signsubscale)); /* number = +/- number.fraction * 10^+/- exponent */
|
||||
|
||||
item->valuedouble=n;
|
||||
item->valueint=(int)n;
|
||||
item->type=cJSON_Number;
|
||||
return num;
|
||||
}
|
||||
|
||||
/* Render the number nicely from the given item into a string. */
|
||||
static char *print_number(cJSON *item)
|
||||
{
|
||||
char *str;
|
||||
double d=item->valuedouble;
|
||||
if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN)
|
||||
{
|
||||
str=(char*)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */
|
||||
if (str) sprintf(str,"%d",item->valueint);
|
||||
}
|
||||
else
|
||||
{
|
||||
str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */
|
||||
if (str)
|
||||
{
|
||||
if (fabs(floor(d)-d)<=DBL_EPSILON && fabs(d)<1.0e60)sprintf(str,"%.0f",d);
|
||||
else if (fabs(d)<1.0e-6 || fabs(d)>1.0e9) sprintf(str,"%e",d);
|
||||
else sprintf(str,"%f",d);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static unsigned parse_hex4(const char *str)
|
||||
{
|
||||
unsigned h=0;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
return h;
|
||||
}
|
||||
|
||||
/* Parse the input text into an unescaped cstring, and populate item. */
|
||||
static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
static const char *parse_string(cJSON *item,const char *str)
|
||||
{
|
||||
const char *ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;
|
||||
if (*str!='\"') {ep=str;return 0;} /* not a string! */
|
||||
|
||||
while (*ptr!='\"' && *ptr && ++len) if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */
|
||||
|
||||
out=(char*)cJSON_malloc(len+1); /* This is how long we need for the string, roughly. */
|
||||
if (!out) return 0;
|
||||
|
||||
ptr=str+1;ptr2=out;
|
||||
while (*ptr!='\"' && *ptr)
|
||||
{
|
||||
if (*ptr!='\\') *ptr2++=*ptr++;
|
||||
else
|
||||
{
|
||||
ptr++;
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'b': *ptr2++='\b'; break;
|
||||
case 'f': *ptr2++='\f'; break;
|
||||
case 'n': *ptr2++='\n'; break;
|
||||
case 'r': *ptr2++='\r'; break;
|
||||
case 't': *ptr2++='\t'; break;
|
||||
case 'u': /* transcode utf16 to utf8. */
|
||||
uc=parse_hex4(ptr+1);ptr+=4; /* get the unicode char. */
|
||||
|
||||
if ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) break; /* check for invalid. */
|
||||
|
||||
if (uc>=0xD800 && uc<=0xDBFF) /* UTF16 surrogate pairs. */
|
||||
{
|
||||
if (ptr[1]!='\\' || ptr[2]!='u') break; /* missing second-half of surrogate. */
|
||||
uc2=parse_hex4(ptr+3);ptr+=6;
|
||||
if (uc2<0xDC00 || uc2>0xDFFF) break; /* invalid second-half of surrogate. */
|
||||
uc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));
|
||||
}
|
||||
|
||||
len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;
|
||||
|
||||
switch (len) {
|
||||
case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 1: *--ptr2 =(uc | firstByteMark[len]);
|
||||
}
|
||||
ptr2+=len;
|
||||
break;
|
||||
default: *ptr2++=*ptr; break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
*ptr2=0;
|
||||
if (*ptr=='\"') ptr++;
|
||||
item->valuestring=out;
|
||||
item->type=cJSON_String;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Render the cstring provided to an escaped version that can be printed. */
|
||||
static char *print_string_ptr(const char *str)
|
||||
{
|
||||
const char *ptr;char *ptr2,*out;int len=0;unsigned char token;
|
||||
|
||||
if (!str) return cJSON_strdup("");
|
||||
ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;}
|
||||
|
||||
out=(char*)cJSON_malloc(len+3);
|
||||
if (!out) return 0;
|
||||
|
||||
ptr2=out;ptr=str;
|
||||
*ptr2++='\"';
|
||||
while (*ptr)
|
||||
{
|
||||
if ((unsigned char)*ptr>31 && *ptr!='\"' && *ptr!='\\') *ptr2++=*ptr++;
|
||||
else
|
||||
{
|
||||
*ptr2++='\\';
|
||||
switch (token=*ptr++)
|
||||
{
|
||||
case '\\': *ptr2++='\\'; break;
|
||||
case '\"': *ptr2++='\"'; break;
|
||||
case '\b': *ptr2++='b'; break;
|
||||
case '\f': *ptr2++='f'; break;
|
||||
case '\n': *ptr2++='n'; break;
|
||||
case '\r': *ptr2++='r'; break;
|
||||
case '\t': *ptr2++='t'; break;
|
||||
default: sprintf(ptr2,"u%04x",token);ptr2+=5; break; /* escape and print */
|
||||
}
|
||||
}
|
||||
}
|
||||
*ptr2++='\"';*ptr2++=0;
|
||||
return out;
|
||||
}
|
||||
/* Invote print_string_ptr (which is useful) on an item. */
|
||||
static char *print_string(cJSON *item) {return print_string_ptr(item->valuestring);}
|
||||
|
||||
/* Predeclare these prototypes. */
|
||||
static const char *parse_value(cJSON *item,const char *value);
|
||||
static char *print_value(cJSON *item,int depth,int fmt);
|
||||
static const char *parse_array(cJSON *item,const char *value);
|
||||
static char *print_array(cJSON *item,int depth,int fmt);
|
||||
static const char *parse_object(cJSON *item,const char *value);
|
||||
static char *print_object(cJSON *item,int depth,int fmt);
|
||||
|
||||
/* Utility to jump whitespace and cr/lf */
|
||||
static const char *skip(const char *in) {while (in && *in && (unsigned char)*in<=32) in++; return in;}
|
||||
|
||||
/* Parse an object - create a new root, and populate. */
|
||||
cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated)
|
||||
{
|
||||
const char *end=0;
|
||||
cJSON *c=cJSON_New_Item();
|
||||
ep=0;
|
||||
if (!c) return 0; /* memory fail */
|
||||
|
||||
end=parse_value(c,skip(value));
|
||||
if (!end) {cJSON_Delete(c);return 0;} /* parse failure. ep is set. */
|
||||
|
||||
/* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */
|
||||
if (require_null_terminated) {end=skip(end);if (*end) {cJSON_Delete(c);ep=end;return 0;}}
|
||||
if (return_parse_end) *return_parse_end=end;
|
||||
return c;
|
||||
}
|
||||
/* Default options for cJSON_Parse */
|
||||
cJSON *cJSON_Parse(const char *value) {return cJSON_ParseWithOpts(value,0,0);}
|
||||
|
||||
/* Render a cJSON item/entity/structure to text. */
|
||||
char *cJSON_Print(cJSON *item) {return print_value(item,0,1);}
|
||||
char *cJSON_PrintUnformatted(cJSON *item) {return print_value(item,0,0);}
|
||||
|
||||
/* Parser core - when encountering text, process appropriately. */
|
||||
static const char *parse_value(cJSON *item,const char *value)
|
||||
{
|
||||
if (!value) return 0; /* Fail on null. */
|
||||
if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; }
|
||||
if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; }
|
||||
if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; }
|
||||
if (*value=='\"') { return parse_string(item,value); }
|
||||
if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); }
|
||||
if (*value=='[') { return parse_array(item,value); }
|
||||
if (*value=='{') { return parse_object(item,value); }
|
||||
|
||||
ep=value;return 0; /* failure. */
|
||||
}
|
||||
|
||||
/* Render a value to text. */
|
||||
static char *print_value(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char *out=0;
|
||||
if (!item) return 0;
|
||||
switch ((item->type)&255)
|
||||
{
|
||||
case cJSON_NULL: out=cJSON_strdup("null"); break;
|
||||
case cJSON_False: out=cJSON_strdup("false");break;
|
||||
case cJSON_True: out=cJSON_strdup("true"); break;
|
||||
case cJSON_Number: out=print_number(item);break;
|
||||
case cJSON_String: out=print_string(item);break;
|
||||
case cJSON_Array: out=print_array(item,depth,fmt);break;
|
||||
case cJSON_Object: out=print_object(item,depth,fmt);break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Build an array from input text. */
|
||||
static const char *parse_array(cJSON *item,const char *value)
|
||||
{
|
||||
cJSON *child;
|
||||
if (*value!='[') {ep=value;return 0;} /* not an array! */
|
||||
|
||||
item->type=cJSON_Array;
|
||||
value=skip(value+1);
|
||||
if (*value==']') return value+1; /* empty array. */
|
||||
|
||||
item->child=child=cJSON_New_Item();
|
||||
if (!item->child) return 0; /* memory fail */
|
||||
value=skip(parse_value(child,skip(value))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
|
||||
while (*value==',')
|
||||
{
|
||||
cJSON *new_item;
|
||||
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
|
||||
child->next=new_item;new_item->prev=child;child=new_item;
|
||||
value=skip(parse_value(child,skip(value+1)));
|
||||
if (!value) return 0; /* memory fail */
|
||||
}
|
||||
|
||||
if (*value==']') return value+1; /* end of array */
|
||||
ep=value;return 0; /* malformed. */
|
||||
}
|
||||
|
||||
/* Render an array to text */
|
||||
static char *print_array(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char **entries;
|
||||
char *out=0,*ptr,*ret;int len=5;
|
||||
cJSON *child=item->child;
|
||||
int numentries=0,i=0,fail=0;
|
||||
|
||||
/* How many entries in the array? */
|
||||
while (child) numentries++,child=child->next;
|
||||
/* Explicitly handle numentries==0 */
|
||||
if (!numentries)
|
||||
{
|
||||
out=(char*)cJSON_malloc(3);
|
||||
if (out) strcpy(out,"[]");
|
||||
return out;
|
||||
}
|
||||
/* Allocate an array to hold the values for each */
|
||||
entries=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!entries) return 0;
|
||||
memset(entries,0,numentries*sizeof(char*));
|
||||
/* Retrieve all the results: */
|
||||
child=item->child;
|
||||
while (child && !fail)
|
||||
{
|
||||
ret=print_value(child,depth+1,fmt);
|
||||
entries[i++]=ret;
|
||||
if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1;
|
||||
child=child->next;
|
||||
}
|
||||
|
||||
/* If we didn't fail, try to malloc the output string */
|
||||
if (!fail) out=(char*)cJSON_malloc(len);
|
||||
/* If that fails, we fail. */
|
||||
if (!out) fail=1;
|
||||
|
||||
/* Handle failure. */
|
||||
if (fail)
|
||||
{
|
||||
for (i=0;i<numentries;i++) if (entries[i]) cJSON_free(entries[i]);
|
||||
cJSON_free(entries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compose the output array. */
|
||||
*out='[';
|
||||
ptr=out+1;*ptr=0;
|
||||
for (i=0;i<numentries;i++)
|
||||
{
|
||||
strcpy(ptr,entries[i]);ptr+=strlen(entries[i]);
|
||||
if (i!=numentries-1) {*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;}
|
||||
cJSON_free(entries[i]);
|
||||
}
|
||||
cJSON_free(entries);
|
||||
*ptr++=']';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Build an object from the text. */
|
||||
static const char *parse_object(cJSON *item,const char *value)
|
||||
{
|
||||
cJSON *child;
|
||||
if (*value!='{') {ep=value;return 0;} /* not an object! */
|
||||
|
||||
item->type=cJSON_Object;
|
||||
value=skip(value+1);
|
||||
if (*value=='}') return value+1; /* empty array. */
|
||||
|
||||
item->child=child=cJSON_New_Item();
|
||||
if (!item->child) return 0;
|
||||
value=skip(parse_string(child,skip(value)));
|
||||
if (!value) return 0;
|
||||
child->string=child->valuestring;child->valuestring=0;
|
||||
if (*value!=':') {ep=value;return 0;} /* fail! */
|
||||
value=skip(parse_value(child,skip(value+1))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
|
||||
while (*value==',')
|
||||
{
|
||||
cJSON *new_item;
|
||||
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
|
||||
child->next=new_item;new_item->prev=child;child=new_item;
|
||||
value=skip(parse_string(child,skip(value+1)));
|
||||
if (!value) return 0;
|
||||
child->string=child->valuestring;child->valuestring=0;
|
||||
if (*value!=':') {ep=value;return 0;} /* fail! */
|
||||
value=skip(parse_value(child,skip(value+1))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
}
|
||||
|
||||
if (*value=='}') return value+1; /* end of array */
|
||||
ep=value;return 0; /* malformed. */
|
||||
}
|
||||
|
||||
/* Render an object to text. */
|
||||
static char *print_object(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char **entries=0,**names=0;
|
||||
char *out=0,*ptr,*ret,*str;int len=7,i=0,j;
|
||||
cJSON *child=item->child;
|
||||
int numentries=0,fail=0;
|
||||
/* Count the number of entries. */
|
||||
while (child) numentries++,child=child->next;
|
||||
/* Explicitly handle empty object case */
|
||||
if (!numentries)
|
||||
{
|
||||
out=(char*)cJSON_malloc(fmt?depth+4:3);
|
||||
if (!out) return 0;
|
||||
ptr=out;*ptr++='{';
|
||||
if (fmt) {*ptr++='\n';for (i=0;i<depth-1;i++) *ptr++='\t';}
|
||||
*ptr++='}';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
/* Allocate space for the names and the objects */
|
||||
entries=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!entries) return 0;
|
||||
names=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!names) {cJSON_free(entries);return 0;}
|
||||
memset(entries,0,sizeof(char*)*numentries);
|
||||
memset(names,0,sizeof(char*)*numentries);
|
||||
|
||||
/* Collect all the results into our arrays: */
|
||||
child=item->child;depth++;if (fmt) len+=depth;
|
||||
while (child)
|
||||
{
|
||||
names[i]=str=print_string_ptr(child->string);
|
||||
entries[i++]=ret=print_value(child,depth,fmt);
|
||||
if (str && ret) len+=strlen(ret)+strlen(str)+2+(fmt?2+depth:0); else fail=1;
|
||||
child=child->next;
|
||||
}
|
||||
|
||||
/* Try to allocate the output string */
|
||||
if (!fail) out=(char*)cJSON_malloc(len);
|
||||
if (!out) fail=1;
|
||||
|
||||
/* Handle failure */
|
||||
if (fail)
|
||||
{
|
||||
for (i=0;i<numentries;i++) {if (names[i]) cJSON_free(names[i]);if (entries[i]) cJSON_free(entries[i]);}
|
||||
cJSON_free(names);cJSON_free(entries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compose the output: */
|
||||
*out='{';ptr=out+1;if (fmt)*ptr++='\n';*ptr=0;
|
||||
for (i=0;i<numentries;i++)
|
||||
{
|
||||
if (fmt) for (j=0;j<depth;j++) *ptr++='\t';
|
||||
strcpy(ptr,names[i]);ptr+=strlen(names[i]);
|
||||
*ptr++=':';if (fmt) *ptr++='\t';
|
||||
strcpy(ptr,entries[i]);ptr+=strlen(entries[i]);
|
||||
if (i!=numentries-1) *ptr++=',';
|
||||
if (fmt) *ptr++='\n';*ptr=0;
|
||||
cJSON_free(names[i]);cJSON_free(entries[i]);
|
||||
}
|
||||
|
||||
cJSON_free(names);cJSON_free(entries);
|
||||
if (fmt) for (i=0;i<depth-1;i++) *ptr++='\t';
|
||||
*ptr++='}';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Get Array size/item / object item. */
|
||||
int cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;}
|
||||
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;}
|
||||
cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
|
||||
|
||||
/* Utility for array list handling. */
|
||||
static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;}
|
||||
/* Utility for handling references. */
|
||||
static cJSON *create_reference(cJSON *item) {cJSON *ref=cJSON_New_Item();if (!ref) return 0;memcpy(ref,item,sizeof(cJSON));ref->string=0;ref->type|=cJSON_IsReference;ref->next=ref->prev=0;return ref;}
|
||||
|
||||
/* Add item to array/object. */
|
||||
void cJSON_AddItemToArray(cJSON *array, cJSON *item) {cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}}
|
||||
void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (item->string) cJSON_free(item->string);item->string=cJSON_strdup(string);cJSON_AddItemToArray(object,item);}
|
||||
void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) {cJSON_AddItemToArray(array,create_reference(item));}
|
||||
void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item) {cJSON_AddItemToObject(object,string,create_reference(item));}
|
||||
|
||||
cJSON *cJSON_DetachItemFromArray(cJSON *array,int which) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return 0;
|
||||
if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;}
|
||||
void cJSON_DeleteItemFromArray(cJSON *array,int which) {cJSON_Delete(cJSON_DetachItemFromArray(array,which));}
|
||||
cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;}
|
||||
void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));}
|
||||
|
||||
/* Replace array/object items with new ones. */
|
||||
void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return;
|
||||
newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem;
|
||||
if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
|
||||
void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
|
||||
|
||||
/* Create basic types: */
|
||||
cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;return item;}
|
||||
cJSON *cJSON_CreateTrue(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_True;return item;}
|
||||
cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_False;return item;}
|
||||
cJSON *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;}
|
||||
cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int)num;}return item;}
|
||||
cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);}return item;}
|
||||
cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;}
|
||||
cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}
|
||||
|
||||
/* Create Arrays: */
|
||||
cJSON *cJSON_CreateIntArray(const int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateFloatArray(const float *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateDoubleArray(const double *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateStringArray(const char **strings,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateString(strings[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
|
||||
/* Duplication */
|
||||
cJSON *cJSON_Duplicate(cJSON *item,int recurse)
|
||||
{
|
||||
cJSON *newitem,*cptr,*nptr=0,*newchild;
|
||||
/* Bail on bad ptr */
|
||||
if (!item) return 0;
|
||||
/* Create new item */
|
||||
newitem=cJSON_New_Item();
|
||||
if (!newitem) return 0;
|
||||
/* Copy over all vars */
|
||||
newitem->type=item->type&(~cJSON_IsReference),newitem->valueint=item->valueint,newitem->valuedouble=item->valuedouble;
|
||||
if (item->valuestring) {newitem->valuestring=cJSON_strdup(item->valuestring); if (!newitem->valuestring) {cJSON_Delete(newitem);return 0;}}
|
||||
if (item->string) {newitem->string=cJSON_strdup(item->string); if (!newitem->string) {cJSON_Delete(newitem);return 0;}}
|
||||
/* If non-recursive, then we're done! */
|
||||
if (!recurse) return newitem;
|
||||
/* Walk the ->next chain for the child. */
|
||||
cptr=item->child;
|
||||
while (cptr)
|
||||
{
|
||||
newchild=cJSON_Duplicate(cptr,1); /* Duplicate (with recurse) each item in the ->next chain */
|
||||
if (!newchild) {cJSON_Delete(newitem);return 0;}
|
||||
if (nptr) {nptr->next=newchild,newchild->prev=nptr;nptr=newchild;} /* If newitem->child already set, then crosswire ->prev and ->next and move on */
|
||||
else {newitem->child=newchild;nptr=newchild;} /* Set newitem->child and move to it */
|
||||
cptr=cptr->next;
|
||||
}
|
||||
return newitem;
|
||||
}
|
||||
|
||||
void cJSON_Minify(char *json)
|
||||
{
|
||||
char *into=json;
|
||||
while (*json)
|
||||
{
|
||||
if (*json==' ') json++;
|
||||
else if (*json=='\t') json++; // Whitespace characters.
|
||||
else if (*json=='\r') json++;
|
||||
else if (*json=='\n') json++;
|
||||
else if (*json=='/' && json[1]=='/') while (*json && *json!='\n') json++; // double-slash comments, to end of line.
|
||||
else if (*json=='/' && json[1]=='*') {while (*json && !(*json=='*' && json[1]=='/')) json++;json+=2;} // multiline comments.
|
||||
else if (*json=='\"'){*into++=*json++;while (*json && *json!='\"'){if (*json=='\\') *into++=*json++;*into++=*json++;}*into++=*json++;} // string literals, which are \" sensitive.
|
||||
else *into++=*json++; // All other characters.
|
||||
}
|
||||
*into=0; // and null-terminate.
|
||||
}
|
||||
145
cJSON.h
Executable file
@@ -0,0 +1,145 @@
|
||||
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_False 0
|
||||
#define cJSON_True 1
|
||||
#define cJSON_NULL 2
|
||||
#define cJSON_Number 3
|
||||
#define cJSON_String 4
|
||||
#define cJSON_Array 5
|
||||
#define cJSON_Object 6
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON {
|
||||
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
|
||||
int type; /* The type of the item, as above. */
|
||||
|
||||
char *valuestring; /* The item's string, if type==cJSON_String */
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
|
||||
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
|
||||
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
extern cJSON *cJSON_CreateFalse(void);
|
||||
extern cJSON *cJSON_CreateBool(int b);
|
||||
extern cJSON *cJSON_CreateNumber(double num);
|
||||
extern cJSON *cJSON_CreateString(const char *string);
|
||||
extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
|
||||
|
||||
extern void cJSON_Minify(char *json);
|
||||
|
||||
/* Macros for creating things quickly. */
|
||||
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
#define cJSON_AddItemIsArray(root, item, array) cJSON_AddItemToObject(root, item, array = cJSON_CreateArray())
|
||||
#define cJSON_AddItemIsObjectInArray(array, object) cJSON_AddItemToArray(array, object = cJSON_CreateObject())
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
55
datetimerangewidget.ui
Executable file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DateTimeRangeWidget</class>
|
||||
<widget class="QWidget" name="DateTimeRangeWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QDateTimeEdit" name="dateTimeEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnYes">
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
619
dialog.cpp
Executable file
@@ -0,0 +1,619 @@
|
||||
#include "dialog.h"
|
||||
#include "ui_dialog.h"
|
||||
#include "heads.h"
|
||||
|
||||
Dialog::Dialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::Dialog),
|
||||
warnMsgState(false),
|
||||
modeState(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
formInit();
|
||||
mainFormInit();
|
||||
mainFormP1Init();
|
||||
whiteListFormP1Init();
|
||||
perlMgrFormP1Init();
|
||||
logMgrInit();
|
||||
pcDefFormInit();
|
||||
pcNetDefFormInit();
|
||||
sysMgrFormInit();
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
foreach (QAbstractButton* btn, ui->widgetTop->findChildren<QAbstractButton *>()) {
|
||||
btn->setChecked(btn->objectName() == ui->btnMain->objectName());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Dialog::~Dialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Dialog::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(this);
|
||||
QRect rect = ui->widgetTitle->rect();
|
||||
painter.drawImage(rect, QImage(":/src/header-bg.png"));
|
||||
painter.end();
|
||||
}
|
||||
|
||||
bool Dialog::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(ui->btnUser == watched || this->w == watched)
|
||||
{
|
||||
if(QEvent::Enter == event->type())
|
||||
{
|
||||
if(this->w->isHidden())
|
||||
{
|
||||
this->w->show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(QEvent::Leave == event->type())
|
||||
{
|
||||
if(!this->w->isHidden())
|
||||
{
|
||||
if(!ui->btnUser->geometry().contains(this->mapFromGlobal(QCursor::pos()))&&
|
||||
!this->w->geometry().contains(this->mapFromGlobal(QCursor::pos())))
|
||||
{
|
||||
this->w->hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(ui->frameWarnMsg == watched)
|
||||
{
|
||||
if(QEvent::MouseButtonPress == event->type())
|
||||
emit this->frameWarnMsgSignal();
|
||||
}
|
||||
else if(ui->frameDefMode == watched)
|
||||
{
|
||||
if(QEvent::MouseButtonPress == event->type() && modeState == false)
|
||||
{
|
||||
ui->frameDefMode->setStyleSheet("QFrame#frameDefMode{border: 1px solid rgb(0,73,153);border-radius:8px;}");
|
||||
ui->labDefIntr->setStyleSheet("color:rgb(0,73,153);font:14px;padding-left:13px;");
|
||||
ui->labDefMode->setStyleSheet("font:15px;font-weight:bold;color:rgb(0,73,153);padding-top:12px;padding-left:12px;");
|
||||
|
||||
ui->frameWarnMode->setStyleSheet("QFrame#frameWarnMode{border: 1px solid rgb(220,220,220);border-radius:8px;}");
|
||||
ui->labWarnModeIntr->setStyleSheet("color:rgb(220,220,220);font:14px;padding-left:13px;");
|
||||
ui->labWarnMode->setStyleSheet("font:15px;font-weight:bold;color:rgb(220,220,220);padding-top:12px;padding-left:12px;");
|
||||
|
||||
ui->rbtnDefMode->setChecked(true);
|
||||
ui->rbtnWarnMode->setChecked(false);
|
||||
modeState = !modeState;
|
||||
}
|
||||
}
|
||||
else if(ui->frameWarnMode == watched)
|
||||
{
|
||||
if(QEvent::MouseButtonPress == event->type() && modeState == true)
|
||||
{
|
||||
ui->frameDefMode->setStyleSheet("QFrame#frameDefMode{border: 1px solid rgb(220,220,220);border-radius:8px;}");
|
||||
ui->labDefIntr->setStyleSheet("color:rgb(220,220,220);font:14px;padding-left:13px;");
|
||||
ui->labDefMode->setStyleSheet("font:15px;font-weight:bold;color:rgb(220,220,220);padding-top:12px;padding-left:12px;");
|
||||
|
||||
ui->frameWarnMode->setStyleSheet("QFrame#frameWarnMode{border: 1px solid rgb(0,73,153);border-radius:8px;}");
|
||||
ui->labWarnModeIntr->setStyleSheet("color:rgb(0,73,153);font:14px;padding-left:13px;");
|
||||
ui->labWarnMode->setStyleSheet("font:15px;font-weight:bold;color:rgb(0,73,153);padding-top:12px;padding-left:12px;");
|
||||
|
||||
ui->rbtnDefMode->setChecked(false);
|
||||
ui->rbtnWarnMode->setChecked(true);
|
||||
modeState = !modeState;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return QDialog::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void Dialog::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPoint pos = QPoint(ui->btnUser->mapToGlobal(ui->btnUser->rect().bottomLeft()));
|
||||
this->w->move(pos);
|
||||
ui->frameWarnMsg->setFixedWidth(ui->frameDefMode->width());
|
||||
ui->frameWarnMode->setFixedWidth(ui->frameDefMode->width());
|
||||
}
|
||||
|
||||
void Dialog::formInit()
|
||||
{
|
||||
this->setWindowIcon(QIcon(":/src/icon_logo_b.png"));
|
||||
this->setWindowTitle("工业主机安全卫士");
|
||||
this->setWindowFlag(Qt::FramelessWindowHint);
|
||||
this->setProperty("form", true);
|
||||
this->setProperty("canMove", true);
|
||||
ui->labIcon->setPixmap(QPixmap(":/src/icon_logo.svg").scaled(20, 20));
|
||||
ui->labTitle->setText("工业主机安全卫士v2.1");
|
||||
ui->btnMenu_Min->setText("一");
|
||||
ui->btnMenu_Close->setText("×");
|
||||
ui->btnUser->installEventFilter(this);
|
||||
foreach (QAbstractButton *btn, ui->widgetTop->findChildren<QAbstractButton*>()) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_tbtnMenu_All_clicked);
|
||||
}
|
||||
w = new QWidget(this);
|
||||
w->installEventFilter(this);
|
||||
w->setFixedSize(100, 80);
|
||||
this->vlyMenu = new QVBoxLayout(w);
|
||||
w->hide();
|
||||
pbtnChpwd = new QPushButton("修改密码", w);
|
||||
pbtnunlod = new QPushButton("退出", w);
|
||||
vlyMenu->addWidget(pbtnChpwd);
|
||||
vlyMenu->addWidget(pbtnunlod);
|
||||
this->w->setLayout(vlyMenu);
|
||||
this->w->setStyleSheet("QWidget{"
|
||||
"background-color: white;"
|
||||
"border-radius: 5px;"
|
||||
"margin: 2px;}");
|
||||
pbtnunlod->setStyleSheet("QPushButton{"
|
||||
"color: red;"
|
||||
"border-radius: 1px;"
|
||||
"background-color: white;"
|
||||
"margin: 0px;}");
|
||||
|
||||
pbtnChpwd->setStyleSheet("QPushButton{"
|
||||
"color: black;"
|
||||
"border-radius: 1px;"
|
||||
"background-color: white;"
|
||||
"margin: 0px;}");
|
||||
this->setFixedSize(955, 635);
|
||||
}
|
||||
|
||||
void Dialog::mainFormInit()
|
||||
{
|
||||
ui->labWarnMsg->setText("告警信息");
|
||||
ui->labWarnNum->setText("0");
|
||||
ui->labWarnNumLast->setText("条");
|
||||
ui->labWarnMode->setText("告警模式");
|
||||
ui->labWarnModeIntr->setText("所有白名单以外的行为只\n产生警告,不阻断");
|
||||
ui->labDefMode->setText("防护模式");
|
||||
ui->labDefIntr->setText("所有白名单以外的行为进\n行阻断,并产生警告");
|
||||
|
||||
shadow_effect = new QGraphicsDropShadowEffect(ui->stackedWidget);
|
||||
shadow_effect->setOffset(0, 0);
|
||||
shadow_effect->setColor(QColor(38, 78, 119, 127));
|
||||
shadow_effect->setBlurRadius(22);
|
||||
|
||||
ui->frameWarnMsg->installEventFilter(this);
|
||||
ui->frameWarnMsg->setGraphicsEffect(shadow_effect);
|
||||
|
||||
QStringList header1, header2, header3, header4, header5;
|
||||
header1<< "序号"<< "时间"<< "事件名称"<< "关联程序" << "时间说明"<< "处理结果";
|
||||
header2<< "序号"<< "时间"<< "时间名称"<< "处置结果";
|
||||
header3<< "序号"<< "时间"<< "事件名称"<< "事件说明"<< "处置结果";
|
||||
header4<< "序号"<< "时间"<< "事件名称"<< "事件说明"<< "处置结果";
|
||||
header5<< "序号"<< "时间"<< "事件名称"<< "事件说明"<< "处置结果";
|
||||
ui->tablepagewidgetWarnMsgP1->setTableHeaders(header1);
|
||||
ui->tablepagewidgetWarnMsgP2->setTableHeaders(header2);
|
||||
ui->tablepagewidgetWarnMsgP3->setTableHeaders(header3);
|
||||
ui->tablepagewidgetWarnMsgP4->setTableHeaders(header4);
|
||||
ui->tablepagewidgetWarnMsgP5->setTableHeaders(header5);
|
||||
|
||||
ui->frameWarnMode->installEventFilter(this);
|
||||
ui->frameDefMode->installEventFilter(this);
|
||||
|
||||
connect(this, &Dialog::frameWarnMsgSignal, this, &Dialog::on_frameWarnMsg_clicked);
|
||||
connect(ui->btnExeWarn, &QPushButton::clicked, this, &Dialog::on_pbtnWarnMsgMenu_clicked);
|
||||
connect(ui->btnNetDefWarn, &QPushButton::clicked, this, &Dialog::on_pbtnWarnMsgMenu_clicked);
|
||||
connect(ui->btnPcDefWarn, &QPushButton::clicked, this, &Dialog::on_pbtnWarnMsgMenu_clicked);
|
||||
connect(ui->btnPeripheralWarn, &QPushButton::clicked, this, &Dialog::on_pbtnWarnMsgMenu_clicked);
|
||||
connect(ui->btnSysWarn, &QPushButton::clicked, this, &Dialog::on_pbtnWarnMsgMenu_clicked);
|
||||
}
|
||||
|
||||
void Dialog::mainFormP1Init()
|
||||
{
|
||||
ui->stackedWidgetMain->setCurrentIndex(0);
|
||||
ui->labHostTitle->setText("DESKTOP-MNNGSWX");
|
||||
}
|
||||
|
||||
void Dialog::whiteListFormP1Init()
|
||||
{
|
||||
//page1
|
||||
ui->btnRm->setEnabled(false);
|
||||
ui->btnChoiseAll->setEnabled(false);
|
||||
QStringList header1;
|
||||
header1<< "序号"<< "文件名"<< "文件类型"<< "路径";
|
||||
ui->tablepagewidgetWhiteList->setTableHeaders(header1);
|
||||
|
||||
//page2
|
||||
ui->btnRmTrustFiles->setEnabled(false);
|
||||
ui->btnChoiseAllTrustFiles->setEnabled(false);
|
||||
QStringList header2;
|
||||
header2<< "序号"<< "路径";
|
||||
ui->tablepagewidgetTrustFiles->setTableHeaders(header2);
|
||||
|
||||
foreach (QAbstractButton* btn, ui->frameWhiteListMenu->findChildren<QAbstractButton *>()) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnWhiteList_clicked);
|
||||
}
|
||||
ui->btnExeWhiteList->setChecked(true);
|
||||
ui->stackedWidgetWhiteList->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void Dialog::perlMgrFormP1Init()
|
||||
{
|
||||
//page1
|
||||
this->m_udiskGroup = new QButtonGroup(this);
|
||||
this->m_usbcdGroup = new QButtonGroup(this);
|
||||
this->m_wlanGroup = new QButtonGroup(this);
|
||||
m_udiskGroup->addButton(ui->rbtnUdiskdis);
|
||||
m_udiskGroup->addButton(ui->rbtnUdiskr);
|
||||
m_udiskGroup->addButton(ui->rbtnUdiskrw);
|
||||
|
||||
m_wlanGroup->addButton(ui->rbtnWlandis);
|
||||
m_wlanGroup->addButton(ui->rbtnWlanen);
|
||||
|
||||
m_usbcdGroup->addButton(ui->rbtnCDdis);
|
||||
m_usbcdGroup->addButton(ui->rbtnCDen);
|
||||
|
||||
|
||||
//page2
|
||||
ui->btnRmUdisk->setEnabled(false);
|
||||
foreach (QAbstractButton* btn, ui->framePerlMgr->findChildren<QAbstractButton *>()) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnPeripheral_clicked);
|
||||
}
|
||||
ui->btnPerlManager->setChecked(true);
|
||||
ui->stackedWidgetPerlMgr->setCurrentIndex(0);
|
||||
QStringList header2;
|
||||
header2<< "序号"<< "U盘名称"<< "设备名称"<< "品牌"<< "序列号";
|
||||
ui->tablepagewidgetUdiskWhiteList->setTableHeaders(header2);
|
||||
}
|
||||
|
||||
void Dialog::logMgrInit()
|
||||
{
|
||||
QStringList header1, header2, header3, header4, header5, header6;
|
||||
header1<< "序号"<< "时间"<< "事件名称"<< "关联程序"<< "事件说明";
|
||||
header2<< "序号"<< "时间"<< "事件名称";
|
||||
header3<< "序号"<< "时间"<< "事件名称"<< "事件说明"<< "处置结果";
|
||||
ui->tablepagewidgetLogMgr1->setTableHeaders(header1);
|
||||
ui->tablepagewidgetLogMgr2->setTableHeaders(header2);
|
||||
ui->tablepagewidgetLogMgr3->setTableHeaders(header3);
|
||||
ui->tablepagewidgetLogMgr4->setTableHeaders(header3);
|
||||
ui->tablepagewidgetLogMgr5->setTableHeaders(header3);
|
||||
ui->tablepagewidgetLogMgr6->setTableHeaders(header3);
|
||||
|
||||
foreach (QAbstractButton* btn, ui->page_20->findChildren<QAbstractButton *>()) {
|
||||
if(btn->text() == "查询" || btn->text() == "导出")
|
||||
continue;
|
||||
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnLogMgrMenu_clicked);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Dialog::pcDefFormInit()
|
||||
{
|
||||
//page1
|
||||
ui->btnPcDefRm->setEnabled(false);
|
||||
ui->btnPcDefChoiseAll->setEnabled(false);
|
||||
QStringList header1;
|
||||
header1<< "序号"<< "注册表路径";
|
||||
ui->tablepagewidgetPcDef->setTableHeaders(header1);
|
||||
|
||||
//page2
|
||||
ui->btnPcDefChoiseAllFile->setEnabled(false);
|
||||
ui->btnPcDefRmFilePath->setEnabled(false);
|
||||
QStringList header2;
|
||||
header2<< "序号"<< "文件路径";
|
||||
ui->tablepagewidgetPcDefFile->setTableHeaders(header2);
|
||||
|
||||
foreach (QAbstractButton* btn, ui->framePcDef->findChildren<QAbstractButton *>()) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnPcDefense_clicked);
|
||||
}
|
||||
ui->btnRegisterProtect->setChecked(true);
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(0);
|
||||
|
||||
//page3
|
||||
ui->sbtnDiskProtect->setBgColorOn(QColor(0,73,153));
|
||||
QStringList header3;
|
||||
header3<< "账号ID"<< "账号名"<< "账户类型"<< "账户状态"<< "操作";
|
||||
ui->tablepagewidgetSysUser->setTableHeaders(header3);
|
||||
|
||||
//page4
|
||||
ui->sbtnDoubleLog->setBgColorOn(QColor(0,73,153));
|
||||
QStringList header4;
|
||||
header4<< "序号"<< "账号名称"<< "用户名称"<< "绑定状态"<< "操作";
|
||||
ui->tablepagewidgetDoubleLog->setTableHeaders(header4);
|
||||
}
|
||||
|
||||
void Dialog::pcNetDefFormInit()
|
||||
{
|
||||
//page1
|
||||
ui->sbtnDefCC->setBgColorOn(QColor(0,73,153));
|
||||
ui->sbtnDefSYN->setBgColorOn(QColor(0,73,153));
|
||||
//page 2
|
||||
ui->sbtnWinDefwell->setBgColorOn(QColor(72, 103, 149));
|
||||
ui->btnPcDefRmRules->setEnabled(false);
|
||||
ui->btnChoiseAllRules->setEnabled(false);
|
||||
ui->sbtnWinDefwell->setBgColorOn(QColor(0,73,153));
|
||||
QStringList header2;
|
||||
header2<< "规则名称"<< "规则类型"<< "协议类型"<< "操作方式"<< "规则方向"<< "操作";
|
||||
ui->tablepagewidgetUnlawConnect->setTableHeaders(header2);
|
||||
|
||||
//page3
|
||||
ui->btnRmUnlawList->setEnabled(false);
|
||||
ui->btnChoiseAllUnlawPath->setEnabled(false);
|
||||
QStringList header3;
|
||||
header3<< "序号"<< "规则名称"<< "非法地址"<< "备注";
|
||||
ui->tablepagewidgetUnlawConnect->setTableHeaders(header3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Dialog::sysMgrFormInit()
|
||||
{
|
||||
//page1
|
||||
connect(ui->btnExeList, &QPushButton::clicked, this, &Dialog::on_pbtnSysMgr_clicked);
|
||||
connect(ui->btnPcMsg, &QPushButton::clicked, this, &Dialog::on_pbtnSysMgr_clicked);
|
||||
//page2
|
||||
ui->wavechartCPU->setPointColor(QColor(194,217,255));
|
||||
ui->wavechartCPU->setTitle("CPU利用率");
|
||||
ui->wavechartCPU->setMaxValue(100);
|
||||
ui->wavechartCPU->setBgColorStart(QColor(255,255,255));
|
||||
ui->wavechartCPU->setBgColorEnd(QColor(255,255,255));
|
||||
ui->wavechartCPU->setTextColor(QColor(200,200,200));
|
||||
ui->wavechartCPU->setXStep(10);
|
||||
|
||||
|
||||
ui->wavechartMemory->setPointColor(QColor(194,217,255));
|
||||
ui->wavechartMemory->setTitle("内存占用");
|
||||
ui->wavechartMemory->setMaxValue(100);
|
||||
ui->wavechartMemory->setBgColorStart(QColor(255,255,255));
|
||||
ui->wavechartMemory->setBgColorEnd(QColor(255,255,255));
|
||||
ui->wavechartMemory->setTextColor(QColor(200,200,200));
|
||||
ui->wavechartMemory->setXStep(10);
|
||||
|
||||
|
||||
ui->wavechartDisk->setPointColor(QColor(194,217,255));
|
||||
ui->wavechartDisk->setTitle("磁盘使用");
|
||||
ui->wavechartDisk->setMaxValue(100);
|
||||
ui->wavechartDisk->setBgColorStart(QColor(255,255,255));
|
||||
ui->wavechartDisk->setBgColorEnd(QColor(255,255,255));
|
||||
ui->wavechartDisk->setTextColor(QColor(200,200,200));
|
||||
ui->wavechartDisk->setXStep(10);
|
||||
|
||||
QList<QAbstractButton *> btns = ui->frameSysMgr->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, btns) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnSysManage_clicked);
|
||||
}
|
||||
ui->btnSysMgr->setChecked(true);
|
||||
ui->stackedWidgetSysMgr->setCurrentIndex(0);
|
||||
|
||||
//page3
|
||||
QStringList header3;
|
||||
header3<<"用户名"<< "类型"<< "操作";
|
||||
ui->tablepagewidgetAddUser->setTableHeaders(header3);
|
||||
|
||||
//page5-1
|
||||
ui->labMinPwd->setText(QString ("<font color = red>*</font>").append("密码长度最小值:"));
|
||||
ui->labPwdHistory->setText(QString ("<font color = red>*</font>").append("强制密码历史:"));
|
||||
ui->labPwdUseTime->setText(QString ("<font color = red>*</font>").append("密码最长使用期限:"));
|
||||
ui->labLockedVal->setText(QString ("<font color = red>*</font>").append("帐户锁定阈值:"));
|
||||
|
||||
//page5-2
|
||||
ui->btnRmUser->setEnabled(false);
|
||||
|
||||
foreach (QAbstractButton* btn, ui->frameNetDef->findChildren<QAbstractButton *>()) {
|
||||
btn->setCheckable(true);
|
||||
connect(btn, &QAbstractButton::clicked, this, &Dialog::on_pbtnNetDefense_clicked);
|
||||
}
|
||||
ui->btnDefAtt->setChecked(true);
|
||||
ui->stackedWidgetNetDef->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void Dialog::on_btnMenu_Min_clicked()
|
||||
{
|
||||
this->showMinimized();
|
||||
}
|
||||
|
||||
void Dialog::on_btnMenu_Close_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void Dialog::on_tbtnMenu_All_clicked()
|
||||
{
|
||||
//fd.getSerial();
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton *> tbtns = ui->widgetTop->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, tbtns) {
|
||||
btn->setChecked(btn->objectName() == b->objectName());
|
||||
}
|
||||
if(objname == "btnMain")
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
else if(objname == "btnWhiteList")
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
else if(objname == "btnPerlMgr")
|
||||
ui->stackedWidget->setCurrentIndex(2);
|
||||
else if(objname == "btnLogMgr")
|
||||
ui->stackedWidget->setCurrentIndex(3);
|
||||
else if(objname == "btnPcDef")
|
||||
ui->stackedWidget->setCurrentIndex(4);
|
||||
else if(objname == "btnNetDef")
|
||||
ui->stackedWidget->setCurrentIndex(5);
|
||||
else if(objname == "btnSysMgr")
|
||||
{
|
||||
ui->stackedWidget->setCurrentIndex(6);
|
||||
ui->btnSysMsg->setChecked(true);
|
||||
ui->btnPcMsg->setChecked(true);
|
||||
ui->stackedWidget_7->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnWhiteList_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton *> pbtns = ui->frameWhiteListMenu->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, pbtns) {
|
||||
btn->setChecked(btn == b);
|
||||
}
|
||||
if(objname == "btnExeWhiteList")
|
||||
ui->stackedWidgetWhiteList->setCurrentIndex(0);
|
||||
else
|
||||
ui->stackedWidgetWhiteList->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnPeripheral_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton *> pbtns = ui->framePerlMgr->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, pbtns) {
|
||||
btn->setChecked(btn == b);
|
||||
}
|
||||
|
||||
if(objname == "btnPerlManager")
|
||||
ui->stackedWidgetPerlMgr->setCurrentIndex(0);
|
||||
else
|
||||
ui->stackedWidgetPerlMgr->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnPcDefense_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton *> btns = ui->framePcDef->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, btns) {
|
||||
btn->setChecked(b == btn);
|
||||
}
|
||||
|
||||
if(objname == "btnRegisterProtect")
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(0);
|
||||
else if(objname == "btnFileProtect")
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(1);
|
||||
else if(objname == "btnDiskProtect")
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(2);
|
||||
else if(objname == "btnFactorProtect")
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(3);
|
||||
else if(objname == "btnSysUserProtect")
|
||||
ui->stackedWidgetPcDef->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnNetDefense_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton *> btns = ui->frameNetDef->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, btns) {
|
||||
btn->setChecked(btn == b);
|
||||
}
|
||||
|
||||
if(objname == "btnDefAtt")
|
||||
ui->stackedWidgetNetDef->setCurrentIndex(0);
|
||||
else if(objname == "btnDefensewallSkill")
|
||||
ui->stackedWidgetNetDef->setCurrentIndex(1);
|
||||
else if(objname == "btnUnlawConnect")
|
||||
ui->stackedWidgetNetDef->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnSysManage_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
QString objname = b->objectName();
|
||||
QList<QAbstractButton * > btns = ui->frameSysMgr->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, btns) {
|
||||
btn->setChecked(btn == b);
|
||||
}
|
||||
|
||||
if(objname == "btnSysMsg")
|
||||
ui->stackedWidgetSysMgr->setCurrentIndex(0);
|
||||
else if(objname == "btnSysMonitor")
|
||||
ui->stackedWidgetSysMgr->setCurrentIndex(1);
|
||||
else if(objname == "btnSysUserMgr")
|
||||
ui->stackedWidgetSysMgr->setCurrentIndex(2);
|
||||
else if(objname == "btnlSyssMgrLast")
|
||||
ui->stackedWidgetSysMgr->setCurrentIndex(3);
|
||||
}
|
||||
|
||||
void Dialog::on_frameWarnMsg_clicked()
|
||||
{
|
||||
if(!warnMsgState)
|
||||
{
|
||||
ui->frameWarnMsg->setStyleSheet("QFrame#frameWarnMsg{border-radius:10px;border:1px solid rgb(0,72,152);}");
|
||||
ui->stackedWidgetMain->setCurrentIndex(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->frameWarnMsg->setStyleSheet("QFrame#frameWarnMsg{background-color: rgb(255,255,255);"
|
||||
"border-radius:10px;"
|
||||
"border:1px solid rgb(235,238,245);}");
|
||||
ui->stackedWidgetMain->setCurrentIndex(0);
|
||||
|
||||
}
|
||||
warnMsgState = !warnMsgState;
|
||||
qDebug()<<warnMsgState;
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnWarnMsgMenu_clicked()
|
||||
{
|
||||
QAbstractButton *b = (QAbstractButton *)sender();
|
||||
QList<QAbstractButton *> btns = ui->page_4->findChildren<QAbstractButton *>();
|
||||
foreach (QAbstractButton* btn, btns) {
|
||||
if(btn->objectName() == "btnWarnMsgQuery" || btn->objectName() == "btnWarnMsgExport")
|
||||
continue;
|
||||
btn->setChecked(b == btn);
|
||||
}
|
||||
|
||||
QString objname = b->objectName();
|
||||
if(objname == ui->btnExeWarn->objectName())
|
||||
ui->stackedWidgetWarnMsg->setCurrentIndex(0);
|
||||
else if(objname == ui->btnPeripheralWarn->objectName())
|
||||
ui->stackedWidgetWarnMsg->setCurrentIndex(1);
|
||||
else if(objname == ui->btnPcDefWarn->objectName())
|
||||
ui->stackedWidgetWarnMsg->setCurrentIndex(2);
|
||||
else if(objname == ui->btnNetDefWarn->objectName())
|
||||
ui->stackedWidgetWarnMsg->setCurrentIndex(3);
|
||||
else
|
||||
ui->stackedWidgetWarnMsg->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnLogMgrMenu_clicked()
|
||||
{
|
||||
QAbstractButton* b = (QAbstractButton *)sender();
|
||||
foreach (QAbstractButton* btn, ui->page_20->findChildren<QAbstractButton *>()) {
|
||||
if(btn->text() == "查询" || btn->text() == "导出")
|
||||
continue;
|
||||
|
||||
btn->setChecked(b == btn);
|
||||
}
|
||||
|
||||
QString objname = b->objectName();
|
||||
if(objname == "btnLogMgr1")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(0);
|
||||
else if(objname == "btnLogMgr2")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(1);
|
||||
else if(objname == "btnLogMgr3")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(2);
|
||||
else if(objname == "btnLogMgr4")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(3);
|
||||
else if(objname == "btnLogMgr5")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(4);
|
||||
else if(objname == "btnLogMgr6")
|
||||
ui->stackedWidgetLogMgr->setCurrentIndex(5);
|
||||
}
|
||||
|
||||
void Dialog::on_pbtnSysMgr_clicked()
|
||||
{
|
||||
QAbstractButton *b = (QAbstractButton *)sender();
|
||||
qDebug()<<b->objectName();
|
||||
foreach (QAbstractButton *btn, ui->page_21->findChildren<QAbstractButton *>()) {
|
||||
btn->setChecked(b == btn);
|
||||
}
|
||||
|
||||
if(b->objectName() == "btnPcMsg")
|
||||
ui->stackedWidget_7->setCurrentIndex(0);
|
||||
else if(b->objectName() == "btnExeList")
|
||||
ui->stackedWidget_7->setCurrentIndex(1);
|
||||
}
|
||||
83
dialog.h
Executable file
@@ -0,0 +1,83 @@
|
||||
#ifndef DIALOG_H
|
||||
#define DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMenu>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
namespace Ui {
|
||||
class Dialog;
|
||||
}
|
||||
|
||||
class Dialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Dialog(QWidget *parent = nullptr);
|
||||
~Dialog();
|
||||
QWidget *w;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
signals:
|
||||
void frameWarnMsgSignal();
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Min_clicked();
|
||||
|
||||
void on_btnMenu_Close_clicked();
|
||||
|
||||
void on_tbtnMenu_All_clicked();
|
||||
|
||||
void on_pbtnWhiteList_clicked();
|
||||
|
||||
void on_pbtnPeripheral_clicked();
|
||||
|
||||
void on_pbtnPcDefense_clicked();
|
||||
|
||||
void on_pbtnNetDefense_clicked();
|
||||
|
||||
void on_pbtnSysManage_clicked();
|
||||
|
||||
void on_frameWarnMsg_clicked();
|
||||
|
||||
void on_pbtnWarnMsgMenu_clicked();
|
||||
|
||||
void on_pbtnLogMgrMenu_clicked();
|
||||
|
||||
void on_pbtnSysMgr_clicked();
|
||||
private:
|
||||
Ui::Dialog *ui;
|
||||
QPushButton *pbtnChpwd;
|
||||
QPushButton *pbtnunlod;
|
||||
QVBoxLayout *vlyMenu;
|
||||
|
||||
QButtonGroup *m_udiskGroup;
|
||||
QButtonGroup *m_wlanGroup;
|
||||
QButtonGroup *m_usbcdGroup;
|
||||
QGraphicsDropShadowEffect *shadow_effect;
|
||||
|
||||
bool modeState;
|
||||
|
||||
bool warnMsgState;
|
||||
|
||||
private:
|
||||
void formInit();
|
||||
void mainFormInit();
|
||||
void mainFormP1Init();
|
||||
void whiteListFormP1Init();
|
||||
void perlMgrFormP1Init();
|
||||
void logMgrInit();
|
||||
void pcDefFormInit();
|
||||
void pcNetDefFormInit();
|
||||
void sysMgrFormInit();
|
||||
};
|
||||
|
||||
#endif // DIALOG_H
|
||||
48
heads.h
Executable file
@@ -0,0 +1,48 @@
|
||||
#ifndef HEADS_H
|
||||
#define HEADS_H
|
||||
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QWidget>
|
||||
#include <QAbstractButton>
|
||||
#include <QIcon>
|
||||
#include <QPalette>
|
||||
#include <QBrush>
|
||||
#include <QDebug>
|
||||
#include <QToolButton>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QLabel>
|
||||
#include <QEvent>
|
||||
#include <QPainter>
|
||||
#include <QScreen>
|
||||
#include <QMouseEvent>
|
||||
#include <QMouseEventTransition>
|
||||
#include <QSettings>
|
||||
#include <QProgressDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QProgressBar>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#include <QFont>
|
||||
#include <QPainterPath>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtWidgets>
|
||||
#include <QMenu>
|
||||
#include <QStyle>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||
#include <QtCore5Compat>
|
||||
#endif
|
||||
|
||||
#endif // HEADS_H
|
||||
29
main.cpp
Executable file
@@ -0,0 +1,29 @@
|
||||
#include "dialog.h"
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
#include <appinit.h>
|
||||
|
||||
#include <qthread.h>
|
||||
#include "cJSON.h"
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
AppInit::Instance()->start();
|
||||
QFile file(":/src/Qss.css");
|
||||
if(file.open(QFile::ReadOnly))
|
||||
{
|
||||
QString qss = QLatin1String(file.readAll());
|
||||
qApp->setStyleSheet(qss);
|
||||
}
|
||||
//supplicant_portal();
|
||||
|
||||
|
||||
Dialog w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
46
pcdefenser.pro
Executable file
@@ -0,0 +1,46 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
appinit.cpp \
|
||||
main.cpp \
|
||||
dialog.cpp \
|
||||
smoothcurvecreator.cpp \
|
||||
switchbutton.cpp \
|
||||
tablepagewidget.cpp \
|
||||
wavechart.cpp
|
||||
|
||||
HEADERS += \
|
||||
appinit.h \
|
||||
dialog.h \
|
||||
heads.h \
|
||||
smoothcurvecreator.h \
|
||||
switchbutton.h \
|
||||
tablepagewidget.h \
|
||||
wavechart.h
|
||||
|
||||
FORMS += \
|
||||
dialog.ui \
|
||||
tablepagewidget.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
||||
src.qrc
|
||||
317
pcdefenser.pro.user
Executable file
@@ -0,0 +1,317 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.1, 2024-04-05T14:51:35. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{ad50a6e7-008d-406a-81eb-33edaff1afa5}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
|
||||
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.gcc_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lennlouis/lenn_ws/c_ws/build-pcdefenser-Desktop_Qt_5_14_2_GCC_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lennlouis/lenn_ws/c_ws/build-pcdefenser-Desktop_Qt_5_14_2_GCC_64bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lennlouis/lenn_ws/c_ws/build-pcdefenser-Desktop_Qt_5_14_2_GCC_64bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
||||
<value type="QString">cpu-cycles</value>
|
||||
</valuelist>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
||||
<value type="QString">-e</value>
|
||||
<value type="QString">cpu-cycles</value>
|
||||
<value type="QString">--call-graph</value>
|
||||
<value type="QString">dwarf,4096</value>
|
||||
<value type="QString">-F</value>
|
||||
<value type="QString">250</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lennlouis/lenn_ws/c_ws/pcdefenser/pcdefenser.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/lennlouis/lenn_ws/c_ws/pcdefenser/pcdefenser.pro</value>
|
||||
<value type="QString" key="RunConfiguration.Arguments"></value>
|
||||
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
|
||||
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/lennlouis/lenn_ws/c_ws/build-pcdefenser-Desktop_Qt_5_14_2_GCC_64bit-Debug</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
60
pcdefenser.rc
Executable file
@@ -0,0 +1,60 @@
|
||||
// Microsoft Visual C++ <20><><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Դ<EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
||||
//
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><> TEXTINCLUDE 2 <20><>Դ<EFBFBD><D4B4><EFBFBD>ɡ<EFBFBD>
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// <20><><EFBFBD><EFBFBD>(<28><><EFBFBD>壬<EFBFBD>й<EFBFBD>) <20><>Դ
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE 4, 2
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD>壬<EFBFBD>й<EFBFBD>) <20><>Դ
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// <20><> TEXTINCLUDE 3 <20><>Դ<EFBFBD><D4B4><EFBFBD>ɡ<EFBFBD>
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // <20><><EFBFBD><EFBFBD> APSTUDIO_INVOKED
|
||||
150
quihelper.h
Executable file
@@ -0,0 +1,150 @@
|
||||
#ifndef QUIHELPER2_H
|
||||
#define QUIHELPER2_H
|
||||
|
||||
#include "heads.h"
|
||||
|
||||
class QUIHelper
|
||||
{
|
||||
public:
|
||||
//获取当前鼠标所在屏幕索引/区域尺寸/缩放系数
|
||||
static int getScreenIndex();
|
||||
static QRect getScreenRect(bool available = true);
|
||||
static qreal getScreenRatio(bool devicePixel = false);
|
||||
//矫正当前鼠标所在屏幕居中尺寸
|
||||
static QRect checkCenterRect(QRect &rect, bool available = true);
|
||||
|
||||
//获取桌面宽度高度+居中显示
|
||||
static int deskWidth();
|
||||
static int deskHeight();
|
||||
static QSize deskSize();
|
||||
|
||||
//居中显示窗体
|
||||
//定义标志位指定是以桌面为参照还是主程序界面为参照
|
||||
static QWidget *centerBaseForm;
|
||||
static void setFormInCenter(QWidget *form);
|
||||
static void showForm(QWidget *form);
|
||||
|
||||
//程序文件名称+当前所在路径
|
||||
static QString appName();
|
||||
static QString appPath();
|
||||
|
||||
|
||||
//获取内置颜色集合
|
||||
static QList<QColor> colors;
|
||||
static QList<QColor> getColorList();
|
||||
static QStringList getColorNames();
|
||||
//随机获取颜色集合中的颜色
|
||||
static QColor getRandColor();
|
||||
|
||||
//初始化随机数种子
|
||||
static void initRand();
|
||||
//获取随机小数
|
||||
static float getRandFloat(float min, float max);
|
||||
//获取随机数,指定最小值和最大值
|
||||
static double getRandValue(int min, int max, bool contansMin = false, bool contansMax = false);
|
||||
//获取范围值随机经纬度集合
|
||||
static QStringList getRandPoint(int count, float mainLng, float mainLat, float dotLng, float dotLat);
|
||||
//根据旧的范围值和值计算新的范围值对应的值
|
||||
static int getRangeValue(int oldMin, int oldMax, int oldValue, int newMin, int newMax);
|
||||
|
||||
//获取uuid
|
||||
static QString getUuid();
|
||||
//校验目录
|
||||
static void checkPath(const QString &dirName);
|
||||
//延时
|
||||
static void sleep(int msec);
|
||||
|
||||
//设置Qt自带样式
|
||||
static void setStyle();
|
||||
//设置字体
|
||||
static QFont addFont(const QString &fontFile, const QString &fontName);
|
||||
static void setFont(int fontSize = 12);
|
||||
//设置编码
|
||||
static void setCode(bool utf8 = true);
|
||||
//设置翻译文件
|
||||
static void setTranslator(const QString &qmFile);
|
||||
|
||||
//动态设置权限
|
||||
static bool checkPermission(const QString &permission);
|
||||
//申请安卓权限
|
||||
static void initAndroidPermission();
|
||||
|
||||
//一次性设置所有包括编码样式字体等
|
||||
static void initAll(bool utf8 = true, bool style = true, int fontSize = 13);
|
||||
//初始化main函数最前面执行的一段代码
|
||||
static void initMain(bool desktopSettingsAware = true, bool useOpenGLES = false);
|
||||
|
||||
//插入消息
|
||||
static QVector<int> msgTypes;
|
||||
static QVector<QString> msgKeys;
|
||||
static QVector<QColor> msgColors;
|
||||
static QString appendMsg(QTextEdit *textEdit, int type, const QString &data,
|
||||
int maxCount, int ¤tCount,
|
||||
bool clear = false, bool pause = false);
|
||||
|
||||
//设置无边框
|
||||
static void setFramelessForm(QWidget *widgetMain, bool tool = false, bool top = false, bool menu = true);
|
||||
|
||||
//弹出框
|
||||
static int showMessageBox(const QString &text, int type = 0, int closeSec = 0, bool exec = false);
|
||||
//弹出消息框
|
||||
static void showMessageBoxInfo(const QString &text, int closeSec = 0, bool exec = false);
|
||||
//弹出错误框
|
||||
static void showMessageBoxError(const QString &text, int closeSec = 0, bool exec = false);
|
||||
//弹出询问框
|
||||
static int showMessageBoxQuestion(const QString &text);
|
||||
|
||||
//为什么还要自定义对话框因为可控宽高和汉化对应文本等
|
||||
//初始化对话框文本
|
||||
static void initDialog(QFileDialog *dialog, const QString &title, const QString &acceptName,
|
||||
const QString &dirName, bool native, int width, int height);
|
||||
//拿到对话框结果
|
||||
static QString getDialogResult(QFileDialog *dialog);
|
||||
//选择文件对话框
|
||||
static QString getOpenFileName(const QString &filter = QString(),
|
||||
const QString &dirName = QString(),
|
||||
const QString &fileName = QString(),
|
||||
bool native = false, int width = 900, int height = 600);
|
||||
//保存文件对话框
|
||||
static QString getSaveFileName(const QString &filter = QString(),
|
||||
const QString &dirName = QString(),
|
||||
const QString &fileName = QString(),
|
||||
bool native = false, int width = 900, int height = 600);
|
||||
//选择目录对话框
|
||||
static QString getExistingDirectory(const QString &dirName = QString(),
|
||||
bool native = false, int width = 900, int height = 600);
|
||||
|
||||
//异或加密-只支持字符,如果是中文需要将其转换base64编码
|
||||
static QString getXorEncryptDecrypt(const QString &value, char key);
|
||||
//异或校验
|
||||
static quint8 getOrCode(const QByteArray &data);
|
||||
//计算校验码
|
||||
static quint8 getCheckCode(const QByteArray &data);
|
||||
|
||||
//初始化表格
|
||||
static void initTableView(QTableView *tableView, int rowHeight = 25,
|
||||
bool headVisible = false, bool edit = false,
|
||||
bool stretchLast = true);
|
||||
//打开文件带提示框
|
||||
static void openFile(const QString &fileName, const QString &msg);
|
||||
|
||||
//检查ini配置文件
|
||||
static bool checkIniFile(const QString &iniFile);
|
||||
|
||||
//首尾截断字符串显示
|
||||
static QString cutString(const QString &text, int len, int left, int right, bool file, const QString &mid = "...");
|
||||
|
||||
//传入图片尺寸和窗体区域及边框大小返回居中区域(scaleMode: 0-自动调整 1-等比缩放 2-拉伸填充)
|
||||
static QRect getCenterRect(const QSize &imageSize, const QRect &widgetRect, int borderWidth = 2, int scaleMode = 0);
|
||||
//传入图片尺寸和窗体尺寸及缩放策略返回合适尺寸(scaleMode: 0-自动调整 1-等比缩放 2-拉伸填充)
|
||||
static void getScaledImage(QImage &image, const QSize &widgetSize, int scaleMode = 0, bool fast = true);
|
||||
|
||||
//毫秒数转时间 00:00
|
||||
static QString getTimeString(qint64 time);
|
||||
//用时时间转秒数
|
||||
static QString getTimeString(QElapsedTimer timer);
|
||||
//文件大小转 KB MB GB TB
|
||||
static QString getSizeString(quint64 size);
|
||||
};
|
||||
|
||||
#endif // QUIHELPER2_H
|
||||
14
resource.h
Executable file
@@ -0,0 +1,14 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by pcdefenser.rc
|
||||
|
||||
// <20>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ĭ<EFBFBD><C4AC>ֵ
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
94
smoothcurvecreator.cpp
Executable file
@@ -0,0 +1,94 @@
|
||||
#include "smoothcurvecreator.h"
|
||||
|
||||
QPainterPath SmoothCurveCreator::createSmoothCurve(const QVector<QPointF> &points)
|
||||
{
|
||||
QPainterPath path;
|
||||
int len = points.size();
|
||||
if (len < 2) {
|
||||
return path;
|
||||
}
|
||||
|
||||
QVector<QPointF> firstControlPoints;
|
||||
QVector<QPointF> secondControlPoints;
|
||||
calculateControlPoints(points, &firstControlPoints, &secondControlPoints);
|
||||
path.moveTo(points[0].x(), points[0].y());
|
||||
|
||||
for (int i = 0; i < len - 1; ++i) {
|
||||
path.cubicTo(firstControlPoints[i], secondControlPoints[i], points[i + 1]);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void SmoothCurveCreator::calculateFirstControlPoints(double *&result, const double *rhs, int n)
|
||||
{
|
||||
result = new double[n];
|
||||
double *tmp = new double[n];
|
||||
double b = 2.0;
|
||||
result[0] = rhs[0] / b;
|
||||
|
||||
for (int i = 1; i < n; i++) {
|
||||
tmp[i] = 1 / b;
|
||||
b = (i < n - 1 ? 4.0 : 3.5) - tmp[i];
|
||||
result[i] = (rhs[i] - result[i - 1]) / b;
|
||||
}
|
||||
|
||||
for (int i = 1; i < n; i++) {
|
||||
result[n - i - 1] -= tmp[n - i] * result[n - i];
|
||||
}
|
||||
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
void SmoothCurveCreator::calculateControlPoints(const QVector<QPointF> &knots, QVector<QPointF> *firstControlPoints, QVector<QPointF> *secondControlPoints)
|
||||
{
|
||||
int n = knots.size() - 1;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
firstControlPoints->append(QPointF());
|
||||
secondControlPoints->append(QPointF());
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
(*firstControlPoints)[0].rx() = (2 * knots[0].x() + knots[1].x()) / 3;
|
||||
(*firstControlPoints)[0].ry() = (2 * knots[0].y() + knots[1].y()) / 3;
|
||||
(*secondControlPoints)[0].rx() = 2 * (*firstControlPoints)[0].x() - knots[0].x();
|
||||
(*secondControlPoints)[0].ry() = 2 * (*firstControlPoints)[0].y() - knots[0].y();
|
||||
return;
|
||||
}
|
||||
|
||||
double *xs = 0;
|
||||
double *ys = 0;
|
||||
double *rhsx = new double[n];
|
||||
double *rhsy = new double[n];
|
||||
|
||||
for (int i = 1; i < n - 1; ++i) {
|
||||
rhsx[i] = 4 * knots[i].x() + 2 * knots[i + 1].x();
|
||||
rhsy[i] = 4 * knots[i].y() + 2 * knots[i + 1].y();
|
||||
}
|
||||
|
||||
rhsx[0] = knots[0].x() + 2 * knots[1].x();
|
||||
rhsx[n - 1] = (8 * knots[n - 1].x() + knots[n].x()) / 2.0;
|
||||
rhsy[0] = knots[0].y() + 2 * knots[1].y();
|
||||
rhsy[n - 1] = (8 * knots[n - 1].y() + knots[n].y()) / 2.0;
|
||||
|
||||
calculateFirstControlPoints(xs, rhsx, n);
|
||||
calculateFirstControlPoints(ys, rhsy, n);
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
(*firstControlPoints)[i].rx() = xs[i];
|
||||
(*firstControlPoints)[i].ry() = ys[i];
|
||||
|
||||
if (i < n - 1) {
|
||||
(*secondControlPoints)[i].rx() = 2 * knots[i + 1].x() - xs[i + 1];
|
||||
(*secondControlPoints)[i].ry() = 2 * knots[i + 1].y() - ys[i + 1];
|
||||
} else {
|
||||
(*secondControlPoints)[i].rx() = (knots[n].x() + xs[n - 1]) / 2;
|
||||
(*secondControlPoints)[i].ry() = (knots[n].y() + ys[n - 1]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
delete xs;
|
||||
delete ys;
|
||||
delete rhsx;
|
||||
delete rhsy;
|
||||
}
|
||||
18
smoothcurvecreator.h
Executable file
@@ -0,0 +1,18 @@
|
||||
#ifndef SMOOTHCURVECREATOR_H
|
||||
#define SMOOTHCURVECREATOR_H
|
||||
|
||||
#include <QList>
|
||||
#include <QPointF>
|
||||
#include <QPainterPath>
|
||||
|
||||
class SmoothCurveCreator
|
||||
{
|
||||
public:
|
||||
static QPainterPath createSmoothCurve(const QVector<QPointF> &points);
|
||||
|
||||
private:
|
||||
static void calculateFirstControlPoints(double *&result, const double *rhs, int n);
|
||||
static void calculateControlPoints(const QVector<QPointF> &knots, QVector<QPointF> *firstControlPoints, QVector<QPointF> *secondControlPoints);
|
||||
};
|
||||
|
||||
#endif // SMOOTHCURVECREATOR_H
|
||||
29
src.qrc
Executable file
@@ -0,0 +1,29 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>src/icon_leftbar_normal.svg</file>
|
||||
<file>src/icon_leftbar_selected.svg</file>
|
||||
<file>src/icon_logo.svg</file>
|
||||
<file>src/icon_logo_b.ico</file>
|
||||
<file>src/icon_logo_b.png</file>
|
||||
<file>src/icon_logo_b.svg</file>
|
||||
<file>src/icon_logo_w.ico</file>
|
||||
<file>src/icon_logo_w.png</file>
|
||||
<file>src/img_circle.svg</file>
|
||||
<file>src/img_loading_bg.png</file>
|
||||
<file>src/img_login_bg.png</file>
|
||||
<file>src/img_shield.svg</file>
|
||||
<file>src/img_login_bg_new.png</file>
|
||||
<file>src/img_Menu_bg.png</file>
|
||||
<file>src/header-bg.png</file>
|
||||
<file>src/menu-user-gl.svg</file>
|
||||
<file>src/menu-user.png</file>
|
||||
<file>src/new/menu-1.png</file>
|
||||
<file>src/new/menu-2.png</file>
|
||||
<file>src/new/menu-3.png</file>
|
||||
<file>src/new/menu-4.png</file>
|
||||
<file>src/new/menu-5.png</file>
|
||||
<file>src/new/menu-6.png</file>
|
||||
<file>src/new/menu-7.png</file>
|
||||
<file>src/Qss.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
743
src/Qss.css
Executable file
@@ -0,0 +1,743 @@
|
||||
/*QWidget{
|
||||
border-style:none;
|
||||
margin:0px;
|
||||
}*/
|
||||
QDialog#Dialog QPushButton:disabled{
|
||||
background-color:rgb(245,245,245);
|
||||
color:rgb(220,220,220);
|
||||
}
|
||||
|
||||
QLabel{
|
||||
color:white;
|
||||
font:14px;
|
||||
}
|
||||
|
||||
QToolButton#btnWhiteList{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnLogMgr{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnMain{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnNetDef{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnPerlMgr{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnPcDef{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnSysMgr{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
QToolButton#btnUser{
|
||||
color:white;
|
||||
margin:-1px;
|
||||
font:14px;
|
||||
padding-bottom:20px;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
QToolButton#btnWhiteList:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2657A5);
|
||||
}
|
||||
QToolButton#btnLogMgr:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #224FA3);
|
||||
}
|
||||
QToolButton#btnMain:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2259A6);
|
||||
}
|
||||
QToolButton#btnNetDef:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #094AA5,stop:0.9 #1E4DA5);
|
||||
}
|
||||
QToolButton#btnPerlMgr:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2453A5);
|
||||
}
|
||||
QToolButton#btnPcDef:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #094AA5,stop:0.9 #1E4DA5);
|
||||
}
|
||||
QToolButton#btnSysMgr:hover{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #10499E,stop:0.9 #214AA7);
|
||||
}
|
||||
|
||||
/*checked*/
|
||||
|
||||
QToolButton#btnWhiteList:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2657A5);
|
||||
}
|
||||
QToolButton#btnLogMgr:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #224FA3);
|
||||
}
|
||||
QToolButton#btnMain:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2259A6);
|
||||
}
|
||||
QToolButton#btnNetDef:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #094AA5,stop:0.9 #1E4DA5);
|
||||
}
|
||||
QToolButton#btnPerlMgr:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #0D4D9D,stop:0.9 #2453A5);
|
||||
}
|
||||
QToolButton#btnPcDef:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #094AA5,stop:0.9 #1E4DA5);
|
||||
}
|
||||
QToolButton#btnSysMgr:checked{
|
||||
background-color: qlineargradient(spread:pad,x1:0,y1:1,x2:0,y2:0,stop:0 #062B9B,stop:0.08 #10499E,stop:0.9 #214AA7);
|
||||
}
|
||||
|
||||
QStackedWidget{
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
QPushButton#btnMenu_Min,QPushButton#btnMenu_Close{
|
||||
color:white;
|
||||
font:13px;
|
||||
background:none;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnMenu_Min:hover{
|
||||
color:#FFFFFF;
|
||||
background-color:rgb(51,127,209);
|
||||
}
|
||||
|
||||
QPushButton#btnMenu_Close:hover{
|
||||
color:#FFFFFF;
|
||||
background-color:rgb(238,0,0);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnScanWhiteList{
|
||||
color:white;
|
||||
font:13px;
|
||||
background-color: rgb(9, 96, 169);
|
||||
height:34px;
|
||||
width:104px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
}
|
||||
|
||||
QPushButton#btnScanWhiteList:hover{
|
||||
background-color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
QPushButton#btnLoadWhiteList{
|
||||
background-color: rgb(255, 255, 255);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color:black;
|
||||
}
|
||||
QPushButton#btnLoadWhiteList:hover{
|
||||
color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnAppendFile{
|
||||
background-color: rgb(255, 255, 255);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color:black;
|
||||
}
|
||||
QPushButton#btnAppendFile:hover{
|
||||
color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
QPushButton#btnUnloadWhiteList{
|
||||
background-color: white;
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: black;
|
||||
}
|
||||
QPushButton#btnUnloadWhiteList:hover{
|
||||
color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnUnloadWhiteList{
|
||||
background-color: white;
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: black;
|
||||
}
|
||||
QPushButton#btnUnloadWhiteList:hover{
|
||||
color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnAppendDir{
|
||||
background-color: white;
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: black;
|
||||
}
|
||||
QPushButton#btnAppendf:hover{
|
||||
background-color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
QLabel#labScanState{
|
||||
border: 2px solid rgb(145,213,255);
|
||||
background-color: rgb(230,247,255);
|
||||
font:10px;
|
||||
width:45px;
|
||||
height:100px;
|
||||
border-radius:2px;
|
||||
padding:2pt, 1pt;
|
||||
color:rgb(9, 109, 217);
|
||||
}
|
||||
|
||||
QProgressBar#probScan{
|
||||
background-color: rgb(245, 245, 245);
|
||||
/*width:150px;
|
||||
height:10px;*/
|
||||
border-style:none;
|
||||
border-radius:10px 10px;
|
||||
}
|
||||
QProgressBar#probScan:chunk{
|
||||
background-color: rgb(9, 96, 189);
|
||||
}
|
||||
|
||||
QPushButton#btnRm{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPushButton#btnClear{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPushButton#btnExeWhiteList{
|
||||
width:120px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
}
|
||||
|
||||
QPushButton#btnExeWhiteList:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QPushButton#btnExeWhiteList:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QPushButton#btnTrustList{
|
||||
width:120px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
}
|
||||
QPushButton#btnTrustList:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QPushButton#btnTrustList:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QLineEdit#ledtInputFileName{
|
||||
height:30px;
|
||||
width:200px;
|
||||
border:2px solid rgb(217,217,217);
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
QToolButton#btnScarchFile{
|
||||
margin:0px;
|
||||
width:30px;
|
||||
height:27px;
|
||||
border-top:2px solid rgb(217,217,217);
|
||||
border-right:2px solid rgb(217,217,217);
|
||||
border-bottom:2px solid rgb(217,217,217);
|
||||
}
|
||||
|
||||
QPushButton#btnChoiseAll{
|
||||
background-color: white;
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: black;
|
||||
}
|
||||
QPushButton#btnChoiseAll:hover{
|
||||
color: rgb(42, 125, 201);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnAddTrustDir{
|
||||
width:150px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnAddTrustDir:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
QPushButton#btnRmTrustFiles{
|
||||
background-color:rgb(237,111,111);
|
||||
color:white;
|
||||
width:100px;
|
||||
height:30px;
|
||||
font:14px;
|
||||
border:2px solid rgb(220,220,220);
|
||||
border-radius:1px;
|
||||
}
|
||||
|
||||
QPushButton#btnChoiseAllTrustFiles{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnChoiseAllTrustFiles:hover{
|
||||
color:rgb(9,96,189);
|
||||
border:2px solid rgb(9,96,189);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnPerlManager{
|
||||
width:120px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
}
|
||||
QPushButton#btnPerlManager:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QPushButton#btnPerlManager:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
|
||||
QPushButton#btnUdiskWhiteList{
|
||||
width:120px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
}
|
||||
QPushButton#btnUdiskWhiteList:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
QPushButton#btnUdiskWhiteList:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
|
||||
QLabel#labUdisk{
|
||||
font:14px;
|
||||
color:black;
|
||||
}
|
||||
|
||||
QLabel#labCD{
|
||||
font:14px;
|
||||
color:black;
|
||||
}
|
||||
|
||||
QLabel#labWlan{
|
||||
font:14px;
|
||||
color:black;
|
||||
}
|
||||
|
||||
QRadioButton{
|
||||
font:14px;
|
||||
}
|
||||
|
||||
QPushButton#btnAddUdisk{
|
||||
width:80px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnAddUdisk:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
QPushButton#btnRmUdisk{
|
||||
background-color:rgb(237,111,111);
|
||||
color:white;
|
||||
width:100px;
|
||||
height:30px;
|
||||
font:14px;
|
||||
border:2px solid rgb(220,220,220);
|
||||
border-radius:1px;
|
||||
}
|
||||
|
||||
QPushButton#btnChoiseAllUdisk{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnChoiseAllUdisk:hover{
|
||||
color:rgb(9,96,189);
|
||||
border:2px solid rgb(9,96,189);
|
||||
}
|
||||
|
||||
QFrame#framePcDef{
|
||||
border-right:8px solid rgb(220,220,220);
|
||||
}
|
||||
|
||||
QFrame#framePcDef > QPushButton{
|
||||
width:130px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
text-align:left;
|
||||
font:14px;
|
||||
padding-left:16px;
|
||||
}
|
||||
QFrame#framePcDef > QPushButton:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QFrame#framePcDef > QPushButton:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
/*蓝色按钮*/
|
||||
QPushButton#btnPcDefAddPath{
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnPcDefAddPath:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
/*红色按钮*/
|
||||
QPushButton#btnPcDefRm{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/*白色按钮*/
|
||||
QPushButton#btnPcDefChoiseAll{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnPcDefChoiseAll:hover{
|
||||
color:rgb(9,96,189);
|
||||
border:2px solid rgb(9,96,189);
|
||||
}
|
||||
|
||||
QPushButton#btnPcDefFilePath{
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnPcDefFilePath:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
QPushButton#btnPcDefRmFilePath{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPushButton#btnPcDefChoiseAllFile{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
|
||||
QLabel#labWinDefensewell{
|
||||
color:black;
|
||||
font:14px;
|
||||
}
|
||||
|
||||
SwitchButton#sbtnWinDefwell{
|
||||
width:30px;
|
||||
height:20px;
|
||||
}
|
||||
|
||||
QPushButton#btnPcDefAddRules{
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnPcDefAddRules:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
QPushButton#btnPcDefRmRules{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPushButton#btnChoiseAllRules{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnChoiseAllRules:hover{
|
||||
color:rgb(9,96,189);
|
||||
border:2px solid rgb(9,96,189);
|
||||
}
|
||||
|
||||
QLabel#labDiskProtect{
|
||||
color:black;
|
||||
font:14px;
|
||||
}
|
||||
|
||||
QLabel#labUSBKey{
|
||||
color:black;
|
||||
font:14px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
QLabel#labDoubleLog{
|
||||
color:black;
|
||||
font:14px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
QLabel#labUSBKeyState{
|
||||
width:30px;
|
||||
height:20px;
|
||||
border:2px solid rgb(220,220,220);
|
||||
color:black;
|
||||
font:10px;
|
||||
padding:2pt;
|
||||
}
|
||||
|
||||
QFrame#frameNetDef > QPushButton{
|
||||
width:130px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
text-align:left;
|
||||
font:14px;
|
||||
padding-left:16px;
|
||||
}
|
||||
QFrame#frameNetDef > QPushButton:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
QFrame#frameNetDef > QPushButton:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QWidget#page_17 QLabel{
|
||||
color:black;
|
||||
font:15px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
QLabel#labUnlawList{
|
||||
color:black;
|
||||
font:14px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
QPushButton#btnAddUnlawList{
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-style:none;
|
||||
color:white;
|
||||
background-color:rgb(9,96,189);
|
||||
font:14px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnAddUnlawList:hover{
|
||||
background-color:rgb(42,125,201);
|
||||
}
|
||||
|
||||
QPushButton#btnRmUnlawList{
|
||||
background-color: rgb(237, 111, 111);
|
||||
border: 2px solid rgb(220,220,220);
|
||||
font:13px;
|
||||
height:30px;
|
||||
width:100px;
|
||||
border-radius:4px;
|
||||
padding:3pt, 3pt;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPushButton#btnChoiseAllUnlawPath{
|
||||
background-color:white;
|
||||
color:black;
|
||||
border:2px solid rgb(220,220,220);
|
||||
font:14px;
|
||||
width:100px;
|
||||
height:30px;
|
||||
border-radius:1px;
|
||||
}
|
||||
QPushButton#btnChoiseAllUnlawPath:hover{
|
||||
color:rgb(9,96,189);
|
||||
border:2px solid rgb(9,96,189);
|
||||
}
|
||||
|
||||
|
||||
QLabel#labSysUsers{
|
||||
font:15px;
|
||||
font-weight:bold;
|
||||
color:black;
|
||||
}
|
||||
QLabel#labSysUserMgr{
|
||||
font:15px;
|
||||
font-weight:bold;
|
||||
color:black;
|
||||
}
|
||||
|
||||
QFrame#frameSysMgr > QPushButton{
|
||||
width:130px;
|
||||
height:40px;
|
||||
border-style:none;
|
||||
background:rgb(255,255,255);
|
||||
color:black;
|
||||
text-align:left;
|
||||
font:14px;
|
||||
padding-left:16px;
|
||||
}
|
||||
QFrame#frameSysMgr > QPushButton:hover{
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
QFrame#frameSysMgr > QPushButton:checked{
|
||||
background:rgb(227,244,252);
|
||||
color:rgb(9,96,189);
|
||||
}
|
||||
|
||||
QWidget#page_23 > QLabel{
|
||||
font:14px;
|
||||
color:black;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
src/header-bg.png
Executable file
|
After Width: | Height: | Size: 146 KiB |
3
src/icon_leftbar_normal.svg
Executable file
@@ -0,0 +1,3 @@
|
||||
<svg width="10" height="13" viewBox="0 0 10 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 0C5.73438 0 6.46875 0.0936 7.18625 0.28015L10 1.01205V6.47075C10 8.12565 9.25062 9.68435 7.9775 10.6775L5 13L2.0225 10.6775C0.749375 9.68435 0 8.12565 0 6.47075V1.01205L2.81375 0.28015C3.53125 0.0936 4.26562 0 5 0ZM5 1.3C4.36562 1.3 3.7325 1.38125 3.11687 1.54115L1.25 2.0267V6.47075C1.25 7.70965 1.81937 8.89395 2.77312 9.63755L5 11.375L7.22687 9.63755C8.18062 8.89395 8.75 7.70965 8.75 6.47075V2.0267L6.88312 1.54115C6.2675 1.38125 5.63437 1.3 5 1.3ZM7.43625 3.25L7.49442 3.25546C7.55184 3.26637 7.6061 3.29355 7.64875 3.33645L7.72688 3.41445L7.76166 3.4566C7.84222 3.57513 7.82549 3.73851 7.71938 3.8454L4.32125 7.2657L4.26693 7.31114C4.11399 7.41659 3.90202 7.39649 3.76313 7.25725L2.28188 5.7668L2.24427 5.7213C2.16729 5.60902 2.16633 5.45781 2.25438 5.3469L2.39188 5.1714L2.43162 5.12979C2.53176 5.04318 2.67969 5.03059 2.79125 5.1051L3.98938 5.9111L4.01667 5.91931C4.03889 5.92128 4.06584 5.91652 4.0775 5.90655L7.24375 3.3176C7.29938 3.2721 7.3675 3.25 7.43625 3.25Z" fill="#303133"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
3
src/icon_leftbar_selected.svg
Executable file
@@ -0,0 +1,3 @@
|
||||
<svg width="10" height="13" viewBox="0 0 10 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 0C5.73438 0 6.46875 0.0936 7.18625 0.28015L10 1.01205V6.47075C10 8.12565 9.25062 9.68435 7.9775 10.6775L5 13L2.0225 10.6775C0.749375 9.68435 0 8.12565 0 6.47075V1.01205L2.81375 0.28015C3.53125 0.0936 4.26562 0 5 0ZM5 1.3C4.36562 1.3 3.7325 1.38125 3.11687 1.54115L1.25 2.0267V6.47075C1.25 7.70965 1.81937 8.89395 2.77312 9.63755L5 11.375L7.22687 9.63755C8.18062 8.89395 8.75 7.70965 8.75 6.47075V2.0267L6.88312 1.54115C6.2675 1.38125 5.63437 1.3 5 1.3ZM7.43625 3.25L7.49442 3.25546C7.55184 3.26637 7.6061 3.29355 7.64875 3.33645L7.72688 3.41445L7.76166 3.4566C7.84222 3.57513 7.82549 3.73851 7.71938 3.8454L4.32125 7.2657L4.26693 7.31114C4.11399 7.41659 3.90202 7.39649 3.76313 7.25725L2.28188 5.7668L2.24427 5.7213C2.16729 5.60902 2.16633 5.45781 2.25438 5.3469L2.39188 5.1714L2.43162 5.12979C2.53176 5.04318 2.67969 5.03059 2.79125 5.1051L3.98938 5.9111L4.01667 5.91931C4.03889 5.92128 4.06584 5.91652 4.0775 5.90655L7.24375 3.3176C7.29938 3.2721 7.3675 3.25 7.43625 3.25Z" fill="#004898"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
13
src/icon_logo.svg
Executable file
@@ -0,0 +1,13 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_491_2454)">
|
||||
<path d="M13.2153 2.56815C13.2153 2.56815 11.0221 1.37476 8.00043 1.37476C4.97879 1.37476 2.7864 2.56815 2.7864 2.56815L1.45911 2.91369V7.83828C1.45911 12.0086 7.99876 14.4463 7.99876 14.4463C7.99876 14.4463 14.5418 12.016 14.5418 7.83828V2.91369L13.2153 2.56815ZM7.51573 12.9681L6.9643 12.7588C6.00897 12.4088 5.12515 11.8931 4.35478 11.2363C3.79466 10.752 3.32536 10.1747 2.96826 9.5307C2.37428 8.44565 2.34508 7.56086 2.34425 7.52803V4.02172L3.45713 3.58097C4.77023 3.02778 5.92316 3.02778 6.94595 3.02778H7.11279V3.82638H6.94595C5.95653 3.82638 4.93374 3.82638 3.76997 4.3131L3.15513 4.55933V7.51408C3.16514 7.77673 3.29278 8.45878 3.70407 9.19337C4.01814 9.74876 4.42835 10.2459 4.91623 10.6625C5.4543 11.1195 6.05675 11.4974 6.70485 11.7845V7.81448H7.51573V12.9681ZM13.6575 7.52147V7.53214C13.6575 7.56907 13.6274 8.44893 13.0376 9.53398C12.6839 10.1772 12.218 10.7543 11.6611 11.2387C10.8964 11.894 10.0182 12.4086 9.06827 12.758L8.516 12.9681V3.07292H9.32688V11.7796C9.96809 11.4921 10.5638 11.115 11.0955 10.6601C11.5809 10.2432 11.989 9.7467 12.3018 9.19255C12.7106 8.45386 12.8366 7.77344 12.8466 7.51326V4.28765H13.6575V7.52147Z" fill="#F4F6F9"/>
|
||||
<path d="M7.86779 15.9516C6.49371 15.4078 5.18672 14.7126 3.97186 13.8791C2.83645 13.0912 1.91878 12.2491 1.26557 11.3766C0.426315 10.2596 1.52588e-05 9.09326 1.52588e-05 7.90479V1.74905L1.79281 1.41254C2.34979 1.13511 2.92836 0.901824 3.52304 0.714887C4.96846 0.248271 6.4792 0.00705777 8.00043 0C9.52194 0.00699914 11.033 0.248213 12.4787 0.714887C13.0724 0.900957 13.6501 1.13314 14.2064 1.40925L16 1.74577V7.90151C16 9.09244 15.5746 10.262 14.7353 11.3774C14.0787 12.2499 13.1669 13.092 12.0265 13.88C10.8107 14.712 9.50323 15.4062 8.12891 15.9491L7.99793 15.9967L7.86779 15.9516ZM13.9578 2.10198L13.9052 2.07325C13.8802 2.06012 11.39 0.725557 8.00043 0.725557C4.61089 0.725557 2.12067 2.06012 2.09564 2.07325L2.04308 2.10198L0.739157 2.33672V7.90479C0.739157 8.93239 1.11373 9.9567 1.85371 10.9416C2.46104 11.7509 3.31281 12.5372 4.38398 13.28C5.51561 14.0521 6.72733 14.7039 7.99876 15.2244C9.26663 14.7077 10.475 14.0597 11.6035 13.2915C12.6789 12.5528 13.5332 11.7616 14.1422 10.9515C14.8855 9.96655 15.2625 8.93896 15.2625 7.90725V2.33672L13.9578 2.10198Z" fill="#F4F6F9"/>
|
||||
<path d="M2.40681 12.6308C0.792549 11.1378 1.52588e-05 9.57917 1.52588e-05 7.91712V1.74414L1.79364 1.42158C2.34995 1.14547 2.92768 0.913286 3.52137 0.727216C4.96716 0.260935 6.47812 0.0197319 7.9996 0.0123291C9.52106 0.0198795 11.032 0.261079 12.4778 0.727216C13.0715 0.913286 13.6492 1.14547 14.2056 1.42158L16 1.74579L15.2667 2.33674L13.9569 2.11431L13.9036 2.08558C13.8794 2.07245 11.3783 0.738706 7.9996 0.738706C4.6209 0.738706 2.119 2.07245 2.09397 2.08558L2.04141 2.11431L1.98218 2.12498L0.737489 2.34905V7.91712C0.737489 9.37069 1.52335 10.8185 2.98328 12.1687L2.40681 12.6308Z" fill="#CED7E4"/>
|
||||
<path d="M14.5418 2.91287L13.2145 2.56897C13.2145 2.56897 11.0212 1.37476 8.00043 1.37476C4.97963 1.37476 2.78556 2.56897 2.78556 2.56897L1.45911 2.91369V7.83828C1.45911 9.39774 2.37094 10.711 3.51386 11.7492L4.25967 11.1517C3.74127 10.6875 3.30461 10.1419 2.96743 9.53727C2.37344 8.45222 2.34425 7.56743 2.34341 7.53378V4.02172L3.45546 3.58097C4.77023 3.03681 5.92316 3.03681 6.94595 3.03681H7.10862V3.83541H6.94177C5.95152 3.83541 4.92874 3.83541 3.76497 4.32212L3.15013 4.56835V7.52311C3.16014 7.78576 3.28778 8.46699 3.69906 9.2024C4.00897 9.74833 4.41161 10.238 4.88953 10.6502L6.70401 9.19255V7.82105H7.5149V8.54332L8.516 7.74225V3.07866H9.32772V7.09221L14.5418 2.91287Z" fill="#CED7E4"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_491_2454">
|
||||
<rect width="16" height="16" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/icon_logo_b.ico
Executable file
|
After Width: | Height: | Size: 168 KiB |
BIN
src/icon_logo_b.png
Executable file
|
After Width: | Height: | Size: 9.2 KiB |
13
src/icon_logo_b.svg
Executable file
@@ -0,0 +1,13 @@
|
||||
<svg width="26" height="28" viewBox="0 0 26 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_2914_30081)">
|
||||
<path d="M21.4748 4.49432C21.4748 4.49432 17.9108 2.40588 13.0007 2.40588C8.09052 2.40588 4.52787 4.49432 4.52787 4.49432L2.37103 5.09902V13.7171C2.37103 21.0151 12.998 25.281 12.998 25.281C12.998 25.281 23.6303 21.028 23.6303 13.7171V5.09902L21.4748 4.49432ZM12.213 22.6942L11.317 22.3279C9.76455 21.7154 8.32835 20.813 7.07649 19.6635C6.1663 18.8161 5.40368 17.8058 4.8234 16.6788C3.85818 14.7799 3.81073 13.2316 3.80938 13.1741V7.03808L5.61781 6.26676C7.75161 5.29867 9.62511 5.29867 11.2871 5.29867H11.5583V6.69623H11.2871C9.67934 6.69623 8.01731 6.69623 6.12618 7.54798L5.12707 7.97888V13.1497C5.14334 13.6093 5.35075 14.8029 6.01909 16.0885C6.52945 17.0604 7.19604 17.9305 7.98885 18.6595C8.86322 19.4591 9.84221 20.1204 10.8954 20.623V13.6754H12.213V22.6942ZM22.1933 13.1626V13.1813C22.1933 13.2459 22.1445 14.7857 21.1861 16.6845C20.6113 17.8102 19.8542 18.82 18.9493 19.6678C17.7067 20.8146 16.2795 21.7151 14.7359 22.3265L13.8385 22.6942V5.37767H15.1562V20.6144C16.1981 20.1112 17.1661 19.4513 18.0301 18.6552C18.8189 17.9257 19.4822 17.0568 19.9904 16.087C20.6547 14.7943 20.8594 13.6036 20.8757 13.1483V7.50345H22.1933V13.1626Z" fill="#0E60AD"/>
|
||||
<path d="M12.7851 27.9153C10.5523 26.9637 8.4284 25.747 6.45425 24.2885C4.60921 22.9096 3.11799 21.4359 2.05652 19.9091C0.692737 17.9542 0 15.9132 0 13.8334V3.06084L2.91329 2.47194C3.81838 1.98645 4.75857 1.57819 5.72491 1.25105C8.07372 0.434474 10.5287 0.0123511 13.0007 0C15.4731 0.0122485 17.9285 0.434373 20.2778 1.25105C21.2426 1.57668 22.1814 1.983 23.0854 2.46619L26 3.05509V13.8276C26 15.9118 25.3086 17.9586 23.9448 19.9105C22.8779 21.4374 21.3962 22.9111 19.543 24.2899C17.5674 25.7461 15.4427 26.9608 13.2094 27.9109L12.9966 27.9943L12.7851 27.9153ZM22.6814 3.67847L22.596 3.62819C22.5553 3.60521 18.5087 1.26972 13.0007 1.26972C7.49267 1.26972 3.44606 3.60521 3.40539 3.62819L3.31999 3.67847L1.20111 4.08926V13.8334C1.20111 15.6317 1.80979 17.4242 3.01225 19.1478C3.99917 20.5641 5.38328 21.9401 7.12394 23.24C8.96285 24.5911 10.9319 25.7317 12.998 26.6427C15.0582 25.7384 17.0219 24.6045 18.8557 23.2601C20.6032 21.9674 21.9913 20.5827 22.981 19.1651C24.1889 17.4415 24.8016 15.6432 24.8016 13.8377V4.08926L22.6814 3.67847Z" fill="#0E60AD"/>
|
||||
<path d="M3.91105 22.1038C1.28787 19.4911 0 16.7635 0 13.8549V3.05216L2.91465 2.48768C3.81864 2.00449 4.75745 1.59816 5.7222 1.27254C8.07161 0.456546 10.5269 0.0344393 12.9993 0.0214844C15.4717 0.0346977 17.927 0.456797 20.2764 1.27254C21.2412 1.59816 22.18 2.00449 23.084 2.48768L26 3.05503L24.8084 4.0892L22.68 3.69995L22.5933 3.64968C22.5539 3.6267 18.4897 1.29264 12.9993 1.29264C7.50894 1.29264 3.44335 3.6267 3.40268 3.64968L3.31727 3.69995L3.22102 3.71862L1.19839 4.11074V13.8549C1.19839 16.3986 2.47542 18.9323 4.8478 21.2951L3.91105 22.1038Z" fill="#00458E"/>
|
||||
<path d="M23.6303 5.09758L21.4735 4.49576C21.4735 4.49576 17.9095 2.40588 13.0007 2.40588C8.09188 2.40588 4.52652 4.49576 4.52652 4.49576L2.37103 5.09902V13.7171C2.37103 16.4461 3.85276 18.7442 5.71 20.5612L6.92195 19.5156C6.07954 18.7031 5.36997 17.7484 4.82205 16.6903C3.85682 14.7914 3.80938 13.2431 3.80802 13.1842V7.03808L5.6151 6.26676C7.75161 5.31447 9.62511 5.31447 11.2871 5.31447H11.5515V6.71203H11.2804C9.67121 6.71203 8.00918 6.71203 6.11805 7.56378L5.11893 7.99468V13.1655C5.1352 13.6251 5.34262 14.8173 6.01095 16.1043C6.51455 17.0596 7.16884 17.9166 7.94546 18.638L10.894 16.087V13.6869H12.2117V14.9509L13.8385 13.549V5.38772H15.1575V12.4114L23.6303 5.09758Z" fill="#00458E"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_2914_30081">
|
||||
<rect width="26" height="28" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
BIN
src/icon_logo_w.ico
Executable file
|
After Width: | Height: | Size: 168 KiB |
BIN
src/icon_logo_w.png
Executable file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
src/img_Menu_bg.png
Executable file
|
After Width: | Height: | Size: 403 KiB |
14
src/img_circle.svg
Executable file
@@ -0,0 +1,14 @@
|
||||
<svg width="640" height="158" viewBox="0 0 640 158" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M476 118.333C476 122.506 473.003 126.485 467.72 129.476C462.468 132.451 455.144 134.323 447 134.323C438.856 134.323 431.532 132.451 426.28 129.476C420.997 126.485 418 122.506 418 118.333C418 114.16 420.997 110.182 426.28 107.19C431.532 104.216 438.856 102.344 447 102.344C455.144 102.344 462.468 104.216 467.72 107.19C473.003 110.182 476 114.16 476 118.333Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M514 126.262C514 135.058 506.785 143.295 494.492 149.392C482.262 155.459 465.295 159.24 446.5 159.24C427.705 159.24 410.738 155.459 398.508 149.392C386.215 143.295 379 135.058 379 126.262C379 117.466 386.215 109.229 398.508 103.131C410.738 97.0642 427.705 93.2831 446.5 93.2831C465.295 93.2831 482.262 97.0642 494.492 103.131C506.785 109.229 514 117.466 514 126.262Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M552 135.323C552 148.793 540.611 161.281 521.52 170.461C502.5 179.606 476.155 185.29 447 185.29C417.845 185.29 391.5 179.606 372.48 170.461C353.389 161.281 342 148.793 342 135.323C342 121.852 353.389 109.364 372.48 100.184C391.5 91.039 417.845 85.3548 447 85.3548C476.155 85.3548 502.5 91.039 521.52 100.184C540.611 109.364 552 121.852 552 135.323Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M586 144.384C586 162.549 570.745 179.284 545.413 191.536C520.151 203.755 485.181 211.34 446.5 211.34C407.819 211.34 372.849 203.755 347.587 191.536C322.255 179.284 307 162.549 307 144.384C307 126.218 322.255 109.483 347.587 97.2309C372.849 85.012 407.819 77.4265 446.5 77.4265C485.181 77.4265 520.151 85.012 545.413 97.2309C570.745 109.483 586 126.218 586 144.384Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M630 153.444C630 176.275 609.858 197.263 576.543 212.602C543.314 227.901 497.338 237.391 446.5 237.391C395.662 237.391 349.686 227.901 316.457 212.602C283.142 197.263 263 176.275 263 153.444C263 130.614 283.142 109.625 316.457 94.2867C349.686 78.9875 395.662 69.4982 446.5 69.4982C497.338 69.4982 543.314 78.9875 576.543 94.2867C609.858 109.625 630 130.614 630 153.444Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M677 160.24C677 173.986 670.678 187.158 659.086 199.225C647.49 211.297 630.663 222.214 609.792 231.404C568.053 249.783 510.322 261.176 446.5 261.176C382.678 261.176 324.947 249.783 283.208 231.404C262.337 222.214 245.51 211.297 233.914 199.225C222.322 187.158 216 173.986 216 160.24C216 146.494 222.322 133.322 233.914 121.255C245.51 109.183 262.337 98.2661 283.208 89.0761C324.947 70.6974 382.678 59.3047 446.5 59.3047C510.322 59.3047 568.053 70.6974 609.792 89.0761C630.663 98.2661 647.49 109.183 659.086 121.255C670.678 133.322 677 146.494 677 160.24Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M719 168.168C719 184.256 711.52 199.662 697.829 213.763C684.133 227.868 664.267 240.616 639.641 251.344C590.391 272.798 522.283 286.093 447 286.093C371.717 286.093 303.609 272.798 254.359 251.344C229.733 240.616 209.867 227.868 196.171 213.763C182.48 199.662 175 184.256 175 168.168C175 152.081 182.48 136.675 196.171 122.574C209.867 108.469 229.733 95.7206 254.359 84.9927C303.609 63.5384 371.717 50.2437 447 50.2437C522.283 50.2437 590.391 63.5384 639.641 84.9927C664.267 95.7206 684.133 108.469 697.829 122.574C711.52 136.675 719 152.081 719 168.168Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M766 176.097C766 194.521 757.213 212.159 741.144 228.295C725.072 244.435 701.764 259.015 672.883 271.282C615.126 295.814 535.264 311.011 447 311.011C358.736 311.011 278.874 295.814 221.117 271.282C192.236 259.015 168.928 244.435 152.856 228.295C136.787 212.159 128 194.521 128 176.097C128 157.672 136.787 140.034 152.856 123.899C168.928 107.759 192.236 93.1781 221.117 80.9115C278.874 56.38 358.736 41.1828 447 41.1828C535.264 41.1828 615.126 56.38 672.883 80.9115C701.764 93.1781 725.072 107.759 741.144 123.899C757.213 140.034 766 157.672 766 176.097Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M836 176.097C836 196.04 825.298 215.158 805.686 232.663C786.075 250.168 757.64 265.978 722.418 279.276C651.982 305.868 554.607 322.337 447 322.337C339.393 322.337 242.018 305.868 171.582 279.276C136.36 265.978 107.925 250.168 88.314 232.663C68.7022 215.158 58 196.04 58 176.097C58 156.153 68.7022 137.036 88.314 119.53C107.925 102.025 136.36 86.2155 171.582 72.9178C242.018 46.3252 339.393 29.8566 447 29.8566C554.607 29.8566 651.982 46.3252 722.418 72.9178C757.64 86.2155 786.075 102.025 805.686 119.53C825.298 137.036 836 156.153 836 176.097Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M903 176C903 196.689 890.477 216.556 867.466 234.77C844.466 252.976 811.122 269.415 769.83 283.239C687.257 310.884 573.119 328 447 328C320.881 328 206.743 310.884 124.17 283.239C82.8778 269.415 49.5342 252.976 26.534 234.77C3.52297 216.556 -9 196.689 -9 176C-9 155.311 3.52297 135.444 26.534 117.23C49.5342 99.0241 82.8778 82.5851 124.17 68.7609C206.743 41.116 320.881 24 447 24C573.119 24 687.257 41.116 769.83 68.7609C811.122 82.5851 844.466 99.0241 867.466 117.23C890.477 135.444 903 155.311 903 176Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M995 194.5C995 219.399 979.876 243.278 952.159 265.141C924.453 286.996 884.299 306.721 834.592 323.305C735.189 356.47 597.801 377 446 377C294.199 377 156.811 356.47 57.4078 323.305C7.70084 306.721 -32.4527 286.996 -60.159 265.141C-87.8764 243.278 -103 219.399 -103 194.5C-103 169.601 -87.8764 145.722 -60.159 123.859C-32.4527 102.004 7.70084 82.2785 57.4078 65.6945C156.811 32.5299 294.199 12 446 12C597.801 12 735.189 32.5299 834.592 65.6945C884.299 82.2785 924.453 102.004 952.159 123.859C979.876 145.722 995 169.601 995 194.5Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
<path d="M1131 229C1131 260.182 1112.08 290.045 1077.51 317.352C1042.95 344.651 992.872 369.278 930.905 389.979C806.981 431.377 635.718 457 446.5 457C257.282 457 86.0191 431.377 -37.9048 389.979C-99.872 369.278 -149.947 344.651 -184.51 317.352C-219.084 290.045 -238 260.182 -238 229C-238 197.818 -219.084 167.955 -184.51 140.648C-149.947 113.349 -99.872 88.7219 -37.9048 68.021C86.0191 26.6226 257.282 1 446.5 1C635.718 1 806.981 26.6226 930.905 68.021C992.872 88.7219 1042.95 113.349 1077.51 140.648C1112.08 167.955 1131 197.818 1131 229Z" stroke="white" stroke-opacity="0.2" stroke-width="2"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/img_loading_bg.png
Executable file
|
After Width: | Height: | Size: 123 KiB |
BIN
src/img_login_bg.png
Executable file
|
After Width: | Height: | Size: 490 KiB |
BIN
src/img_login_bg_new.png
Executable file
|
After Width: | Height: | Size: 3.3 MiB |
195
src/img_shield.svg
Executable file
|
After Width: | Height: | Size: 47 KiB |
37
src/menu-user-gl.svg
Executable file
@@ -0,0 +1,37 @@
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="64" height="64" fill="white" fill-opacity="0.01"/>
|
||||
<g filter="url(#filter0_dd_4313_5552)">
|
||||
<circle cx="32" cy="32" r="24" fill="url(#paint0_linear_4313_5552)" fill-opacity="0.5" shape-rendering="crispEdges"/>
|
||||
</g>
|
||||
<g clip-path="url(#clip0_4313_5552)">
|
||||
<path d="M39.823 25.1733C39.823 25.1733 36.5332 23.234 32.0007 23.234C27.4682 23.234 24.1796 25.1733 24.1796 25.1733L22.1887 25.7348V33.7372C22.1887 40.514 31.9982 44.4752 31.9982 44.4752C31.9982 44.4752 41.8127 40.526 41.8127 33.7372V25.7348L39.823 25.1733ZM31.2737 42.0731L30.4465 41.733C29.0135 41.1643 27.6878 40.3263 26.5322 39.2589C25.692 38.472 24.9881 37.5339 24.4524 36.4874C23.5615 34.7242 23.5177 33.2864 23.5164 33.2331V27.5353L25.1857 26.8191C27.1554 25.9202 28.8848 25.9202 30.419 25.9202H30.6692V27.2179H30.419C28.9348 27.2179 27.4007 27.2179 25.655 28.0088L24.7328 28.4089V33.2104C24.7478 33.6372 24.9392 34.7456 25.5562 35.9393C26.0273 36.8418 26.6426 37.6497 27.3744 38.3267C28.1815 39.0691 29.0852 39.6832 30.0573 40.1499V33.6986H31.2737V42.0731ZM40.4862 33.2224V33.2398C40.4862 33.2998 40.4412 34.7295 39.5565 36.4928C39.0259 37.538 38.327 38.4757 37.4917 39.2629C36.3447 40.3278 35.0273 41.164 33.6025 41.7317L32.774 42.0731V25.9935H33.9904V40.1419C34.9522 39.6747 35.8457 39.0619 36.6433 38.3227C37.3714 37.6453 37.9836 36.8384 38.4528 35.9379C39.0659 34.7375 39.2549 33.6319 39.2699 33.2091V27.9675H40.4862V33.2224Z" fill="#F4F6F9"/>
|
||||
<path d="M31.8017 46.9213C29.7405 46.0377 27.7801 44.908 25.9578 43.5536C24.2547 42.2732 22.8781 40.9048 21.8983 39.487C20.6394 37.6718 20 35.7765 20 33.8453V23.8422L22.6892 23.2954C23.5247 22.8446 24.3925 22.4655 25.2845 22.1617C27.4527 21.4034 29.7188 21.0115 32.0006 21C34.2829 21.0114 36.5494 21.4033 38.718 22.1617C39.6085 22.4641 40.4751 22.8414 41.3096 23.29L44 23.8369V33.84C44 35.7752 43.3618 37.6758 42.1029 39.4884C41.1181 40.9061 39.7504 42.2745 38.0397 43.5549C36.2161 44.907 34.2548 46.035 32.1933 46.9173L31.9969 46.9947L31.8017 46.9213ZM40.9366 24.4157L40.8578 24.369C40.8203 24.3477 37.0849 22.179 32.0006 22.179C26.9163 22.179 23.181 24.3477 23.1434 24.369L23.0646 24.4157L21.1087 24.7972V33.8453C21.1087 35.5151 21.6706 37.1796 22.7805 38.7801C23.6915 40.0952 24.9692 41.3729 26.5759 42.58C28.2734 43.8346 30.091 44.8938 31.9981 45.7396C33.8999 44.9 35.7125 43.847 37.4053 42.5986C39.0183 41.3983 40.2997 40.1125 41.2132 38.7961C42.3282 37.1956 42.8938 35.5258 42.8938 33.8493V24.7972L40.9366 24.4157Z" fill="#F4F6F9"/>
|
||||
<path d="M23.6102 41.525C21.1888 39.0989 20 36.5661 20 33.8653V23.8342L22.6904 23.3101C23.5249 22.8614 24.3915 22.4841 25.282 22.1817C27.4507 21.424 29.7172 21.032 31.9994 21.02C34.2816 21.0323 36.548 21.4242 38.7167 22.1817C39.6073 22.4841 40.4738 22.8614 41.3083 23.3101L44 23.8369L42.9 24.7972L40.9354 24.4357L40.8553 24.3891C40.819 24.3677 37.0674 22.2004 31.9994 22.2004C26.9313 22.2004 23.1785 24.3677 23.1409 24.3891L23.0621 24.4357L22.9733 24.4531L21.1062 24.8172V33.8653C21.1062 36.2274 22.285 38.5801 24.4749 40.7741L23.6102 41.525Z" fill="#CED7E4"/>
|
||||
<path d="M41.8127 25.7334L39.8218 25.1746C39.8218 25.1746 36.5319 23.234 32.0007 23.234C27.4695 23.234 24.1784 25.1746 24.1784 25.1746L22.1887 25.7348V33.7372C22.1887 36.2714 23.5565 38.4053 25.2708 40.0925L26.3896 39.1216C25.612 38.3671 24.957 37.4807 24.4512 36.4981C23.5602 34.7349 23.5164 33.2971 23.5152 33.2424V27.5353L25.1832 26.8191C27.1554 25.9348 28.8848 25.9348 30.419 25.9348H30.663V27.2326H30.4127C28.9273 27.2326 27.3932 27.2326 25.6475 28.0235L24.7252 28.4236V33.2251C24.7403 33.6519 24.9317 34.7589 25.5486 35.9539C26.0135 36.8411 26.6175 37.6368 27.3343 38.3066L30.0561 35.9379V33.7092H31.2724V34.8829L32.774 33.5812V26.0029H33.9916V32.5249L41.8127 25.7334Z" fill="#CED7E4"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_dd_4313_5552" x="5" y="5" width="57" height="57" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="2" dy="2"/>
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_4313_5552"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dx="-1" dy="-1"/>
|
||||
<feGaussianBlur stdDeviation="1"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.25 0"/>
|
||||
<feBlend mode="normal" in2="effect1_dropShadow_4313_5552" result="effect2_dropShadow_4313_5552"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_4313_5552" result="shape"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_4313_5552" x1="56" y1="56" x2="8" y2="8" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#003775" stop-opacity="0.5"/>
|
||||
<stop offset="1" stop-color="#004898" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_4313_5552">
|
||||
<rect width="24" height="26" fill="white" transform="translate(20 21)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
BIN
src/menu-user.png
Executable file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
src/new/menu-1.png
Executable file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/new/menu-2.png
Executable file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/new/menu-3.png
Executable file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/new/menu-4.png
Executable file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
src/new/menu-5.png
Executable file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
src/new/menu-6.png
Executable file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
src/new/menu-7.png
Executable file
|
After Width: | Height: | Size: 6.4 KiB |
464
switchbutton.cpp
Executable file
@@ -0,0 +1,464 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "switchbutton.h"
|
||||
#include "qpainter.h"
|
||||
#include <QPainterPath>
|
||||
#include "qevent.h"
|
||||
#include "qtimer.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
SwitchButton::SwitchButton(QWidget *parent): QWidget(parent)
|
||||
{
|
||||
space = 2;
|
||||
rectRadius = 5;
|
||||
checked = false;
|
||||
showText = true;
|
||||
showCircle = false;
|
||||
animation = false;
|
||||
|
||||
buttonStyle = ButtonStyle_CircleIn;
|
||||
|
||||
bgColorOff = QColor(111, 122, 126);
|
||||
bgColorOn = QColor(21, 156, 119);
|
||||
|
||||
sliderColorOff = QColor(255, 255, 255);
|
||||
sliderColorOn = QColor(255, 255, 255);
|
||||
|
||||
textColorOff = QColor(250, 250, 250);
|
||||
textColorOn = QColor(255, 255, 255);
|
||||
|
||||
textOff = "关闭";
|
||||
textOn = "开启";
|
||||
|
||||
step = 0;
|
||||
startX = 0;
|
||||
endX = 0;
|
||||
|
||||
timer = new QTimer(this);
|
||||
timer->setInterval(30);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateValue()));
|
||||
}
|
||||
|
||||
SwitchButton::~SwitchButton()
|
||||
{
|
||||
if (timer->isActive()) {
|
||||
timer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
checked = !checked;
|
||||
emit checkedChanged(checked);
|
||||
|
||||
//每次移动的步长
|
||||
step = width() / 7;
|
||||
|
||||
//状态切换改变后自动计算终点坐标
|
||||
if (checked) {
|
||||
if (buttonStyle == ButtonStyle_Rect) {
|
||||
endX = width() - width() / 2;
|
||||
} else if (buttonStyle == ButtonStyle_CircleIn) {
|
||||
endX = width() - height();
|
||||
} else if (buttonStyle == ButtonStyle_CircleOut) {
|
||||
endX = width() - height();
|
||||
}
|
||||
} else {
|
||||
endX = 0;
|
||||
}
|
||||
|
||||
if (animation) {
|
||||
timer->start();
|
||||
} else {
|
||||
startX = endX;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
//每次移动的步长为宽度的 50分之一
|
||||
step = width() / 50;
|
||||
|
||||
//尺寸大小改变后自动设置起点坐标为终点
|
||||
if (checked) {
|
||||
if (buttonStyle == ButtonStyle_Rect) {
|
||||
startX = width() - width() / 2;
|
||||
} else if (buttonStyle == ButtonStyle_CircleIn) {
|
||||
startX = width() - height();
|
||||
} else if (buttonStyle == ButtonStyle_CircleOut) {
|
||||
startX = width() - height();
|
||||
}
|
||||
} else {
|
||||
startX = 0;
|
||||
}
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
void SwitchButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
//绘制准备工作,启用反锯齿
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
|
||||
//绘制背景
|
||||
drawBg(&painter);
|
||||
//绘制滑块
|
||||
drawSlider(&painter);
|
||||
}
|
||||
|
||||
void SwitchButton::drawBg(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
|
||||
QColor bgColor = checked ? bgColorOn : bgColorOff;
|
||||
if (!isEnabled()) {
|
||||
bgColor.setAlpha(60);
|
||||
}
|
||||
|
||||
painter->setBrush(bgColor);
|
||||
|
||||
if (buttonStyle == ButtonStyle_Rect) {
|
||||
painter->drawRoundedRect(rect(), rectRadius, rectRadius);
|
||||
} else if (buttonStyle == ButtonStyle_CircleIn) {
|
||||
QRect rect(0, 0, width(), height());
|
||||
//半径为高度的一半
|
||||
int side = qMin(rect.width(), rect.height());
|
||||
|
||||
//左侧圆
|
||||
QPainterPath path1;
|
||||
path1.addEllipse(rect.x(), rect.y(), side, side);
|
||||
//右侧圆
|
||||
QPainterPath path2;
|
||||
path2.addEllipse(rect.width() - side, rect.y(), side, side);
|
||||
//中间矩形
|
||||
QPainterPath path3;
|
||||
path3.addRect(rect.x() + side / 2, rect.y(), rect.width() - side, rect.height());
|
||||
|
||||
QPainterPath path;
|
||||
path = path3 + path1 + path2;
|
||||
painter->drawPath(path);
|
||||
} else if (buttonStyle == ButtonStyle_CircleOut) {
|
||||
QRect rect(height() / 2, space, width() - height(), height() - space * 2);
|
||||
painter->drawRoundedRect(rect, rectRadius, rectRadius);
|
||||
}
|
||||
|
||||
if (buttonStyle == ButtonStyle_Rect || buttonStyle == ButtonStyle_CircleIn) {
|
||||
//绘制文本和小圆,互斥
|
||||
if (showText) {
|
||||
int sliderWidth = qMin(width(), height()) - space * 2;
|
||||
if (buttonStyle == ButtonStyle_Rect) {
|
||||
sliderWidth = width() / 2 - 5;
|
||||
} else if (buttonStyle == ButtonStyle_CircleIn) {
|
||||
sliderWidth -= 5;
|
||||
}
|
||||
|
||||
if (checked) {
|
||||
QRect textRect(0, 0, width() - sliderWidth, height());
|
||||
painter->setPen(textColorOn);
|
||||
painter->drawText(textRect, Qt::AlignCenter, textOn);
|
||||
} else {
|
||||
QRect textRect(sliderWidth, 0, width() - sliderWidth, height());
|
||||
painter->setPen(textColorOff);
|
||||
painter->drawText(textRect, Qt::AlignCenter, textOff);
|
||||
}
|
||||
} else if (showCircle) {
|
||||
int side = qMin(width(), height()) / 2;
|
||||
int y = (height() - side) / 2;
|
||||
|
||||
if (checked) {
|
||||
QRect circleRect(side / 2, y, side, side);
|
||||
QPen pen(textColorOn, 2);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawEllipse(circleRect);
|
||||
} else {
|
||||
QRect circleRect(width() - (side * 1.5), y, side, side);
|
||||
QPen pen(textColorOff, 2);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawEllipse(circleRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void SwitchButton::drawSlider(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
|
||||
if (!checked) {
|
||||
painter->setBrush(sliderColorOff);
|
||||
} else {
|
||||
painter->setBrush(sliderColorOn);
|
||||
}
|
||||
|
||||
if (buttonStyle == ButtonStyle_Rect) {
|
||||
int sliderWidth = width() / 2 - space * 2;
|
||||
int sliderHeight = height() - space * 2;
|
||||
QRect sliderRect(startX + space, space, sliderWidth , sliderHeight);
|
||||
painter->drawRoundedRect(sliderRect, rectRadius, rectRadius);
|
||||
} else if (buttonStyle == ButtonStyle_CircleIn) {
|
||||
QRect rect(0, 0, width(), height());
|
||||
int sliderWidth = qMin(rect.width(), rect.height()) - space * 2;
|
||||
QRect sliderRect(startX + space, space, sliderWidth, sliderWidth);
|
||||
painter->drawEllipse(sliderRect);
|
||||
} else if (buttonStyle == ButtonStyle_CircleOut) {
|
||||
int sliderWidth = this->height();
|
||||
QRect sliderRect(startX, 0, sliderWidth, sliderWidth);
|
||||
|
||||
QColor color1 = (checked ? Qt::white : bgColorOff);
|
||||
QColor color2 = (checked ? sliderColorOn : sliderColorOff);
|
||||
|
||||
QRadialGradient radialGradient(sliderRect.center(), sliderWidth / 2);
|
||||
radialGradient.setColorAt(0, checked ? color1 : color2);
|
||||
radialGradient.setColorAt(0.5, checked ? color1 : color2);
|
||||
radialGradient.setColorAt(0.6, checked ? color2 : color1);
|
||||
radialGradient.setColorAt(1.0, checked ? color2 : color1);
|
||||
painter->setBrush(radialGradient);
|
||||
|
||||
painter->drawEllipse(sliderRect);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void SwitchButton::change()
|
||||
{
|
||||
mousePressEvent(NULL);
|
||||
}
|
||||
|
||||
void SwitchButton::updateValue()
|
||||
{
|
||||
if (checked) {
|
||||
if (startX < endX) {
|
||||
startX = startX + step;
|
||||
} else {
|
||||
startX = endX;
|
||||
timer->stop();
|
||||
}
|
||||
} else {
|
||||
if (startX > endX) {
|
||||
startX = startX - step;
|
||||
} else {
|
||||
startX = endX;
|
||||
timer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
int SwitchButton::getSpace() const
|
||||
{
|
||||
return this->space;
|
||||
}
|
||||
|
||||
int SwitchButton::getRectRadius() const
|
||||
{
|
||||
return this->rectRadius;
|
||||
}
|
||||
|
||||
bool SwitchButton::getChecked() const
|
||||
{
|
||||
return this->checked;
|
||||
}
|
||||
|
||||
bool SwitchButton::getShowText() const
|
||||
{
|
||||
return this->showText;
|
||||
}
|
||||
|
||||
bool SwitchButton::getShowCircle() const
|
||||
{
|
||||
return this->showCircle;
|
||||
}
|
||||
|
||||
bool SwitchButton::getAnimation() const
|
||||
{
|
||||
return this->animation;
|
||||
}
|
||||
|
||||
SwitchButton::ButtonStyle SwitchButton::getButtonStyle() const
|
||||
{
|
||||
return this->buttonStyle;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getBgColorOff() const
|
||||
{
|
||||
return bgColorOff;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getBgColorOn() const
|
||||
{
|
||||
return this->bgColorOn;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getSliderColorOff() const
|
||||
{
|
||||
return this->sliderColorOff;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getSliderColorOn() const
|
||||
{
|
||||
return this->sliderColorOn;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getTextColorOff() const
|
||||
{
|
||||
return this->textColorOff;
|
||||
}
|
||||
|
||||
QColor SwitchButton::getTextColorOn() const
|
||||
{
|
||||
return this->textColorOn;
|
||||
}
|
||||
|
||||
QString SwitchButton::getTextOff() const
|
||||
{
|
||||
return this->textOff;
|
||||
}
|
||||
|
||||
QString SwitchButton::getTextOn() const
|
||||
{
|
||||
return this->textOn;
|
||||
}
|
||||
|
||||
QSize SwitchButton::sizeHint() const
|
||||
{
|
||||
return QSize(70, 30);
|
||||
}
|
||||
|
||||
QSize SwitchButton::minimumSizeHint() const
|
||||
{
|
||||
return QSize(10, 5);
|
||||
}
|
||||
|
||||
void SwitchButton::setSpace(int space)
|
||||
{
|
||||
if (this->space != space) {
|
||||
this->space = space;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setRectRadius(int rectRadius)
|
||||
{
|
||||
if (this->rectRadius != rectRadius) {
|
||||
this->rectRadius = rectRadius;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setChecked(bool checked)
|
||||
{
|
||||
//如果刚刚初始化完成的属性改变则延时处理
|
||||
if (this->checked != checked) {
|
||||
if (step == 0) {
|
||||
QTimer::singleShot(10, this, SLOT(change()));
|
||||
} else {
|
||||
mousePressEvent(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setShowText(bool showText)
|
||||
{
|
||||
if (this->showText != showText) {
|
||||
this->showText = showText;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setShowCircle(bool showCircle)
|
||||
{
|
||||
if (this->showCircle != showCircle) {
|
||||
this->showCircle = showCircle;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setAnimation(bool animation)
|
||||
{
|
||||
if (this->animation != animation) {
|
||||
this->animation = animation;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setButtonStyle(const SwitchButton::ButtonStyle &buttonStyle)
|
||||
{
|
||||
if (this->buttonStyle != buttonStyle) {
|
||||
this->buttonStyle = buttonStyle;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setBgColorOff(const QColor &bgColorOff)
|
||||
{
|
||||
if (this->bgColorOff != bgColorOff) {
|
||||
this->bgColorOff = bgColorOff;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setBgColorOn(const QColor &bgColorOn)
|
||||
{
|
||||
if (this->bgColorOn != bgColorOn) {
|
||||
this->bgColorOn = bgColorOn;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setSliderColorOff(const QColor &sliderColorOff)
|
||||
{
|
||||
if (this->sliderColorOff != sliderColorOff) {
|
||||
this->sliderColorOff = sliderColorOff;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setSliderColorOn(const QColor &sliderColorOn)
|
||||
{
|
||||
if (this->sliderColorOn != sliderColorOn) {
|
||||
this->sliderColorOn = sliderColorOn;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setTextColorOff(const QColor &textColorOff)
|
||||
{
|
||||
if (this->textColorOff != textColorOff) {
|
||||
this->textColorOff = textColorOff;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setTextColorOn(const QColor &textColorOn)
|
||||
{
|
||||
if (this->textColorOn != textColorOn) {
|
||||
this->textColorOn = textColorOn;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setTextOff(const QString &textOff)
|
||||
{
|
||||
if (this->textOff != textOff) {
|
||||
this->textOff = textOff;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchButton::setTextOn(const QString &textOn)
|
||||
{
|
||||
if (this->textOn != textOn) {
|
||||
this->textOn = textOn;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
136
switchbutton.h
Executable file
@@ -0,0 +1,136 @@
|
||||
#ifndef SWITCHBUTTON_H
|
||||
#define SWITCHBUTTON_H
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPainterPath>
|
||||
class SwitchButton : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(ButtonStyle)
|
||||
|
||||
Q_PROPERTY(int space READ getSpace WRITE setSpace)
|
||||
Q_PROPERTY(int rectRadius READ getRectRadius WRITE setRectRadius)
|
||||
Q_PROPERTY(bool checked READ getChecked WRITE setChecked)
|
||||
Q_PROPERTY(bool showText READ getShowText WRITE setShowText)
|
||||
Q_PROPERTY(bool showCircle READ getShowCircle WRITE setShowCircle)
|
||||
Q_PROPERTY(bool animation READ getAnimation WRITE setAnimation)
|
||||
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
|
||||
|
||||
Q_PROPERTY(QColor bgColorOff READ getBgColorOff WRITE setBgColorOff)
|
||||
Q_PROPERTY(QColor bgColorOn READ getBgColorOn WRITE setBgColorOn)
|
||||
Q_PROPERTY(QColor sliderColorOff READ getSliderColorOff WRITE setSliderColorOff)
|
||||
Q_PROPERTY(QColor sliderColorOn READ getSliderColorOn WRITE setSliderColorOn)
|
||||
Q_PROPERTY(QColor textColorOff READ getTextColorOff WRITE setTextColorOff)
|
||||
Q_PROPERTY(QColor textColorOn READ getTextColorOn WRITE setTextColorOn)
|
||||
|
||||
Q_PROPERTY(QString textOff READ getTextOff WRITE setTextOff)
|
||||
Q_PROPERTY(QString textOn READ getTextOn WRITE setTextOn)
|
||||
|
||||
public:
|
||||
enum ButtonStyle {
|
||||
ButtonStyle_Rect = 0, //圆角矩形
|
||||
ButtonStyle_CircleIn = 1, //内圆形
|
||||
ButtonStyle_CircleOut = 2 //外圆形
|
||||
};
|
||||
|
||||
SwitchButton(QWidget *parent = 0);
|
||||
~SwitchButton();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawBg(QPainter *painter);
|
||||
void drawSlider(QPainter *painter);
|
||||
|
||||
private:
|
||||
int space; //滑块离背景间隔
|
||||
int rectRadius; //圆角角度
|
||||
bool checked; //是否选中
|
||||
bool showText; //显示文字
|
||||
bool showCircle; //显示小圆
|
||||
bool animation; //动画过渡
|
||||
|
||||
ButtonStyle buttonStyle; //开关按钮样式
|
||||
|
||||
QColor bgColorOff; //关闭时背景颜色
|
||||
QColor bgColorOn; //打开时背景颜色
|
||||
QColor sliderColorOff; //关闭时滑块颜色
|
||||
QColor sliderColorOn; //打开时滑块颜色
|
||||
QColor textColorOff; //关闭时文字颜色
|
||||
QColor textColorOn; //打开时文字颜色
|
||||
|
||||
QString textOff; //关闭时显示的文字
|
||||
QString textOn; //打开时显示的文字
|
||||
|
||||
int step; //每次移动的步长
|
||||
int startX; //滑块开始X轴坐标
|
||||
int endX; //滑块结束X轴坐标
|
||||
QTimer *timer; //定时器绘制
|
||||
|
||||
private slots:
|
||||
void change();
|
||||
void updateValue();
|
||||
|
||||
public:
|
||||
int getSpace() const;
|
||||
int getRectRadius() const;
|
||||
bool getChecked() const;
|
||||
bool getShowText() const;
|
||||
bool getShowCircle() const;
|
||||
bool getAnimation() const;
|
||||
|
||||
ButtonStyle getButtonStyle() const;
|
||||
|
||||
QColor getBgColorOff() const;
|
||||
QColor getBgColorOn() const;
|
||||
QColor getSliderColorOff() const;
|
||||
QColor getSliderColorOn() const;
|
||||
QColor getTextColorOff() const;
|
||||
QColor getTextColorOn() const;
|
||||
|
||||
QString getTextOff() const;
|
||||
QString getTextOn() const;
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
//设置间隔
|
||||
void setSpace(int space);
|
||||
//设置圆角角度
|
||||
void setRectRadius(int rectRadius);
|
||||
//设置是否选中
|
||||
void setChecked(bool checked);
|
||||
//设置是否显示文字
|
||||
void setShowText(bool showText);
|
||||
//设置是否显示小圆
|
||||
void setShowCircle(bool showCircle);
|
||||
//设置是否动画过渡
|
||||
void setAnimation(bool animation);
|
||||
|
||||
//设置风格样式
|
||||
void setButtonStyle(const ButtonStyle &buttonStyle);
|
||||
|
||||
//设置背景颜色
|
||||
void setBgColorOff(const QColor &bgColorOff);
|
||||
void setBgColorOn(const QColor &bgColorOn);
|
||||
|
||||
//设置滑块颜色
|
||||
void setSliderColorOff(const QColor &sliderColorOff);
|
||||
void setSliderColorOn(const QColor &sliderColorOn);
|
||||
|
||||
//设置文字颜色
|
||||
void setTextColorOff(const QColor &textColorOff);
|
||||
void setTextColorOn(const QColor &textColorOn);
|
||||
|
||||
//设置文字
|
||||
void setTextOff(const QString &textOff);
|
||||
void setTextOn(const QString &textOn);
|
||||
|
||||
Q_SIGNALS:
|
||||
void checkedChanged(bool checked);
|
||||
};
|
||||
|
||||
#endif // SWITCHBUTTON_H
|
||||
225
tablepagewidget.cpp
Executable file
@@ -0,0 +1,225 @@
|
||||
#include "tablepagewidget.h"
|
||||
#include "ui_tablepagewidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
#if _MSC_VER >= 1600
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
|
||||
|
||||
TablePageWidget::TablePageWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TablePageWidget),
|
||||
pageLine(10),
|
||||
pageTotal(0),
|
||||
currentPage(0),
|
||||
currentLine(0),
|
||||
currentFivePage(0),
|
||||
TotalFivePage(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
ui->tableWidget->verticalHeader()->setHidden(true);
|
||||
initForm();
|
||||
|
||||
}
|
||||
|
||||
TablePageWidget::~TablePageWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TablePageWidget::setTableHeaders(QStringList headerList)
|
||||
{
|
||||
for(int i = 0; i < headerList.size(); i++)
|
||||
ui->tableWidget->insertColumn(i);
|
||||
for(int i = 0; i < headerList.size(); i++)
|
||||
ui->tableWidget->setHorizontalHeaderItem(i, new QTableWidgetItem(headerList.at(i)));
|
||||
}
|
||||
|
||||
void TablePageWidget::setTableData(QStringList dataList)
|
||||
{
|
||||
this->dataList = dataList;
|
||||
int col = ui->tableWidget->columnCount();
|
||||
int row = dataList.size() / col;
|
||||
pageTotal = row % pageLine;
|
||||
pageTotal = pageTotal + 1;
|
||||
currentPage = 1;
|
||||
currentLine = 0;
|
||||
TotalFivePage = (pageTotal / 5 > 0) ? 0 : (pageTotal / 5 + 2);
|
||||
currentFivePage = 1;
|
||||
for(int i = currentLine; i < currentPage * pageLine; i++)
|
||||
{
|
||||
for(int j = 0; j < col; j++)
|
||||
ui->tableWidget->setItem(i, j, new QTableWidgetItem(this->dataList.at(currentLine * col + j)));
|
||||
}
|
||||
if(pageTotal > 5)
|
||||
{
|
||||
foreach (QAbstractButton* btn, this->findChildren<QAbstractButton *>()) {
|
||||
if(!(btn->text() == "<"))
|
||||
btn->setEnabled(true);
|
||||
}
|
||||
}
|
||||
else if(pageTotal <= 5)
|
||||
{
|
||||
foreach (QAbstractButton* btn, this->findChildren<QAbstractButton *>()){
|
||||
if(btn->text().toInt() <= pageTotal)
|
||||
btn->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TablePageWidget::appendTableData(QStringList newDataList)
|
||||
{
|
||||
this->dataList<< newDataList;
|
||||
}
|
||||
|
||||
void TablePageWidget::changeTablePageLine(int idx)
|
||||
{
|
||||
switch (idx) {
|
||||
case 0:
|
||||
this->pageLine = 10;
|
||||
break;
|
||||
case 1:
|
||||
this->pageLine = 50;
|
||||
break;
|
||||
case 2:
|
||||
this->pageLine = 80;
|
||||
break;
|
||||
case 3:
|
||||
this->pageLine = 100;
|
||||
break;
|
||||
}
|
||||
if(dataList.isEmpty())
|
||||
return;
|
||||
pageTotal = dataList.size() / currentLine;
|
||||
TotalFivePage = (pageTotal / 5 > 0) ? (pageTotal / 5 + 1) : 0;
|
||||
if(pageTotal < currentPage)
|
||||
{
|
||||
currentPage == pageTotal;
|
||||
if(currentPage % 5 == 0 && currentPage >= 5)
|
||||
currentFivePage = currentPage / 5;
|
||||
else if(currentPage % 5 != 0)
|
||||
currentFivePage = currentPage / 5 + 1;
|
||||
else if(currentPage < 5)
|
||||
currentFivePage = 1;
|
||||
|
||||
setCurrentFivePage(this->currentFivePage);
|
||||
|
||||
}
|
||||
setCurrentData();
|
||||
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbuttonBehind_clicked()
|
||||
{
|
||||
this->currentFivePage++;
|
||||
setCurrentFivePage(currentFivePage);
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbuttonFront_clicked()
|
||||
{
|
||||
if(currentFivePage > 1)
|
||||
currentFivePage--;
|
||||
setCurrentFivePage(currentFivePage);
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbutton1_clicked()
|
||||
{
|
||||
currentPage = ui->btn1->text().toInt();
|
||||
setCurrentData();
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbutton2_clicked()
|
||||
{
|
||||
currentPage = ui->btn2->text().toInt();
|
||||
setCurrentData();
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbutton3_clicked()
|
||||
{
|
||||
currentPage = ui->btn3->text().toInt();
|
||||
setCurrentData();
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbutton4_clicked()
|
||||
{
|
||||
currentPage = ui->btn4->text().toInt();
|
||||
setCurrentData();
|
||||
}
|
||||
|
||||
void TablePageWidget::on_toolbutton5_clicked()
|
||||
{
|
||||
currentPage = ui->btn5->text().toInt();
|
||||
setCurrentData();
|
||||
}
|
||||
|
||||
void TablePageWidget::initForm()
|
||||
{
|
||||
QStringList pageNum;
|
||||
pageNum.append("10条/页");
|
||||
pageNum.append("50条/页");
|
||||
pageNum.append("80条/页");
|
||||
pageNum.append("100条/页");
|
||||
ui->comboBox->addItems(pageNum);
|
||||
foreach (QAbstractButton* btn, this->findChildren<QAbstractButton *>()) {
|
||||
btn->setEnabled(false);
|
||||
}
|
||||
this->dataList.clear();
|
||||
connect(ui->comboBox, SIGNAL(activated(int)), this, SLOT(changeTablePageLine(int)));
|
||||
connect(ui->btnFront, &QToolButton::clicked, this, &TablePageWidget::on_toolbuttonFront_clicked);
|
||||
connect(ui->btnBehind, &QToolButton::clicked, this, &TablePageWidget::on_toolbuttonBehind_clicked);
|
||||
}
|
||||
|
||||
void TablePageWidget::setCurrentFivePage(int idx)
|
||||
{
|
||||
ui->btn1->setText(QString::number(5 * (idx - 1) + 1));
|
||||
ui->btn2->setText(QString::number(5 * (idx - 1) + 2));
|
||||
ui->btn2->setText(QString::number(5 * (idx - 1) + 3));
|
||||
ui->btn4->setText(QString::number(5 * (idx - 1) + 4));
|
||||
ui->btn5->setText(QString::number(5 * (idx - 1) + 5));
|
||||
|
||||
if(TotalFivePage > ui->btn5->text().toInt() && currentFivePage != 1)
|
||||
{
|
||||
foreach (QAbstractButton* btn, this->findChildren<QAbstractButton *>()) {
|
||||
btn->setEnabled(true);
|
||||
if(btn->text().toInt() == currentPage)
|
||||
btn->setChecked(true);
|
||||
else
|
||||
btn->setChecked(false);
|
||||
}
|
||||
}
|
||||
else if(TotalFivePage > ui->btn5->text().toInt() && currentFivePage == 1)
|
||||
{
|
||||
foreach (QAbstractButton* btn, this->findChildren<QAbstractButton *>()) {
|
||||
if(btn != ui->btnFront)
|
||||
btn->setEnabled(true);
|
||||
else
|
||||
btn->setEnabled(false);
|
||||
|
||||
if(btn->text().toInt() == currentPage)
|
||||
btn->setChecked(true);
|
||||
else
|
||||
btn->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TablePageWidget::setCurrentData()
|
||||
{
|
||||
if(!this->dataList.isEmpty())
|
||||
{
|
||||
currentLine = pageLine * (currentPage - 1);
|
||||
for(int i = currentLine; i < currentPage * pageLine; i++)
|
||||
{
|
||||
for(int j = 0; j < ui->tableWidget->colorCount(); j++)
|
||||
ui->tableWidget->setItem(currentLine - (pageLine * currentPage),
|
||||
j, new QTableWidgetItem(this->dataList.at(currentLine * ui->tableWidget->columnCount() + j)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
67
tablepagewidget.h
Executable file
@@ -0,0 +1,67 @@
|
||||
#ifndef TABLEPAGEWIDGET_H
|
||||
#define TABLEPAGEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#if _MSC_VER >= 1600
|
||||
#pragma execution_character_set("utf-8")
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class TablePageWidget;
|
||||
}
|
||||
|
||||
class TablePageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TablePageWidget(QWidget *parent = nullptr);
|
||||
~TablePageWidget();
|
||||
|
||||
public:
|
||||
void setTableHeaders(QStringList headerList);
|
||||
void setTableData(QStringList dataList);
|
||||
void appendTableData(QStringList newDataList);
|
||||
|
||||
private slots:
|
||||
void changeTablePageLine(int idx);
|
||||
|
||||
void on_toolbuttonBehind_clicked();
|
||||
|
||||
void on_toolbuttonFront_clicked();
|
||||
|
||||
void on_toolbutton1_clicked();
|
||||
|
||||
void on_toolbutton2_clicked();
|
||||
|
||||
void on_toolbutton3_clicked();
|
||||
|
||||
void on_toolbutton4_clicked();
|
||||
|
||||
void on_toolbutton5_clicked();
|
||||
|
||||
private:
|
||||
Ui::TablePageWidget *ui;
|
||||
void initForm();
|
||||
//每一页的行数
|
||||
int pageLine;
|
||||
//一共多少页
|
||||
int pageTotal;
|
||||
//当前页数
|
||||
int currentPage;
|
||||
//当前页第一行的行号
|
||||
int currentLine;
|
||||
|
||||
int currentFivePage;
|
||||
|
||||
int TotalFivePage;
|
||||
|
||||
void setCurrentFivePage(int idx);
|
||||
|
||||
void setCurrentData();
|
||||
|
||||
private:
|
||||
QStringList dataList;
|
||||
};
|
||||
|
||||
#endif // TABLEPAGEWIDGET_H
|
||||
210
tablepagewidget.ui
Executable file
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TablePageWidget</class>
|
||||
<widget class="QWidget" name="TablePageWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border:1px solid rgb(220,220,220);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labTotal">
|
||||
<property name="text">
|
||||
<string>共0条</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnFront">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn1">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn2">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn3">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn4">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btn5">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnBehind">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton{
|
||||
border-style:none;
|
||||
color:black;
|
||||
background-color:white;
|
||||
}
|
||||
QToolButton:checked{
|
||||
color:rgb(9,96,189);
|
||||
border:1px bolid rgb(9,96,189);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labJunp">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel{
|
||||
color:black;
|
||||
font:14px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>跳至</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sboxPage"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labPage">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel{
|
||||
color:black;
|
||||
font:14px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>页</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
3437
ui_dialog.h
Executable file
229
ui_tablepagewidget.h
Executable file
@@ -0,0 +1,229 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'tablepagewidget.ui'
|
||||
**
|
||||
** Created by: Qt User Interface Compiler version 5.14.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_TABLEPAGEWIDGET_H
|
||||
#define UI_TABLEPAGEWIDGET_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QComboBox>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QHeaderView>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QSpacerItem>
|
||||
#include <QtWidgets/QSpinBox>
|
||||
#include <QtWidgets/QTableWidget>
|
||||
#include <QtWidgets/QToolButton>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_TablePageWidget
|
||||
{
|
||||
public:
|
||||
QVBoxLayout *verticalLayout;
|
||||
QTableWidget *tableWidget;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QSpacerItem *horizontalSpacer;
|
||||
QLabel *labTotal;
|
||||
QToolButton *btnFront;
|
||||
QToolButton *btn1;
|
||||
QToolButton *btn2;
|
||||
QToolButton *btn3;
|
||||
QToolButton *btn4;
|
||||
QToolButton *btn5;
|
||||
QToolButton *btnBehind;
|
||||
QComboBox *comboBox;
|
||||
QLabel *labJunp;
|
||||
QSpinBox *sboxPage;
|
||||
QLabel *labPage;
|
||||
|
||||
void setupUi(QWidget *TablePageWidget)
|
||||
{
|
||||
if (TablePageWidget->objectName().isEmpty())
|
||||
TablePageWidget->setObjectName(QString::fromUtf8("TablePageWidget"));
|
||||
TablePageWidget->resize(526, 400);
|
||||
verticalLayout = new QVBoxLayout(TablePageWidget);
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
tableWidget = new QTableWidget(TablePageWidget);
|
||||
tableWidget->setObjectName(QString::fromUtf8("tableWidget"));
|
||||
tableWidget->setStyleSheet(QString::fromUtf8("border:1px solid rgb(220,220,220);"));
|
||||
|
||||
verticalLayout->addWidget(tableWidget);
|
||||
|
||||
horizontalLayout = new QHBoxLayout();
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
horizontalLayout->addItem(horizontalSpacer);
|
||||
|
||||
labTotal = new QLabel(TablePageWidget);
|
||||
labTotal->setObjectName(QString::fromUtf8("labTotal"));
|
||||
|
||||
horizontalLayout->addWidget(labTotal);
|
||||
|
||||
btnFront = new QToolButton(TablePageWidget);
|
||||
btnFront->setObjectName(QString::fromUtf8("btnFront"));
|
||||
btnFront->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btnFront);
|
||||
|
||||
btn1 = new QToolButton(TablePageWidget);
|
||||
btn1->setObjectName(QString::fromUtf8("btn1"));
|
||||
btn1->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btn1);
|
||||
|
||||
btn2 = new QToolButton(TablePageWidget);
|
||||
btn2->setObjectName(QString::fromUtf8("btn2"));
|
||||
btn2->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btn2);
|
||||
|
||||
btn3 = new QToolButton(TablePageWidget);
|
||||
btn3->setObjectName(QString::fromUtf8("btn3"));
|
||||
btn3->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btn3);
|
||||
|
||||
btn4 = new QToolButton(TablePageWidget);
|
||||
btn4->setObjectName(QString::fromUtf8("btn4"));
|
||||
btn4->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btn4);
|
||||
|
||||
btn5 = new QToolButton(TablePageWidget);
|
||||
btn5->setObjectName(QString::fromUtf8("btn5"));
|
||||
btn5->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btn5);
|
||||
|
||||
btnBehind = new QToolButton(TablePageWidget);
|
||||
btnBehind->setObjectName(QString::fromUtf8("btnBehind"));
|
||||
btnBehind->setStyleSheet(QString::fromUtf8("QToolButton{\n"
|
||||
"border-style:none;\n"
|
||||
"color:black;\n"
|
||||
"background-color:white;\n"
|
||||
"}\n"
|
||||
"QToolButton:checked{\n"
|
||||
"color:rgb(9,96,189);\n"
|
||||
"border:1px bolid rgb(9,96,189);\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(btnBehind);
|
||||
|
||||
comboBox = new QComboBox(TablePageWidget);
|
||||
comboBox->setObjectName(QString::fromUtf8("comboBox"));
|
||||
|
||||
horizontalLayout->addWidget(comboBox);
|
||||
|
||||
labJunp = new QLabel(TablePageWidget);
|
||||
labJunp->setObjectName(QString::fromUtf8("labJunp"));
|
||||
labJunp->setStyleSheet(QString::fromUtf8("QLabel{\n"
|
||||
"color:black;\n"
|
||||
"font:14px;\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(labJunp);
|
||||
|
||||
sboxPage = new QSpinBox(TablePageWidget);
|
||||
sboxPage->setObjectName(QString::fromUtf8("sboxPage"));
|
||||
|
||||
horizontalLayout->addWidget(sboxPage);
|
||||
|
||||
labPage = new QLabel(TablePageWidget);
|
||||
labPage->setObjectName(QString::fromUtf8("labPage"));
|
||||
labPage->setStyleSheet(QString::fromUtf8("QLabel{\n"
|
||||
"color:black;\n"
|
||||
"font:14px;\n"
|
||||
"}"));
|
||||
|
||||
horizontalLayout->addWidget(labPage);
|
||||
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
|
||||
|
||||
retranslateUi(TablePageWidget);
|
||||
|
||||
QMetaObject::connectSlotsByName(TablePageWidget);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QWidget *TablePageWidget)
|
||||
{
|
||||
TablePageWidget->setWindowTitle(QCoreApplication::translate("TablePageWidget", "Form", nullptr));
|
||||
labTotal->setText(QCoreApplication::translate("TablePageWidget", "\345\205\2610\346\235\241", nullptr));
|
||||
btnFront->setText(QCoreApplication::translate("TablePageWidget", "<", nullptr));
|
||||
btn1->setText(QCoreApplication::translate("TablePageWidget", "1", nullptr));
|
||||
btn2->setText(QCoreApplication::translate("TablePageWidget", "2", nullptr));
|
||||
btn3->setText(QCoreApplication::translate("TablePageWidget", "3", nullptr));
|
||||
btn4->setText(QCoreApplication::translate("TablePageWidget", "4", nullptr));
|
||||
btn5->setText(QCoreApplication::translate("TablePageWidget", "5", nullptr));
|
||||
btnBehind->setText(QCoreApplication::translate("TablePageWidget", ">", nullptr));
|
||||
labJunp->setText(QCoreApplication::translate("TablePageWidget", "\350\267\263\350\207\263", nullptr));
|
||||
labPage->setText(QCoreApplication::translate("TablePageWidget", "\351\241\265", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class TablePageWidget: public Ui_TablePageWidget {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_TABLEPAGEWIDGET_H
|
||||
421
wavechart.cpp
Executable file
@@ -0,0 +1,421 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "wavechart.h"
|
||||
#include "smoothcurvecreator.h"
|
||||
#include "qpainter.h"
|
||||
#include <QPainterPath>
|
||||
#include "qdebug.h"
|
||||
|
||||
WaveChart::WaveChart(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
minValue = 0;
|
||||
maxValue = 100;
|
||||
xStep = 10;
|
||||
yStep = 10;
|
||||
|
||||
space = 40;
|
||||
title = "title";
|
||||
smooth = false;
|
||||
showHLine = true;
|
||||
showPoint = true;
|
||||
showPointBg = true;
|
||||
|
||||
bgColorStart = QColor(79, 79, 79);
|
||||
bgColorEnd = QColor(51, 51, 51);
|
||||
textColor = QColor(250, 250, 250);
|
||||
pointColor = QColor(38, 114, 179);
|
||||
}
|
||||
|
||||
void WaveChart::paintEvent(QPaintEvent *)
|
||||
{
|
||||
//绘制准备工作,启用反锯齿
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
|
||||
//绘制背景
|
||||
drawBg(&painter);
|
||||
//绘制盒子
|
||||
drawBox(&painter);
|
||||
//绘制文字
|
||||
drawText(&painter);
|
||||
//绘制标题
|
||||
drawTitle(&painter);
|
||||
//绘制数据点
|
||||
drawPoint(&painter);
|
||||
}
|
||||
|
||||
void WaveChart::drawBg(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
painter->setPen(Qt::NoPen);
|
||||
QLinearGradient topGradient(rect().topLeft(), rect().bottomLeft());
|
||||
topGradient.setColorAt(0.0, bgColorStart);
|
||||
topGradient.setColorAt(1.0, bgColorEnd);
|
||||
painter->setBrush(topGradient);
|
||||
painter->drawRect(rect());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void WaveChart::drawBox(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
QPointF topLeftPot(space, space);
|
||||
QPointF bottomRightPot(width() - space / 2, height() - space / 2);
|
||||
painter->setPen(textColor);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
pointRect = QRectF(topLeftPot, bottomRightPot);
|
||||
painter->drawRect(pointRect);
|
||||
|
||||
//绘制横线
|
||||
if (showHLine) {
|
||||
QPen pen(textColor, 1, Qt::DotLine);
|
||||
painter->setPen(pen);
|
||||
|
||||
int step = (maxValue - minValue) / xStep;
|
||||
double increment = (double)pointRect.height() / step;
|
||||
double startY = pointRect.topLeft().y();
|
||||
|
||||
for (int i = 0; i < step - 1; i++) {
|
||||
startY += increment;
|
||||
QPointF leftPot(pointRect.topLeft().x(), startY);
|
||||
QPointF rightPot(pointRect.topRight().x(), startY);
|
||||
painter->drawLine(leftPot, rightPot);
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void WaveChart::drawText(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
painter->setPen(textColor);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
int step = (maxValue - minValue) / xStep;
|
||||
int value = maxValue;
|
||||
double increment = (double)pointRect.height() / step;
|
||||
double startY = pointRect.topLeft().y();
|
||||
QString strValue;
|
||||
|
||||
for (int i = 0; i <= step; i++) {
|
||||
strValue = QString("%1").arg(value);
|
||||
double textWidth = fontMetrics().width(strValue);
|
||||
double textHeight = fontMetrics().height();
|
||||
QPointF textPot(pointRect.topLeft().x() - 5 - textWidth, startY + textHeight / 2);
|
||||
painter->drawText(textPot, strValue);
|
||||
value -= xStep;
|
||||
startY += increment;
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void WaveChart::drawTitle(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
painter->setPen(textColor);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
double titleX = (double)width() / 2;
|
||||
double titleY = space;
|
||||
double textWidth = fontMetrics().width(title);
|
||||
double textHeight = fontMetrics().height();
|
||||
|
||||
//标题加粗显示
|
||||
QFont titleFont;
|
||||
titleFont.setBold(true);
|
||||
titleFont.setPixelSize(13);
|
||||
painter->setFont(titleFont);
|
||||
|
||||
QPointF textPot(titleX - textWidth / 2, titleY / 2 + textHeight / 2);
|
||||
painter->drawText(textPot, title);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void WaveChart::drawPoint(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
double startX = pointRect.topRight().x();
|
||||
QVector<QPointF> points;
|
||||
|
||||
if (showPointBg) {
|
||||
points.push_back(QPointF(startX, pointRect.bottomRight().y()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < listData.count(); i++) {
|
||||
QPointF dataPot(startX, pointRect.bottomRight().y() - (double)listData.at(i) * (pointRect.height() / (maxValue - minValue)));
|
||||
points.push_back(dataPot);
|
||||
startX -= yStep;
|
||||
}
|
||||
|
||||
if (showPointBg) {
|
||||
points.push_back(QPointF(startX, pointRect.bottomRight().y()));
|
||||
}
|
||||
|
||||
//如果只有两个数据点不需要处理
|
||||
if (showPointBg && points.count() <= 2) {
|
||||
painter->restore();
|
||||
return;
|
||||
}
|
||||
|
||||
painter->setPen(pointColor);
|
||||
|
||||
if (showPointBg) {
|
||||
painter->setBrush(QColor(pointColor.red(), pointColor.green(), pointColor.blue(), 150));
|
||||
if (!smooth) {
|
||||
painter->drawPolygon(QPolygonF(points));
|
||||
}
|
||||
} else {
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
if (!smooth) {
|
||||
painter->drawPolyline(QPolygonF(points));
|
||||
}
|
||||
}
|
||||
|
||||
//绘制平滑曲线
|
||||
if (smooth) {
|
||||
QPainterPath path = SmoothCurveCreator::createSmoothCurve(points);
|
||||
painter->drawPath(path);
|
||||
}
|
||||
|
||||
//绘制坐标点
|
||||
if (showPoint) {
|
||||
for (int i = 0; i < points.count(); i++) {
|
||||
QPointF dataPot = points.at(i);
|
||||
painter->setBrush(pointColor);
|
||||
painter->drawEllipse(dataPot, 3, 3);
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void WaveChart::updateData()
|
||||
{
|
||||
int count = pointRect.width() / yStep;
|
||||
int i = listData.count() - count;
|
||||
|
||||
if (i > 0) {
|
||||
listData.remove(count, i);
|
||||
}
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
double WaveChart::getMinValue() const
|
||||
{
|
||||
return this->minValue;
|
||||
}
|
||||
|
||||
double WaveChart::getMaxValue() const
|
||||
{
|
||||
return this->maxValue;
|
||||
}
|
||||
|
||||
double WaveChart::getXStep() const
|
||||
{
|
||||
return this->xStep;
|
||||
}
|
||||
|
||||
double WaveChart::getYStep() const
|
||||
{
|
||||
return this->yStep;
|
||||
}
|
||||
|
||||
double WaveChart::getSpace() const
|
||||
{
|
||||
return this->space;
|
||||
}
|
||||
|
||||
QString WaveChart::getTitle() const
|
||||
{
|
||||
return this->title;
|
||||
}
|
||||
|
||||
bool WaveChart::getSmooth() const
|
||||
{
|
||||
return this->smooth;
|
||||
}
|
||||
|
||||
bool WaveChart::getShowHLine() const
|
||||
{
|
||||
return this->showHLine;
|
||||
}
|
||||
|
||||
bool WaveChart::getShowPoint() const
|
||||
{
|
||||
return this->showPoint;
|
||||
}
|
||||
|
||||
bool WaveChart::getShowPointBg() const
|
||||
{
|
||||
return this->showPointBg;
|
||||
}
|
||||
|
||||
QColor WaveChart::getBgColorStart() const
|
||||
{
|
||||
return this->bgColorStart;
|
||||
}
|
||||
|
||||
QColor WaveChart::getBgColorEnd() const
|
||||
{
|
||||
return this->bgColorEnd;
|
||||
}
|
||||
|
||||
QColor WaveChart::getTextColor() const
|
||||
{
|
||||
return this->textColor;
|
||||
}
|
||||
|
||||
QColor WaveChart::getPointColor() const
|
||||
{
|
||||
return this->pointColor;
|
||||
}
|
||||
|
||||
QSize WaveChart::sizeHint() const
|
||||
{
|
||||
return QSize(500, 300);
|
||||
}
|
||||
|
||||
QSize WaveChart::minimumSizeHint() const
|
||||
{
|
||||
return QSize(200, 70);
|
||||
}
|
||||
|
||||
void WaveChart::addData(double data)
|
||||
{
|
||||
listData.push_front(data);
|
||||
updateData();
|
||||
}
|
||||
|
||||
void WaveChart::setData(QVector<double> data)
|
||||
{
|
||||
listData = data;
|
||||
updateData();
|
||||
}
|
||||
|
||||
void WaveChart::clearData()
|
||||
{
|
||||
listData.clear();
|
||||
this->update();
|
||||
}
|
||||
|
||||
void WaveChart::setMinValue(double minValue)
|
||||
{
|
||||
if (this->minValue != minValue) {
|
||||
this->minValue = minValue;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setMaxValue(double maxValue)
|
||||
{
|
||||
if (this->maxValue != maxValue) {
|
||||
this->maxValue = maxValue;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setXStep(double xStep)
|
||||
{
|
||||
if (this->xStep != xStep) {
|
||||
this->xStep = xStep;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setYStep(double yStep)
|
||||
{
|
||||
if (this->yStep != yStep) {
|
||||
this->yStep = yStep;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setSpace(double space)
|
||||
{
|
||||
if (this->space != space) {
|
||||
this->space = space;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setTitle(const QString &title)
|
||||
{
|
||||
if (this->title != title) {
|
||||
this->title = title;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setSmooth(bool smooth)
|
||||
{
|
||||
if (this->smooth != smooth) {
|
||||
this->smooth = smooth;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setShowHLine(bool showHLine)
|
||||
{
|
||||
if (this->showHLine != showHLine) {
|
||||
this->showHLine = showHLine;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setShowPoint(bool showPoint)
|
||||
{
|
||||
if (this->showPoint != showPoint) {
|
||||
this->showPoint = showPoint;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setShowPointBg(bool showPointBg)
|
||||
{
|
||||
if (this->showPointBg != showPointBg) {
|
||||
this->showPointBg = showPointBg;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setBgColorStart(const QColor &bgColorStart)
|
||||
{
|
||||
if (this->bgColorStart != bgColorStart) {
|
||||
this->bgColorStart = bgColorStart;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setBgColorEnd(const QColor &bgColorEnd)
|
||||
{
|
||||
if (this->bgColorEnd != bgColorEnd) {
|
||||
this->bgColorEnd = bgColorEnd;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setTextColor(const QColor &textColor)
|
||||
{
|
||||
if (this->textColor != textColor) {
|
||||
this->textColor = textColor;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void WaveChart::setPointColor(const QColor &pointColor)
|
||||
{
|
||||
if (this->pointColor != pointColor) {
|
||||
this->pointColor = pointColor;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
113
wavechart.h
Executable file
@@ -0,0 +1,113 @@
|
||||
#ifndef WAVECHART_H
|
||||
#define WAVECHART_H
|
||||
#include <QWidget>
|
||||
#include <QPainterPath>
|
||||
class WaveChart : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue)
|
||||
Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue)
|
||||
Q_PROPERTY(double xStep READ getXStep WRITE setXStep)
|
||||
Q_PROPERTY(double yStep READ getYStep WRITE setYStep)
|
||||
|
||||
Q_PROPERTY(double space READ getSpace WRITE setSpace)
|
||||
Q_PROPERTY(QString title READ getTitle WRITE setTitle)
|
||||
Q_PROPERTY(bool smooth READ getSmooth WRITE setSmooth)
|
||||
Q_PROPERTY(bool showHLine READ getShowHLine WRITE setShowHLine)
|
||||
Q_PROPERTY(bool showPoint READ getShowPoint WRITE setShowPoint)
|
||||
Q_PROPERTY(bool showPointBg READ getShowPointBg WRITE setShowPointBg)
|
||||
|
||||
Q_PROPERTY(QColor bgColorStart READ getBgColorStart WRITE setBgColorStart)
|
||||
Q_PROPERTY(QColor bgColorEnd READ getBgColorEnd WRITE setBgColorEnd)
|
||||
Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor)
|
||||
Q_PROPERTY(QColor pointColor READ getPointColor WRITE setPointColor)
|
||||
|
||||
public:
|
||||
explicit WaveChart(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawBg(QPainter *painter);
|
||||
void drawBox(QPainter *painter);
|
||||
void drawText(QPainter *painter);
|
||||
void drawTitle(QPainter *painter);
|
||||
void drawPoint(QPainter *painter);
|
||||
|
||||
private slots:
|
||||
void updateData();
|
||||
|
||||
private:
|
||||
QRectF pointRect; //绘制数据区域
|
||||
QVector<double> listData; //数据集合
|
||||
|
||||
double minValue; //最小值
|
||||
double maxValue; //最大值
|
||||
double xStep; //x轴步长
|
||||
double yStep; //y轴步长
|
||||
|
||||
double space; //间隔
|
||||
QString title; //标题
|
||||
bool smooth; //是否平滑
|
||||
bool showHLine; //是否显示横线
|
||||
bool showPoint; //是否显示坐标点
|
||||
bool showPointBg; //是否显示坐标背景
|
||||
|
||||
QColor bgColorStart; //背景渐变开始颜色
|
||||
QColor bgColorEnd; //背景渐变结束颜色
|
||||
QColor textColor; //文字颜色
|
||||
QColor pointColor; //坐标点颜色
|
||||
|
||||
public:
|
||||
double getMinValue() const;
|
||||
double getMaxValue() const;
|
||||
double getXStep() const;
|
||||
double getYStep() const;
|
||||
|
||||
double getSpace() const;
|
||||
QString getTitle() const;
|
||||
bool getSmooth() const;
|
||||
bool getShowHLine() const;
|
||||
bool getShowPoint() const;
|
||||
bool getShowPointBg() const;
|
||||
|
||||
QColor getBgColorStart() const;
|
||||
QColor getBgColorEnd() const;
|
||||
QColor getTextColor() const;
|
||||
QColor getPointColor() const;
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
//添加和设置数据数据
|
||||
void addData(double data);
|
||||
void setData(QVector<double> data);
|
||||
void clearData();
|
||||
|
||||
//设置范围值及步长
|
||||
void setMinValue(double minValue);
|
||||
void setMaxValue(double maxValue);
|
||||
void setXStep(double xStep);
|
||||
void setYStep(double yStep);
|
||||
|
||||
//设置间隔
|
||||
void setSpace(double space);
|
||||
//设置标题
|
||||
void setTitle(const QString &title);
|
||||
//设置是否平滑曲线
|
||||
void setSmooth(bool smooth);
|
||||
//设置显示横线
|
||||
void setShowHLine(bool showHLine);
|
||||
//设置显示坐标点
|
||||
void setShowPoint(bool showPoint);
|
||||
//设置显示坐标背景
|
||||
void setShowPointBg(bool showPointBg);
|
||||
|
||||
//设置颜色
|
||||
void setBgColorStart(const QColor &bgColorStart);
|
||||
void setBgColorEnd(const QColor &bgColorEnd);
|
||||
void setTextColor(const QColor &textColor);
|
||||
void setPointColor(const QColor &pointColor);
|
||||
};
|
||||
|
||||
#endif // WAVECHART_H
|
||||