Exemplo n.º 1
0
void SkinWidget::initCenter()
{
    skin_list<<":/image/skin/0.png"<<":/image/skin/1.png"<<":/image/skin/2"<<":/image/skin/3"<<":/skin/4"<<
        ":/image/skin/5"<<":/image/skin/6"<<":/image/skin/7"<<":/image/skin/8";

	center_layout = new QGridLayout();
	center_layout->setSpacing(5);
	center_layout->setContentsMargins(5, 35, 5, 0);

	for(int i=0; i<8; i++)
	{
		ChangeSkinWidget *change_skin_widget = new ChangeSkinWidget();
		change_skin_list.append(change_skin_widget);
		connect(change_skin_widget, SIGNAL(changeSkin()), this, SLOT(varyfySkin()));
		center_layout->addWidget(change_skin_widget, i/4, i%4);
	}
	
	int skin_list_count = skin_list.size();
	page_count = skin_list_count / 8;
	page_count_point = skin_list_count % 8;
	if(page_count_point > 0)
	{
		page_count = page_count + 1;
	}
}
Exemplo n.º 2
0
void SkinsPlugIn::changeSkin(QAction* pSkinAction)
{
   if (pSkinAction != NULL)
   {
      changeSkin(pSkinAction->text());
   }
}
Exemplo n.º 3
0
void SkinWidget::varyfySkin(QString skin_name)
{
	this->skin_name = skin_name;
	is_change = true;
	update();
	emit changeSkin(skin_name);
}
Exemplo n.º 4
0
void FTitleBar::initConnect()
{
    connect(settingButton, SIGNAL(clicked()), settingButton, SLOT(showMenu()));
    connect(skinButton, SIGNAL(clicked()), this, SLOT(changeSkin()));
    connect(maxButton, SIGNAL(clicked()), this, SIGNAL(maximumed()));
    connect(minButton, SIGNAL(clicked()), this, SIGNAL(minimuned()));
    connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closed()));
    connect(maxButton, SIGNAL(clicked()), this, SLOT(switchMaxMin()));
}
Exemplo n.º 5
0
void XSkinItem::mousePressEvent(QMouseEvent * event)
{
	//只能是鼠标左键移动和改变大小
	if(event->button() == Qt::LeftButton) 
	{
		mouse_press = true;
		emit changeSkin(pixmap_name);
	}
}
Exemplo n.º 6
0
void SkinWidget::varyfySkin()
{
	QObject *object = QObject::sender();
    ChangeSkinWidget *change_skin_widget = qobject_cast<ChangeSkinWidget *>(object);
	skin_name = change_skin_widget->getPixmapName();

	this->skin_name = skin_name;
	is_change = true;
	update();
	emit changeSkin(skin_name);
}
Exemplo n.º 7
0
void mainWidget::showSkinWidget()
{
    skinWidget *skinW=new skinWidget(bkPicName);
    skinW->setAttribute(Qt::WA_DeleteOnClose);
    connect(skinW,SIGNAL(changeSkin(QString)),this,SLOT(setPicName(QString)));
    QPoint p=rect().topRight();
    p.setX(p.x()-150-350);
    p.setY(p.y()+30);
    skinW->move(this->mapToGlobal(p));
    skinW->show();
}
Exemplo n.º 8
0
void SkinWidget::initCenter()
{
	skin_list<<":/skin/0"<<":/skin/1"<<":/skin/2"<<":/skin/3"<<":/skin/4"<<
		":/skin/5"<<":/skin/6"<<":/skin/7"<<":/skin/8"<<":/skin/9"<<
		":/skin/10"<<":/skin/11"<<":/skin/12"<<":/skin/13"<<":/skin/14"<<
		":/skin/15"<<":/skin/16"<<":/skin/17"<<":/skin/18"<<":/skin/19"<<
		":/skin/20"<<":/skin/21"<<":/skin/22"<<":/skin/23";

	center_layout = new QGridLayout();
	center_layout->setSpacing(5);
	center_layout->setContentsMargins(5, 35, 5, 0);

	change_skin_widget_0 = new ChangeSkinWidget();
	change_skin_widget_1 = new ChangeSkinWidget();
	change_skin_widget_2 = new ChangeSkinWidget();
	change_skin_widget_3 = new ChangeSkinWidget();
	change_skin_widget_4 = new ChangeSkinWidget();
	change_skin_widget_5 = new ChangeSkinWidget();
	change_skin_widget_6 = new ChangeSkinWidget();
	change_skin_widget_7 = new ChangeSkinWidget();

	connect(change_skin_widget_0, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_1, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_2, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_3, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_4, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_5, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_6, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));
	connect(change_skin_widget_7, SIGNAL(changeSkin(QString)), this, SLOT(varyfySkin(QString)));

	center_layout->addWidget(change_skin_widget_0, 0, 0);
	center_layout->addWidget(change_skin_widget_1, 0, 1);
	center_layout->addWidget(change_skin_widget_2, 0, 2);
	center_layout->addWidget(change_skin_widget_3, 0, 3);
	center_layout->addWidget(change_skin_widget_4, 1, 0);
	center_layout->addWidget(change_skin_widget_5, 1, 1);
	center_layout->addWidget(change_skin_widget_6, 1, 2);
	center_layout->addWidget(change_skin_widget_7, 1, 3);

	int skin_list_count = skin_list.size();
	page_count = skin_list_count / 8;
	page_count_point = skin_list_count % 8;
	if(page_count_point > 0)
	{
		page_count = page_count + 1;
	}
}
Exemplo n.º 9
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);
	}
}
Exemplo n.º 10
0
Widget::Widget(QWidget *parent, Qt::WindowFlags flags)
    : QWidget(parent, flags)
{
    //设置窗体最小的尺寸
    setMinimumSize(1000, 650);
    //设置窗体图标
    setWindowIcon(QPixmap(":/images/winIcon_100.png"));

    //设置窗体标题
    setWindowTitle(tr("Haku"));

    //设置鼠标跟踪
    //setMouseTracking(true);

    //设置窗体标题栏,自定义,此时可以缩放,但不能移动,所以可能需要重新实现鼠标移动事件
    flags = Qt::CustomizeWindowHint;
    flags |= Qt::FramelessWindowHint; //无边框,会无法移动以及缩放
    //flags |= Qt::WindowStaysOnTopHint;
    setWindowFlags(flags);
    //setAttribute(Qt::WA_TranslucentBackground,true);

    //设置透明
    //setWindowOpacity(0);

    //设置皮肤
    //this->setAutoFillBackground(true);
    //QPalette mainPalette;
    //mainPalette.setBrush(QPalette::Background, QBrush(skinPic));
    //this->setPalette(mainPalette);
    setSkin(skinPic);

    //设置窗体的字体
    font = QFont("ZYSong18030", 14);
    setFont(font);

    /***************************************************************************/
    //创建主布局及三个子布局,并设置布局
    mainLayout = new QGridLayout(this);
    mainLayout->setSpacing(0);
    mainLayout->setMargin(0);
    firstLayout = new QHBoxLayout;
    secondLayout = new QHBoxLayout;
    threeLayout = new QHBoxLayout;
    mainLayout->addLayout(firstLayout, 0, 0, 1, 1);
    mainLayout->addLayout(secondLayout, 1, 0, 5, 1);
    mainLayout->addLayout(threeLayout, 6, 0, 1, 1);


    /***************************************************************************/
    //创建第一个子布局
    userImage = new QPushButton;
    userImage->setFlat(true);
    userImagePix = new QPixmap(":/images/haku_icon_40.png");
    userImage->setIcon(*userImagePix);
    userImage->setIconSize((*userImagePix).size());
    userImage->setToolTip(tr("更换头像"));

    userName = new QPushButton;
    userName->setFlat(true);
    userName->setText(tr("Haku520"));
    userName->setToolTip(tr("更改用户名"));

    searchEdit = new QLineEdit;
    searchBtn = new QPushButton;
    searchBtn->setFlat(true);
    searchBtn->setIcon(QPixmap(":/images/searchIcon.png"));
    searchBtn->setToolTip(tr("搜索歌曲"));
    //输入完毕或点击搜索按钮则搜索歌曲
    connect(searchEdit, SIGNAL(editingFinished()), this, SLOT(searchMusic()));
    connect(searchBtn, SIGNAL(clicked()), this, SLOT(searchMusic()));

    skinBtn = new QPushButton;
    skinBtn->setFlat(true);
    skinBtn->setIcon(QPixmap(":/images/skinIcon.png"));
    skinBtn->setToolTip(tr("更换皮肤"));
    //连接更换皮肤的槽函数
    connect(skinBtn, SIGNAL(clicked()), this, SLOT(changeSkin()));

    preferenceBtn = new QPushButton;
    preferenceBtn->setFlat(true);
    preferenceBtn->setIcon(QPixmap(":/images/preferenceIcon.png"));
    preferenceBtn->setToolTip(tr("设置"));

    controlBtn = new QPushButton;
    controlBtn->setFlat(true);
    controlBtn->setIcon(QPixmap(":/images/controlIcon.png"));
    controlBtn->setToolTip(tr("遥控器"));

    hideBtn = new QPushButton;
    hideBtn->setFlat(true);
    hideBtn->setIcon(QPixmap(":/images/hideIcon.png"));
    hideBtn->setToolTip(tr("隐藏音乐库"));

    minimumBtn = new QPushButton;
    minimumBtn->setFlat(true);
    minimumBtn->setIcon(QPixmap(":/images/minimumIcon.png"));
    minimumBtn->setToolTip(tr("最小化窗口"));

    closeBtn = new QPushButton;
    closeBtn->setFlat(true);
    closeBtn->setIcon(QPixmap(":/images/closeIcon.png"));
    closeBtn->setToolTip(tr("关闭"));

    //将各个按钮添加到第一个子布局上
    firstLayout->setMargin(0);
    firstLayout->addWidget(userImage);
    firstLayout->addWidget(userName);
    firstLayout->addStretch();
    firstLayout->addWidget(searchEdit);
    firstLayout->addWidget(searchBtn);
    firstLayout->addStretch();
    firstLayout->addWidget(skinBtn);
    firstLayout->addWidget(preferenceBtn);
    firstLayout->addWidget(controlBtn);
    firstLayout->addWidget(hideBtn);
    firstLayout->addWidget(minimumBtn);
    firstLayout->addWidget(closeBtn);

    //添加信号槽,暂时只实现退出按钮,其余的之后得补上!
    connect(closeBtn, SIGNAL(clicked()), this, SLOT(quitEmit()));
    connect(minimumBtn, SIGNAL(clicked()), this, SLOT(minWidget()));


    /***********************************************************************/
    //创建第二个子布局
    secFrameLayout = new SecFrame;
    secondLayout->addWidget(secFrameLayout);

    //接收从第二个子布局发送过来的可以播放的信号,对传递过来的这首歌曲进行播放控制
    connect(secFrameLayout, SIGNAL(SendToTop(SingleMusic *)),
            this, SLOT(PreplayOrpauseMusic(SingleMusic*)));

    //接收从主界面传递过来的搜索音乐的信号,让downloadDisplay窗体直接进行实际的搜索
    connect(this, SIGNAL(searchMusicString(QString)),
            secFrameLayout->downloadDisplay,
            SLOT(search(QString)));
    //试听音乐时,能够及时反映出播放按钮及进度条的显示
    //connect(secFrameLayout, SIGNAL(changeBtnIcon(bool)), this, SLOT(currentIsPlaying(bool)));

    connect(secFrameLayout, SIGNAL(closePrevMusic()), this, SLOT(closePreMusic()));

    /***********************************************************************/
    //创建第三个子布局
    playerBtn = new QPushButton;
    playerBtn->setFlat(true);
    playerBtn->setIcon(QPixmap(":/images/playerIcon.png"));
    playerBtn->setIconSize(QPixmap(":/images/playerIcon.png").size());
    //关联上歌曲的播放控制事件
    playBool = true;
    connect(playerBtn, SIGNAL(clicked()), this, SLOT(player()));

    preMusicBtn = new QPushButton;
    preMusicBtn->setFlat(true);
    preMusicBtn->setIcon(QPixmap(":/images/preMusicIcon.png"));
    preMusicBtn->setIconSize(QPixmap(":/images/preMusicIcon.png").size());
    //下面是测试用,之后用其正统的功能(即播放上一首歌曲)替换掉
    connect(preMusicBtn, SIGNAL(clicked()), this, SLOT(prevMusic()));

    nextMusicBtn = new QPushButton;
    nextMusicBtn->setFlat(true);
    nextMusicBtn->setIcon(QPixmap(":/images/nextMusicIcon.png"));
    nextMusicBtn->setIconSize(QPixmap(":/images/nextMusicIcon.png").size());

    loveMusicBtn = new QPushButton;
    loveMusicBtn->setFlat(true);
    loveMusicBtn->setIcon(QPixmap(":/images/loveIcon.png"));
    loveMusicBtn->setIconSize(QPixmap(":/images/loveIcon.png").size());
    loveMusicBtn->setToolTip(tr("收藏"));

    downloadBtn = new QPushButton;
    downloadBtn->setFlat(true);
    downloadBtn->setIcon(QPixmap(":/images/downloadIcon.png"));
    downloadBtn->setIconSize(QPixmap(":/images/downloadIcon.png").size());
    downloadBtn->setToolTip(tr("下载"));

    similarBtn = new QPushButton;
    similarBtn->setFlat(true);
    similarBtn->setIcon(QPixmap(":/images/similarIcon.png"));
    similarBtn->setIconSize(QPixmap(":/images/similarIcon.png").size());
    similarBtn->setToolTip(tr("相似歌曲"));

    orderBtn = new QPushButton;
    orderBtn->setFlat(true);
    orderBtn->setIcon(QPixmap(":/images/orderIcon.png"));
    orderBtn->setIconSize(QPixmap(":/images/orderIcon.png").size());
    orderBtn->setToolTip(tr("播放顺序"));

    volumeBtn = new QPushButton;
    volumeBtn->setFlat(true);
    volumeBtn->setIcon(QPixmap(":/images/volumeIcon.png"));
    volumeBtn->setIconSize(QPixmap(":/images/volumeIcon.png").size());
    volumeBtn->setToolTip(tr("音量"));

    soundEffectsBtn = new QPushButton;
    soundEffectsBtn->setFlat(true);
    soundEffectsBtn->setIcon(QPixmap(":/images/soundEffectsIcon.png"));
    soundEffectsBtn->setIconSize(QPixmap(":/images/soundEffectsIcon.png").size());
    soundEffectsBtn->setToolTip(tr("音效"));

    lyricBtn = new QPushButton;
    lyricBtn->setFlat(true);
    lyricBtn->setIcon(QPixmap(":/images/lyricIcon.png"));
    lyricBtn->setIconSize(QPixmap(":/images/lyricIcon.png").size());
    lyricBtn->setToolTip(tr("歌词"));

    playQueueBtn = new QPushButton;
    playQueueBtn->setFlat(true);
    playQueueBtn->setIcon(QPixmap(":/images/playQueueIcon.png"));
    playQueueBtn->setIconSize(QPixmap(":/images/playQueueIcon.png").size());
    playQueueBtn->setToolTip(tr("播放队列"));

    /*********************************进度条的定义**********************************/


    /********************************以上是进度条的定义*****************************/

    //将相关元素添加到第三个子布局上
    threeLayout->addSpacing(60);
    threeLayout->setMargin(0);
    threeLayout->addWidget(preMusicBtn);
    threeLayout->addWidget(playerBtn);
    threeLayout->addWidget(nextMusicBtn);
    threeLayout->addSpacing(3);

    //添加进度条
    createSlider();
    threeLayout->addWidget(sliderFrame);

    threeLayout->addSpacing(3);
    threeLayout->addWidget(loveMusicBtn);
    threeLayout->addWidget(downloadBtn);
    threeLayout->addWidget(similarBtn);
    threeLayout->addWidget(orderBtn);
    threeLayout->addWidget(volumeBtn);
    threeLayout->addWidget(soundEffectsBtn);
    threeLayout->addWidget(lyricBtn);
    threeLayout->addWidget(playQueueBtn);


}