Exemplo n.º 1
0
mainWidget::mainWidget(QWidget *parent)
    : QWidget(parent)
{
    resize(850,600);
    setWindowFlags(Qt::FramelessWindowHint);
    bkPicName=":/img/skin/oldWood.jpg";

    titleWidget *titleW=new titleWidget;
    connect(titleW,SIGNAL(showMax()),this,SLOT(showMax()));
    connect(titleW,SIGNAL(showMin()),this,SLOT(showMin()));
    connect(titleW,SIGNAL(showSkin()),this,SLOT(showSkinWidget()));

    toolWidget *toolW=new toolWidget;
    toolW->setFocus();
    contentWidget *contentW=new contentWidget;
    statusWidget *statusW=new statusWidget;

    QVBoxLayout *mainLayout=new QVBoxLayout;
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->addWidget(titleW);
    mainLayout->addWidget(toolW);
    mainLayout->addWidget(contentW);
    contentW->setContentsMargins(1,5,1,0);
    mainLayout->addWidget(statusW);

    setLayout(mainLayout);
}
Exemplo n.º 2
0
MainWidget::MainWidget(QWidget *parent)
    : DropShadowWidget(parent)
{
	initLocalConnection();
    setMinimumSize(900, 600);
	setWindowIcon(QIcon(":/img/safe"));

	statked_widget = new QStackedWidget();
    title_widget = new TitleWidget();
    content_widget = new ContentWidget();
	kill_mummy_widget = new KillMummyWidget();
	main_menu = new MainMenu();
	character_widget = new CharacterWidget();
	about_us_dialog = new AboutUsDialog(this);
	setting_dialog = new SettingDialog(this);
	login_dialog = new LoginDialog(this);
	register_widget = new RegisterWidget(this); 
	skin_widget = new SkinWidget(this);
	system_tray = new SystemTray(this);

	QPalette palette;
	palette.setBrush(QPalette::Window, QBrush(Qt::white));
    statked_widget->setPalette(palette);
    statked_widget->setAutoFillBackground(true);

	statked_widget->addWidget(content_widget);
	statked_widget->addWidget(kill_mummy_widget);

	QVBoxLayout *center_layout = new QVBoxLayout();
	center_layout->addWidget(statked_widget);
	center_layout->setSpacing(0);
	center_layout->setContentsMargins(0, 0, 0, 0);

    QVBoxLayout *main_layout = new QVBoxLayout();
    main_layout->addWidget(title_widget);
    main_layout->addLayout(center_layout);
	main_layout->setSpacing(0);
	main_layout->setContentsMargins(SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH);

    setLayout(main_layout);

	connect(title_widget, SIGNAL(showSkin()), this, SLOT(showSkinWidget()));
	connect(title_widget, SIGNAL(showMainMenu()), this, SLOT(showMainMenu()));
	connect(title_widget, SIGNAL(showMin()), this, SLOT(showMinimized()));
	connect(title_widget, SIGNAL(closeWidget()), this, SLOT(hide()));
	connect(title_widget, SIGNAL(turnPage(int)), this, SLOT(turnPage(int)));

	connect(main_menu, SIGNAL(showSettingDialog()), this, SLOT(showSettingDialog()));
	connect(main_menu, SIGNAL(showNewCharacter()), this, SLOT(showNewCharacter()));
	connect(main_menu, SIGNAL(showAboutUs()), this, SLOT(showAboutUs()));

	connect(content_widget, SIGNAL(showLoginDialog()), this, SLOT(showLoginDialog()));
	connect(content_widget, SIGNAL(showRegisterDialog()), this, SLOT(showRegisterDialog()));

	connect(setting_dialog, SIGNAL(changeLanguage(LANGUAGE)), this, SLOT(changeLanguage(LANGUAGE)));

	connect(skin_widget, SIGNAL(changeSkin(QString)), this, SLOT(changeSkin(QString)));

	connect(system_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason)));
	connect(system_tray, SIGNAL(showWidget()), this, SLOT(showWidget()));
	
	system_tray->show();

	title_widget->turnPage("0");

	skin_name = Util::getSkinName();
	if( QString::compare(skin_name, QString("")) == 0)
	{
		this->changeSkin(DEFAULT_SKIN);
	}
}