Example #1
0
DUI_USE_NAMESPACE

MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
{
    DThemeManager * themeManager = DThemeManager::instance();

    initTabWidget();

    QVBoxLayout * mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->addWidget(m_mainTab);

    QHBoxLayout * styleLayout = new QHBoxLayout();
    QPushButton *darkButton = new QPushButton("Dark",this);
    QPushButton *lightBUtton = new QPushButton("Light",this);
    connect(darkButton, &QPushButton::clicked, [=]{
        themeManager->setTheme("dark");
    });
    connect(lightBUtton, &QPushButton::clicked, [=]{
        themeManager->setTheme("light");
    });
    styleLayout->addWidget(darkButton);
    styleLayout->addWidget(lightBUtton);
    styleLayout->addStretch();

    mainLayout->addLayout(styleLayout);

    this->setLayout(mainLayout);
}
Example #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    //QDesktopServices::openUrl(QUrl("file:///C:/Documents and Settings/All Users/Desktop", QUrl::TolerantMode));
    ui->setupUi( this);
    //ui->listWidget->setCurrentRow(0);
    //ui->listWidget_2->setCurrentRow(0);

    wordList << "title:"<<"author:"<<"keyword:"<<"tag:"<<"note:";
    initToolbar();

    initMainArea();
    initIcons();

    initTabWidget();

    initTheDownLeftCorner();
    initTheUpLeftCorner();
    initSignalsAndSlots();
    initContextMenu();
    ui->listWidget->setCurrentRow(0);
    ui->listWidget_2->setCurrentRow(0);
}
Example #3
0
CSMonitorClient::CSMonitorClient(QWidget *parent)
	: QFrame(parent)
	, m_bPressed(false)
{
	ClientLogger->AddLog(QString::fromLocal8Bit("客户端版本号【%1】 电话号码【%2】").arg(MessageDataMediator->m_strClientVersion).arg(MessageDataMediator->m_strNewId));

	//setWindowIcon(QIcon(":/Resources/normal.png"));
	setMinimumSize(QSize(900, 600));

 	m_pMessageEventMediator = NetClass->m_pMessageEventMediator;
 	m_pNetClient = NetClass->m_pNetClt;
	//connect(m_pMessageEventMediator, &CMessageEventMediator::sigServerHasGetSoftInstall, SoftInstallResultSendManager, &CSoftInstallResultSendThread::serverHasGetSoftInstall);
	//SoftInstallResultSendManager->Start(QApplication::applicationDirPath() + "/updateTask.xml");

	setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
	setObjectName("mainFrame");
	//setWidgetStyleSheet(":/Resources/blue.css");

	m_titleWidget = new CTitleWidget(this);
	m_titleWidget->setParent(this);
	//m_titleWidget->setCloseButtonHint(false);
	m_titleWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	m_titleWidget->setTitle(QString::fromLocal8Bit("SMonitor软件安装/升级管理系统(正式版)"));

	m_trayIcon = new CSystemTrayIcon(this);
	m_trayIcon->setHidden(true);
	m_trayIcon->show();
	
	m_stackedWidget = new QStackedWidget(this);
	m_sideBarWidget = new CSideBarWidget(this);
	initTabWidget();

	m_sideBarWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	//m_sideBarWidget->setMinimumHeight(300);
	connect(m_sideBarWidget, &CSideBarWidget::currentIndexChanged, 
		m_stackedWidget, &QStackedWidget::setCurrentIndex);

	QHBoxLayout* hBoxLayout = new QHBoxLayout;
	hBoxLayout->setMargin(0);
	hBoxLayout->setSpacing(0);
	hBoxLayout->addWidget(m_sideBarWidget);
	hBoxLayout->addWidget(m_stackedWidget);

	QVBoxLayout* mainLayout = new QVBoxLayout(this);
	mainLayout->setMargin(0);
	mainLayout->setSpacing(0);
	mainLayout->addWidget(m_titleWidget);
	mainLayout->addLayout(hBoxLayout);

	connect(m_trayIcon, &CSystemTrayIcon::activated, this, &CSMonitorClient::activedByTrayIcon);
	connect(m_trayIcon, &CSystemTrayIcon::hideOrShowWidget, this, &CSMonitorClient::hideOrShow);
	connect(m_trayIcon, &CSystemTrayIcon::quitApplication, this, &CSMonitorClient::close);
	//connect(m_trayIcon, &CSystemTrayIcon::aboutApplication, this, &CSMonitorClient::about);
	connect(m_trayIcon, &CSystemTrayIcon::messageClicked, this, &CSMonitorClient::updateArrived);
	connect(m_titleWidget, &CTitleWidget::minimumzed, this, &CSMonitorClient::setMinimumed);
	connect(m_titleWidget, &CTitleWidget::closed, this, &CSMonitorClient::setMinimumed);
	connect(SoftManager, &CSoftManager::quitApplication, this, &CSMonitorClient::close);

	//首先需要加载本地保存的数据
	CategoryFactory->LoadLocalData();

	//加载缓存
	CategoryFactory->CheckUpgradeData();

	connect(CategoryFactory, &CCategoryFactory::upgradeNotify, m_trayIcon, &CSystemTrayIcon::setState);
	//如果服务器断开,则加载上一次下载的服务器数据
	//if(!NetClass->m_pNetClt->m_bIsOnLine){
	//	CategoryFactory->CheckUpgradeData();
	//	ClientLogger->AddLog(QString::fromLocal8Bit("客户端连接服务器异常,加载前一次下载至本地的配置数据"));
	//}
	connect(SoftManager, &CSoftManager::InstallFinished, CategoryFactory, &CCategoryFactory::InstallFinished);
	
	//CXmlParse::Instance()->LoadLocalData();
	//connect(CXmlParse::Instance(), &CXmlParse::upgradeNotify, m_trayIcon, &CSystemTrayIcon::setState);
	//connect(CXmlParse::Instance(), &CXmlParse::upgradeFinished, m_trayIcon, &CSystemTrayIcon::setState);

	//CHTTPDownloader* gHTTPDownload = new CHTTPDownloader(this);
	//gHTTPDownload->downloadFileSync(QString::fromLocal8Bit("http://127.0.0.1:8000/83001 - 副本.zip"), "D:\\test\\3.jpg", 0, true);

	//ClientLogger->AddLog(QString::fromLocal8Bit("客户端启动"));
	connect(m_pMessageEventMediator, &CMessageEventMediator::sigGetXml, this, &CSMonitorClient::setServerXmlUrl);

	//半小时申请一次
	m_reqXMLTimerId = startTimer(60000 * 30);

	SoftManager->Start();

	downloadUpdateXmlFromServer();
	downloadHelpInfoXmlFromServer();
	checkUpdate();
}