📄 messagepage.java
字号:
/*
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma <stubma@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.tsinghua.lumaqq.ui.config.cluster;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import edu.tsinghua.lumaqq.Colors;
import edu.tsinghua.lumaqq.IconHolder;
import edu.tsinghua.lumaqq.LumaQQ;
import edu.tsinghua.lumaqq.models.ClusterModel;
import edu.tsinghua.lumaqq.models.IQQNode;
import edu.tsinghua.lumaqq.ui.config.AbstractPage;
import edu.tsinghua.lumaqq.ui.tool.UITool;
/**
* 消息设置页
*
* @author luma
*/
public class MessagePage extends AbstractPage {
private Button rdoAccept, rdoEject, rdoShowNumber, rdoRecord, rdoBlock;
private ClusterModel model;
/**
* @param parent
*/
public MessagePage(Composite parent, ClusterModel model) {
super(parent);
this.model = model;
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.ui.config.AbstractPage#createContent(org.eclipse.swt.widgets.Composite)
*/
protected Control createContent(Composite parent) {
Composite content = new Composite(parent, SWT.NONE);
content.setBackground(Colors.PAGE_BACKGROUND);
GridLayout layout = new GridLayout();
layout.marginHeight = layout.marginWidth = 15;
content.setLayout(layout);
// 设置使用缺省背景色
UITool.setDefaultBackground(null);
Group msgGroup = UITool.createGroup(content, LumaQQ.getString("cluster.info.message.group"), new GridData(GridData.FILL_HORIZONTAL), new GridLayout());
// 接收并提示消息
rdoAccept = UITool.createRadio(msgGroup, LumaQQ.getString("cluster.info.message.accept"));
// 自动弹出消息
rdoEject = UITool.createRadio(msgGroup, LumaQQ.getString("cluster.info.message.eject"));
// 消息来时只显示消息数目
rdoShowNumber = UITool.createRadio(msgGroup, LumaQQ.getString("cluster.info.message.show.number"));
// 接收但不提示消息(只保存在聊天记录中)
rdoRecord = UITool.createRadio(msgGroup, LumaQQ.getString("cluster.info.message.record"));
// 阻止一切该群的消息
rdoBlock = UITool.createRadio(msgGroup, LumaQQ.getString("cluster.info.message.block"));
return content;
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.ui.config.AbstractPage#saveDirtyProperty(int)
*/
protected void saveDirtyProperty(int propertyId) {
}
/**
* @return
* 消息设置
*/
private Object getMessageOption() {
if(rdoAccept.getSelection())
return IQQNode.VALUE_ACCEPT;
else if(rdoEject.getSelection())
return IQQNode.VALUE_EJECT;
else if(rdoShowNumber.getSelection())
return IQQNode.VALUE_SHOW_NUMBER;
else if(rdoRecord.getSelection())
return IQQNode.VALUE_RECORD;
else if(rdoBlock.getSelection())
return IQQNode.VALUE_BLOCK;
else
return IQQNode.VALUE_ACCEPT;
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.ui.config.AbstractPage#initializeValues()
*/
protected void initializeValues() {
rdoAccept.setSelection(false);
rdoEject.setSelection(false);
rdoRecord.setSelection(false);
rdoShowNumber.setSelection(false);
rdoBlock.setSelection(false);
String s = model.getMessageOption();
if(s == IQQNode.VALUE_EJECT)
rdoEject.setSelection(true);
else if(s == IQQNode.VALUE_RECORD)
rdoRecord.setSelection(true);
else if(s == IQQNode.VALUE_SHOW_NUMBER)
rdoShowNumber.setSelection(true);
else if(s == IQQNode.VALUE_BLOCK)
rdoBlock.setSelection(true);
else
rdoAccept.setSelection(true);
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.ui.config.AbstractPage#getImage()
*/
protected Image getImage() {
return IconHolder.getInstance().getImage(IconHolder.icoViewPersonInfo24);
}
/* (non-Javadoc)
* @see edu.tsinghua.lumaqq.ui.config.AbstractPage#getTitle()
*/
protected String getTitle(int page) {
return LumaQQ.getString("cluster.info.page.message");
}
/**
* 保存消息设置
*/
public void doSave() {
model.addProperty(IQQNode.MESSAGE, getMessageOption());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -