添加工具栏按钮图标

main
HwangKC 2024-10-12 14:00:37 +08:00
parent a3b63c6fe1
commit 6f2170559d
23 changed files with 766 additions and 99 deletions

View File

@ -1,5 +1,7 @@
#include "datafetcher.h"
#include "globalparameters.h"
#include "mysqlutils.h"
#include <hv/hlog.h>
DataFetcher::DataFetcher()
{
@ -13,6 +15,13 @@ DataFetcher::~DataFetcher()
bool DataFetcher::Fetch(TableData& tbl_data)
{
int rows = MysqlUtils::getInstance()->RetrieveTableData(tbl_data);
if (rows < 0)
{
hloge("Failed to retrieve signal data");
return false;
}
return true;
}

View File

@ -1,6 +1,8 @@
#ifndef DATAFETCHER_H
#define DATAFETCHER_H
#pragma execution_character_set("utf-8")
#include "globalparameters.h"
class DataFetcher

View File

@ -77,6 +77,7 @@ SOURCES += \
datafetcher.cpp \
devicepropertypage.cpp \
globalparameters.cpp \
kutilities.cpp \
main.cpp \
maindialog.cpp \
mainwindow.cpp \
@ -88,6 +89,7 @@ HEADERS += \
datafetcher.h \
devicepropertypage.h \
globalparameters.h \
kutilities.h \
maindialog.h \
mainwindow.h \
mysqlutils.h \

View File

@ -12,5 +12,8 @@
<file>images/PageSetting.png</file>
<file>images/PageSwitch.png</file>
<file>images/PageUps.png</file>
<file>images/icons8-add-64.png</file>
<file>images/icons8-close-64.png</file>
<file>images/icons8-refresh-64.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,116 @@
#include "kutilities.h"
#include <iomanip>
#include <string>
#include <sstream>
#include <chrono>
Kutilities::Kutilities() {}
// 函数用于将内存块转换为十六进制字符串
std::string Kutilities::printHex(const void* data, size_t size)
{
std::ostringstream oss;
std::ostringstream oss2;
std::ostringstream ossrow;
// 每行输出的字节数
const size_t lineSize = 16;
const unsigned char* p = static_cast<const unsigned char*>(data);
int ic = 0;
int row = 0;
ossrow << std::setw(8) << std::setfill('0') << std::hex << row++ << "h : ";
oss << ossrow.str().c_str();
for( size_t i = 0; i < size; ++i )
{
ic++;
// 每个字节之间用空格分隔
oss << std::setw(2) << std::setfill('0') << std::hex << std::uppercase << static_cast<int>(p[i]);
char ch = (isprint(p[i]) != 0) ? p[i] : '.';
oss2 << ch;
//每lineSize个字节换行
if( (i + 1) % lineSize == 0 )
{
ossrow.clear();
ossrow.str("");
oss << " [" << oss2.str().c_str() << "]" << std::endl;
oss2.clear();
oss2.str("");
ossrow << std::setw(8) << std::setfill('0') << std::hex << row++ << "h : ";
oss << ossrow.str().c_str();
ic = 0;
}
else if( i == size - 1 )
{
if( (i + 1) % lineSize != 0 )
{
if( i % 2 != 0 )
{
for( size_t j = 0; j < (lineSize - ic); j++ )
{
oss << " --";
}
}
else
{
for( size_t j = 0; j < (lineSize - ic); j++ )
{
oss << " --";
}
}
}
oss << " [" << oss2.str().c_str();
if( (i + 1) % lineSize != 0 )
{
for( size_t j = 0; j < (lineSize - ic); j++ )
{
oss << " ";
}
}
oss << "]" << std::endl;
oss2.clear();
oss2.str("");
ic = 0;
}
#if 0
else if( (i + 1) % 8 == 0 )
{
oss << " ";
oss2 << " ";
}
#endif
else
{
oss << " ";
}
}
return oss.str();
}
std::string Kutilities::get_current_timestamp()
{
auto now = std::chrono::system_clock::now();
//通过不同精度获取相差的毫秒数
uint64_t dis_millseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count()
- std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count() * 1000;
time_t tt = std::chrono::system_clock::to_time_t(now);
auto time_tm = localtime(&tt);
char strTime[25] = { 0 };
sprintf(strTime, "%d-%02d-%02d %02d:%02d:%02d.%03d", time_tm->tm_year + 1900,
time_tm->tm_mon + 1, time_tm->tm_mday, time_tm->tm_hour,
time_tm->tm_min, time_tm->tm_sec, (int)dis_millseconds);
return std::string(strTime);
}

View File

@ -0,0 +1,19 @@
#ifndef KUTILITIES_H
#define KUTILITIES_H
#pragma execution_character_set("utf-8")
#include <string>
class Kutilities
{
public:
Kutilities();
//获取当前精确到毫秒的时间戳返回字符串格式YYYY-MM-DD HH:MI:SS.MMM
static std::string get_current_timestamp();
// 函数用于将内存块转换为十六进制字符串
static std::string printHex(const void* data, size_t size);
};
#endif // KUTILITIES_H

View File

@ -43,11 +43,11 @@ int main(int argc, char *argv[])
hlog_fsync();
//若是系统自带的QStyle风格则需要先创建为QStyleFactory::create("")然后设置qApp->setStyle()
QStringList listStyle = QStyleFactory::keys();
foreach(QString val, listStyle) //打印当前系统支持的系统风格,,且打印出来
{
qDebug()<<val<<" ";
}
//QStringList listStyle = QStyleFactory::keys();
//foreach(QString val, listStyle) //打印当前系统支持的系统风格,,且打印出来
//{
// qDebug()<<val<<" ";
//}
//当前系统支持的系统风格
//"windowsvista"

View File

@ -120,13 +120,23 @@ void MainDialog::CreateToolbar()
layout->addItem(spacer);
// Create actions for the toolbar
QAction *action1 = new QAction(QIcon(":/images/icon.png"), "Button 1", this);
QAction *action2 = new QAction(QIcon(":/images/icon.png"), "Button 2", this);
QAction *action3 = new QAction(QIcon(":/images/icon.png"), "About...", this);
QAction *action1 = new QAction(QIcon(":/images/icons8-add-64.png"), tr("Add Device"), this);
action1->setToolTip(tr("Add a new device"));
QAction *action2 = new QAction(QIcon(":/images/icons8-close-64.png"), tr("Remove Device"), this);
action2->setToolTip(tr("Remove a device"));
QAction *action4 = new QAction(QIcon(":/images/icons8-refresh-64.png"), tr("Refresh"), this);
action4->setToolTip(tr("Refresh"));
QAction *action3 = new QAction(QIcon(":/images/icon.png"), tr("About..."), this);
action3->setToolTip(tr("Show information about EMU Configurer toolkit"));
// Add actions to the toolbar
m_pMainToolBar->addAction(action1);
m_pMainToolBar->addAction(action2);
m_pMainToolBar->addAction(action4);
m_pMainToolBar->addSeparator();
m_pMainToolBar->addAction(action3);
// 将工具栏的 widget 设置为包含图标和占位符的 widget
@ -134,7 +144,8 @@ void MainDialog::CreateToolbar()
// Connect actions to slots
connect(action1, &QAction::triggered, this, &MainDialog::onToolButton1Clicked);
connect(action2, &QAction::triggered, this, &MainDialog::onToolButton1Clicked);
connect(action2, &QAction::triggered, this, &MainDialog::onToolButton2Clicked);
connect(action4, &QAction::triggered, this, &MainDialog::onToolRefreshClicked);
connect(action3, &QAction::triggered, this, &MainDialog::onAboutButtonClicked);
}
@ -159,7 +170,7 @@ void MainDialog::CreateTablePage()
m_pDevicestackedWidget->addWidget(new QPushButton("Page 5"));
m_pDevicestackedWidget->addWidget(new QPushButton("Page 6"));
#endif
// setLayout(stackedWidgetLayout);
// setLayout(stackedWidgetLayout);
}
void MainDialog::CreateIcon(const QIcon& icon,QString text)
@ -200,18 +211,26 @@ void MainDialog::loadWindowState()
restoreState(settings.value("windowState").toByteArray());
}
//增加设备
void MainDialog::onToolButton1Clicked()
{
QMessageBox::information(this, "Button Clicked", "Button 1 was clicked!");
}
//删除设备
void MainDialog::onToolButton2Clicked()
{
QMessageBox::information(this, "Button Clicked", "Button 2 was clicked!");
}
//关于
void MainDialog::onAboutButtonClicked()
{
QMessageBox::information(this, "Button Clicked", "About");
}
//刷新
void MainDialog::onToolRefreshClicked()
{
QMessageBox::information(this, "Refresh Button Clicked", "Refresh");
}

View File

@ -1,5 +1,6 @@
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#pragma execution_character_set("utf-8")
#include <QMainWindow>
#include <QListWidget>
@ -8,7 +9,8 @@
#include <QStackedWidget>
#include <QToolBar>
namespace Ui {
namespace Ui
{
class MainDialog;
}
@ -31,6 +33,7 @@ public slots:
private slots:
void onToolButton1Clicked();
void onToolButton2Clicked();
void onToolRefreshClicked();
void onAboutButtonClicked();
private:

View File

@ -29,7 +29,7 @@ MainWindow::MainWindow(QWidget *parent)
QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(rx, this);
ui->serverIp->setValidator(ipValidator);
//setIp("127.0.0.1");
setIp("192.168.4.254");
setIp("192.168.10.254");
}
MainWindow::~MainWindow()
@ -47,15 +47,7 @@ void MainWindow::setIp(const QString &ip)
ui->serverIp->setText(ip);
}
void MainWindow::on_pb_Logon_clicked()
{
m_pMainDialog = new MainDialog();
m_pMainDialog->show();
this->close();
}
void MainWindow::on_pb_Test_clicked()
bool MainWindow::testDatabase()
{
QString svr = ui->serverIp->text();
std::string dbserver = svr.toStdString(); //"tcp://192.168.4.254";
@ -67,12 +59,33 @@ void MainWindow::on_pb_Test_clicked()
if (!dbok)
{
hloge("failed to open database, exit now...");
QMessageBox::critical(this, tr("Critical Message"),tr("Failed to connect to device!"));
return;
return false;
}
hlogi("database connection test successfully!");
QMessageBox::information(this, tr("Successfully"),tr("Connect to device successfully!"));
return true;
}
void MainWindow::on_pb_Logon_clicked()
{
if (testDatabase())
{
m_pMainDialog = new MainDialog();
m_pMainDialog->show();
this->close();
}
else
{
QMessageBox::critical(this, tr("Critical Message"),tr("Failed to retrieve device data!"));
}
}
void MainWindow::on_pb_Test_clicked()
{
if (testDatabase())
QMessageBox::information(this, tr("Successfully"),tr("Connect to device successfully!"));
else
QMessageBox::critical(this, tr("Critical Message"),tr("Failed to connect to device!"));
}

View File

@ -1,5 +1,6 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#pragma execution_character_set("utf-8")
#include <QMainWindow>
@ -22,6 +23,7 @@ public:
protected:
void setIp(const QString &ip);
bool testDatabase();
private slots:
void on_pb_Logon_clicked();

View File

@ -26,9 +26,9 @@
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>160</x>
<x>120</x>
<y>183</y>
<width>61</width>
<width>101</width>
<height>21</height>
</rect>
</property>
@ -63,7 +63,7 @@
<rect>
<x>250</x>
<y>180</y>
<width>124</width>
<width>121</width>
<height>23</height>
</rect>
</property>
@ -182,9 +182,9 @@
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>160</x>
<x>120</x>
<y>207</y>
<width>68</width>
<width>111</width>
<height>30</height>
</rect>
</property>
@ -195,9 +195,9 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>160</x>
<x>120</x>
<y>240</y>
<width>56</width>
<width>101</width>
<height>21</height>
</rect>
</property>

View File

@ -2,6 +2,8 @@
#include <QDebug>
#include <hv/hlog.h>
#include "ziputils.h"
#include "kutilities.h"
#ifdef _USING_MYSQL_CONNECTOR_
#include <mysql_connection.h>
@ -37,7 +39,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
{
bool ok = false;
#ifdef _USING_QT_MYSQL_CONNECTOR_
// 打开数据库
//打开数据库
if (m_DbConnection.isOpen() && m_DbConnection.isValid())
{
hlogd("database already connected.");
@ -54,7 +56,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
#endif
#ifdef _USING_MYSQL_CONNECTOR_
// 创建连接
//创建连接
sql::Driver *driver = nullptr;
driver = get_driver_instance();
@ -78,7 +80,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
#ifdef _USING_MYSQL_51_LIB_
m_DbConnection = mysql_init(NULL);
// 连接到MySQL服务器
//连接到MySQL服务器
if (!mysql_real_connect(m_DbConnection, server.c_str(), dbuser.c_str(), dbpasswd.c_str(), database.c_str(), dbport, NULL, 0))
{
hloge("MySQL connection error: %s",mysql_error(m_DbConnection));
@ -100,7 +102,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
#if 0
MYSQL_RES* res;
MYSQL_ROW row;
// 执行 SQL 查询
//执行SQL查询
if (mysql_query(m_DbConnection, "SELECT * FROM tbl_device"))
{
qDebug() << "Error: " << mysql_error(m_DbConnection) ;
@ -108,7 +110,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
return 1;
}
res = mysql_use_result(m_DbConnection); // 获取结果集
res = mysql_use_result(m_DbConnection);
while ((row = mysql_fetch_row(res)) != NULL)
{
@ -119,7 +121,7 @@ bool MysqlUtils::OpenDatabase(const std::string& server, int dbport, const std::
qDebug() << "\r\n";
}
mysql_free_result(res); // 释放结果集资源
mysql_free_result(res);
#endif
}
@ -142,6 +144,60 @@ void MysqlUtils::CloseDatabase()
#endif
#ifdef _USING_MYSQL_51_LIB_
mysql_close(m_DbConnection); // 关闭连接
mysql_close(m_DbConnection);
#endif
}
int MysqlUtils::RetrieveTableData(TableData& tbl_data)
{
#if 1
MYSQL_RES* res;
MYSQL_ROW row;
//执行SQL 查询
if (mysql_query(m_DbConnection, "SELECT * FROM `hjems`.`tbl_data` ORDER BY data_timestamp LIMIT 0,100"))
{
hloge( "Error: %s", mysql_error(m_DbConnection) ) ;
return -1;
}
res = mysql_use_result(m_DbConnection);
while ((row = mysql_fetch_row(res)) != NULL)
{
ModelItem item;
// item.status = STATUS_WARN;
// item.ParameterName= "Visual Leak Detector detected 1 memory leak (84 bytes)";
// item.sampleTime = "2024-9-10 11:22:33.444";
// item.unit = "C";
// item.value = "100";
// tbl_data.append(item);
std::string buf;
for (unsigned int i = 0; i < mysql_num_fields(res); ++i)
{
qDebug() << mysql_fetch_field_direct(res,i)->name ;
QString field_name (mysql_fetch_field_direct(res,i)->name);
if (field_name == "data_timestamp")
{
item.sampleTime = row[i];
qDebug() << row[i];
}
else if (field_name == "data_content")
{
std::string v(row[i]);
qDebug() << Kutilities::printHex(v.c_str(),v.length()).c_str();
ZipUtils::DecompressString(v.c_str(),v.length(),buf);
qDebug() << buf.c_str();
}
}
qDebug() << "\r\n";
}
unsigned long row_count = res->row_count;
mysql_free_result(res);
return row_count;
#endif
}

View File

@ -1,5 +1,6 @@
#ifndef MYSQLUTILS_H
#define MYSQLUTILS_H
#pragma execution_character_set("utf-8")
#include <string>
@ -13,9 +14,11 @@
#ifdef _USING_MYSQL_51_LIB_
#include <WinSock2.h>
#include <mysql.h> // MySQL C API 头文件
#include <mysql.h> //MySQL C API include file
#endif
#include "globalparameters.h"
class MysqlUtils
{
protected:
@ -28,6 +31,7 @@ public:
void CloseDatabase();
bool OpenDatabase(const std::string& server = "127.0.0.1", int dbport = 3306, const std::string& dbuser = "root", const std::string& dbpasswd = "Hj57471000", const std::string& database="hjems");
int RetrieveTableData(TableData& tbl_data);
private:
#ifdef _USING_QT_MYSQL_CONNECTOR_

View File

@ -5,16 +5,6 @@
MyTableModel::MyTableModel(QObject* parent)
:QAbstractTableModel(parent)
{
for(int i=0;i<100;i++)
{
ModelItem item;
item.status = STATUS_WARN;
item.ParameterName= "Visual Leak Detector detected 1 memory leak (84 bytes)";
item.sampleTime = "2024-9-10 11:22:33.444";
item.unit = "C";
item.value = "100";
m_modelData.append(item);
}
}
int MyTableModel::rowCount(const QModelIndex & /*parent*/) const
@ -37,20 +27,23 @@ QVariant MyTableModel::data(const QModelIndex& index, int role) const
const int row = index.row();
switch (index.column())
{
case 0:
{
if (m_modelData.at(row).status == STATUS_NORMAL) return tr("Normal");
if (m_modelData.at(row).status == STATUS_INFO) return tr("INFO");
if (m_modelData.at(row).status == STATUS_WARN) return tr("WARN");
if (m_modelData.at(row).status == STATUS_ERROR) return tr("ERROR");
}
case 1:
{
return m_modelData.at(row).ParameterName.c_str();
}
case 2: return m_modelData.at(row).value.c_str();
case 3: return m_modelData.at(row).unit.c_str();
case 4: return m_modelData.at(row).sampleTime.c_str();
case 0:
{
if (m_modelData.at(row).status == STATUS_NORMAL) return tr("Normal");
if (m_modelData.at(row).status == STATUS_INFO) return tr("INFO");
if (m_modelData.at(row).status == STATUS_WARN) return tr("WARN");
if (m_modelData.at(row).status == STATUS_ERROR) return tr("ERROR");
}
case 1:
{
return m_modelData.at(row).ParameterName.c_str();
}
case 2:
return m_modelData.at(row).value.c_str();
case 3:
return m_modelData.at(row).unit.c_str();
case 4:
return m_modelData.at(row).sampleTime.c_str();
}
}
@ -79,14 +72,14 @@ QVariant MyTableModel::data(const QModelIndex& index, int role) const
const int row = index.row();
switch (index.column())
{
case 0: //状态
case 2: //数值
{
if (m_modelData.at(row).status == STATUS_WARN)
return QVariant(QColor(Qt::yellow));
else if (m_modelData.at(row).status == STATUS_ERROR)
return QVariant(QColor(Qt::red));
}
case 0: //状态
case 2: //数值
{
if (m_modelData.at(row).status == STATUS_WARN)
return QVariant(QColor(Qt::yellow));
else if (m_modelData.at(row).status == STATUS_ERROR)
return QVariant(QColor(Qt::red));
}
}
}
@ -132,7 +125,7 @@ void MyTableModel::setModelData(TableData data)
beginResetModel(); //通过这个告诉我要开始修改model了
m_modelData.clear();
for (int i = 0;i < data.count();++i)
for (int i = 0; i < data.count(); ++i)
{
m_modelData.append(data[i]);
}

View File

@ -1,7 +1,6 @@
#pragma execution_character_set("utf-8")
#ifndef MYTABLEMODEL_H
#ifndef MYTABLEMODEL_H
#define MYTABLEMODEL_H
#pragma execution_character_set("utf-8")
#include <QAbstractTableModel>
#include <QString>

View File

@ -1,21 +1,21 @@
<RCC warning="WARNING! File created programmatically. All changes made in this file will be lost!">
<qresource prefix="bingle_icons/bingle">
<file>QSS_IMG/go-down-symbolic.symbolic.png</file>
<file>QSS_IMG/go-next-symbolic.symbolic.png</file>
<file>QSS_IMG/go-previous-symbolic.symbolic.png</file>
<file>QSS_IMG/go-up-symbolic.symbolic.png</file>
<file>QSS_IMG/object-select-symbolic.symbolic.png</file>
</qresource>
<qresource prefix="bingle/bingle">
<file>AMOLED.qss</file>
<file>Aqua.qss</file>
<file>ConsoleStyle.qss</file>
<file>ElegantDark.qss</file>
<file>MacOS.qss</file>
<file>ManjaroMix.qss</file>
<file>MaterialDark.qss</file>
<file>NeonButtons.qss</file>
<file>Ubuntu.qss</file>
</qresource>
<RCC>
<qresource prefix="/bingle_icons/bingle">
<file>QSS_IMG/go-down-symbolic.symbolic.png</file>
<file>QSS_IMG/go-next-symbolic.symbolic.png</file>
<file>QSS_IMG/go-previous-symbolic.symbolic.png</file>
<file>QSS_IMG/go-up-symbolic.symbolic.png</file>
<file>QSS_IMG/object-select-symbolic.symbolic.png</file>
</qresource>
<qresource prefix="/bingle/bingle">
<file>AMOLED.qss</file>
<file>Aqua.qss</file>
<file>ConsoleStyle.qss</file>
<file>ElegantDark.qss</file>
<file>MacOS.qss</file>
<file>ManjaroMix.qss</file>
<file>MaterialDark.qss</file>
<file>NeonButtons.qss</file>
<file>Ubuntu.qss</file>
<file>material-blue.qss</file>
</qresource>
</RCC>

View File

@ -0,0 +1,426 @@
QWidget:window { /* Borders around the code editor and debug window */
border: 0px solid #263238;
background-color: #263238;
}
QToolTip {
background-color: #80CBC4;
color: black;
padding: 5px;
border-radius: 0;
opacity: 200;
}
/* ==================== Dialog ==================== */
QLabel {
background: transparent;
color: #CFD8DC; /* Not sure about this one */
}
QDialog, QListView {
background-color: #263238;
color: #546E7A;
outline: 0;
border: 2px solid transparent;
}
QListView::item:hover {
color: #AFBDC4;
background: transparent;
}
QListView::item:selected {
color: #ffffff;
background: transparent;
}
/* === QTabBar === */
QTabBar {
background: #263238;
}
QTabWidget::pane {
background: transparent; /* Only at the very bottom of the tabs */
}
QTabBar::tab {
background: transparent;
border: 0px solid transparent;
border-bottom: 2px solid transparent;
color: #546E7A;
padding-left: 10px;
padding-right: 10px;
padding-top: 3px;
padding-bottom: 3px;
}
QTabBar::tab:hover {
background-color: transparent;
border: 0px solid transparent;
border-bottom: 2px solid #80CBC4;
color: #AFBDC4;
}
QTabBar::tab:selected {
background-color: transparent;
border: 0px solid transparent;
border-top: none;
border-bottom: 2px solid #80CBC4;
color: #FFFFFF;
}
QStackedWidget {
background: #263238; /* This covers a bunch of things, I was thinking about making it transparent, */
/* but I would have to find all the other elements... but QTabWidget::pane may be it */
}
/* === QGroupBox === */
QGroupBox {
border: 1px solid transparent;
margin-top: 1em;
}
QGroupBox::title {
color: #80CBC4;
subcontrol-origin: margin;
left: 6px;
padding: 0 3px 0 3px;
}
QComboBox {
color: #546E7A;
background-color: transparent;
selection-background-color: transparent;
outline: 0;
}
QComboBox QAbstractItemView
{
selection-background-color: transparent;
outline: 0;
}
/* === QCheckBox === */
QCheckBox, QRadioButton {
color: #AFBDC4;
}
QCheckBox::indicator::unchecked {
background-color: #263238;
border: 1px solid #536D79;
}
QRadioButton::indicator::unchecked {
background-color: #263238;
border: 1px solid #536D79;
border-radius: 4px;
}
QCheckBox::indicator::checked, QTreeView::indicator::checked {
background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #80CBC4, stop:1 #263238);
border: 1px solid #536D79;
}
QRadioButton::indicator::checked {
background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #80CBC4, stop:1 #263238);
border: 1px solid #536D79;
border-radius: 4px;
}
QCheckBox::indicator:disabled, QRadioButton::indicator:disabled, QTreeView::indicator:disabled {
background-color: #444444; /* Not sure what this looks like */
}
QCheckBox::indicator::checked:disabled, QRadioButton::indicator::checked:disabled, QTreeView::indicator::checked:disabled {
background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #BBBBBB, stop:1 #444444); /* Not sure what this looks like */
}
QTreeView {
background-color: transparent;
color: #546E7A;
outline: 0;
border: 0;
}
QTreeView::item:hover {
background-color: transparent;
color: #AFBDC4;
}
QTreeView::item:selected {
background-color: transparent;
color: #FFFFFF;
}
QTreeView QHeaderView:section {
background-color: #263238;
color: #CFD8DC;
border: 0;
}
QTreeView::indicator:checked {
background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #80CBC4, stop:1 #263238);
border: 1px solid #536D79;
selection-background-color: transparent;
}
QTreeView::indicator:unchecked { /* This and the one above style the checkbox in the Options -> Keyboard */
background-color: #263238; /* This is still a hover over in blue I can't get rid of */
border: 1px solid #536D79;
selection-background-color: transparent;
}
/*QTreeView QScrollBar {
background-color: #263238
}*/
QTreeView::branch {
/* Skip - applies to everything */
}
QTreeView::branch:has-siblings:adjoins-item {
/* Skip - files */
}
QTreeView::branch:has-siblings:!adjoins-item {
/* Skip - applies to almost all on the left side */
}
QTreeView::branch:closed:has-children:has-siblings {
background: url('./images/rightarrowgray.png') center center no-repeat;
}
QTreeView::branch:has-children:!has-siblings:closed {
background: url('./images/rightarrowgray.png') center center no-repeat;
}
QTreeView::branch:!has-children:!has-siblings:adjoins-item {
/* Skip - files */
}
QTreeView::branch:open:has-children:has-siblings {
background: url('./images/downarrowgray.png') center center no-repeat;
}
QTreeView::branch:open:has-children:!has-siblings {
background: url('./images/downarrowgray.png') center center no-repeat;
}
/* === QScrollBar:horizontal === */
QScrollBar:horizontal {
background: #263238; /* Background where slider is not */
height: 10px;
margin: 0;
}
QScrollBar:vertical {
background: #263238; /* Background where slider is not */
width: 10px;
margin: 0;
}
QScrollBar::handle:horizontal {
background: #37474F; /* Slider color */
min-width: 16px;
border-radius: 5px;
}
QScrollBar::handle:vertical {
background: #37474F; /* Slider color */
min-height: 16px;
border-radius: 5px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal,
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none; /* Removes the dotted background */
}
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal,
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { /* Hides the slider arrows */
border: none;
background: none;
}
QPushButton {
background-color: transparent;
color: #546E7A;
border: 1px solid transparent;
padding: 4px 22px;
}
QPushButton:hover {
color: #AFBDC4;
}
QPushButton:pressed {
color: #FFFFFF;
}
QLineEdit {
background: transparent;
border: 1px solid transparent;
color: #546E7A;
}
QSpinBox {
background: transparent;
border: 1px solid transparent;
color: #546E7A;
}
/*****************************************************************************
Main Screen
*****************************************************************************/
QTreeView {
background-color: #263238;
}
QMenu {
background-color: #263238; /* File Menu Background color */
color: #546E7A;
}
QMenu::item:selected {
color: #AFBDC4;
}
QMenu::item:pressed {
color: #FFFFFF;
}
QMenu::separator {
height: 1px;
background: transparent; /* Could change this to #546E7A and reduce the margin top and bottom to 1px */
margin-left: 10px;
margin-right: 10px;
margin-top: 5px;
margin-bottom: 5px;
}
/* === QMenuBar === */
QMenuBar {
background-color: #263238;
color: #546E7A;
}
QMenuBar::item {
background: transparent;
}
QMenuBar::item:disabled {
color: gray;
}
QMenuBar::item:selected {
color: #AFBDC4;
}
QMenuBar::item:pressed {
color: #FFFFFF;
}
QToolBar {
background: #263238;
border: 1px solid transparent;
}
QToolBar:handle {
background: transparent;
border-left: 2px dotted #80CBC4; /* Fix the 4 handle dots so it doesn't look crappy */
color: transparent;
}
QToolBar::separator {
border: 0;
}
/* === QToolButton === */
QToolButton:hover, QToolButton:pressed {
background-color: transparent;
}
QToolButton::menu-button {
background: url('./images/downarrowgray.png') center center no-repeat;
background-color: #263238; /* This needs to be set to ensure the other brown arrows don't show */
}
QToolButton::menu-button:hover, QToolButton::menu-button:pressed {
background-color: #263238;
}
QStatusBar {
background-color: #263238;
}
QLabel {
color: #546E7A; /* Text at the bottom right corner of the screen */
}
QToolButton { /* I don't like how the items depress */
color: #546E7A;
}
QToolButton:hover, QToolButton:pressed, QToolButton:checked {
background-color: #263238;
}
QToolButton:hover {
color: #AFBDC4;
}
QToolButton:checked, QToolButton:pressed {
color: #FFFFFF;
}
QToolButton {
border: 1px solid transparent;
margin: 1px;
}
QToolButton:hover {
background-color: transparent; /* I don't like how the down arrows in the top menu bar move down when clicked */
border: 1px solid transparent;
}
QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
padding-right: 20px; /* make way for the popup button */
}
QToolButton::menu-button {
border-left: 1px solid transparent;
background: transparent;
width: 16px;
}
QToolButton::menu-button:hover {
border-left: 1px solid transparent;
background: transparent;
width: 16px;
}
QStatusBar::item {
color: #546E7A;
background-color: #263238;
}
QAbstractScrollArea { /* Borders around the code editor and debug window */
border: 0;
}
/*****************************************************************************
Play around with these settings
*****************************************************************************/
/* Force the dialog's buttons to follow the Windows guidelines. */
QDialogButtonBox {
button-layout: 0;
}
QTabWidget::tab-bar {
left: 0px; /* Test this out on OS X, it will affect the tabs in the Options Dialog, on OS X they are centered */
}

View File

@ -1,7 +1,6 @@
#ifndef SINGLETON_H
#define SINGLETON_H
#include <iostream>
#pragma execution_character_set("utf-8")
template<typename T>
class Singleton
@ -17,7 +16,7 @@ public:
Singleton& operator =(const Singleton&)=delete;
protected:
struct token{}; // helper class
struct token {}; // helper class
Singleton() noexcept=default;
};

View File

@ -1,5 +1,7 @@
#ifndef ZIPUTILS_H
#define ZIPUTILS_H
#pragma execution_character_set("utf-8")
#include <string>
class ZipUtils