📄 systemoptionshell.java
字号:
quickTable.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if(e.detail == SWT.CHECK) {
TableItem ti = (TableItem)e.item;
if(ti.getChecked()) {
quickTable.getItem(replies.getCurrentQuickReply()).setChecked(false);
replies.setCurrentQuickReply(quickTable.indexOf(ti));
} else
ti.setChecked(true);
}
if(quickTable.getSelectionIndex() != -1) {
btnRemoveQuick.setEnabled(true);
textReply.setText(quickTable.getItem(quickTable.getSelectionIndex()).getText(0));
} else {
btnRemoveQuick.setEnabled(false);
}
}
}
);
// 在table中添加快捷回复项
TableColumn tc = new TableColumn(quickTable, SWT.LEFT);
tc.setWidth(200);
int size = replies.getQuickReplySize();
for(int i = 0; i < size; i++) {
TableItem ti = new TableItem(quickTable, SWT.NONE);
ti.setText(0, replies.getQuickReply(i));
}
// 把当前快捷回复打上勾
if(replies.getQuickReplySize() > 0)
quickTable.getItem(replies.getCurrentQuickReply()).setChecked(true);
// 添加按钮
btnAddQuick = new ShutterLabel(reply, MySWT.HOVER | SWT.CENTER, LumaQQ.getResourceString("sys.opt.message.button.add"), null);
btnAddQuick.setEnabled(false);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(25, -2);
fd.top = new FormAttachment(quickTable, 1, SWT.BOTTOM);
btnAddQuick.setLayoutData(fd);
btnAddQuick.addMouseListener(
new MouseAdapter() {
public void mouseUp(MouseEvent e) {
TableItem ti = new TableItem(quickTable, SWT.NONE);
ti.setText(0, textReply.getText());
replies.addQuickReply(ti.getText(0));
if(replies.getQuickReplySize() == 1)
ti.setChecked(true);
quickTable.showItem(ti);
}
}
);
// 删除按钮
btnRemoveQuick = new ShutterLabel(reply, MySWT.HOVER | SWT.CENTER, LumaQQ.getResourceString("sys.opt.message.button.remove"), null);
btnRemoveQuick.setEnabled(false);
fd = new FormData();
fd.left = new FormAttachment(25, 3);
fd.right = new FormAttachment(50, -5);
fd.top = new FormAttachment(quickTable, 1, SWT.BOTTOM);
btnRemoveQuick.setLayoutData(fd);
btnRemoveQuick.addMouseListener(
new MouseAdapter() {
public void mouseUp(MouseEvent e) {
TableItem ti = quickTable.getItem(quickTable.getSelectionIndex());
if(ti.getChecked()) {
replies.setCurrentQuickReply(0);
if(replies.getQuickReplySize() > 0)
quickTable.getItem(0).setChecked(true);
}
replies.removeQuickReply(quickTable.getSelectionIndex());
quickTable.remove(quickTable.getSelectionIndex());
btnRemoveQuick.setEnabled(false);
}
}
);
// 竖分隔条
Label separator = new Label(reply, SWT.SEPARATOR | SWT.VERTICAL);
separator.setBackground(panelBackground);
fd = new FormData();
fd.left = new FormAttachment(50, 0);
fd.right = new FormAttachment(50, 2);
fd.top = new FormAttachment(replyBanner, 5, SWT.BOTTOM);
fd.bottom = new FormAttachment(btnAddQuick, 0, SWT.BOTTOM);
separator.setLayoutData(fd);
// 自动回复标签
Label lblAuto = new Label(reply, SWT.NONE);
lblAuto.setBackground(panelBackground);
lblAuto.setText(LumaQQ.getResourceString("sys.opt.message.label.auto"));
fd = new FormData();
fd.left = new FormAttachment(50, 5);
fd.top = new FormAttachment(replyBanner, 5, SWT.BOTTOM);
lblAuto.setLayoutData(fd);
// 自动回复table
autoTable = new Table(reply, SWT.SINGLE | SWT.BORDER | SWT.CHECK | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
fd = new FormData();
fd.left = new FormAttachment(50, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(lblAuto, 3, SWT.BOTTOM);
fd.bottom = new FormAttachment(quickTable, 0, SWT.BOTTOM);
autoTable.setLayoutData(fd);
autoTable.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if(e.detail == SWT.CHECK) {
TableItem ti = (TableItem)e.item;
if(ti.getChecked()) {
autoTable.getItem(replies.getCurrentAutoReply()).setChecked(false);
replies.setCurrentAutoReply(autoTable.indexOf(ti));
} else
ti.setChecked(true);
}
if(autoTable.getSelectionIndex() != -1) {
btnRemoveAuto.setEnabled(true);
textReply.setText(autoTable.getItem(autoTable.getSelectionIndex()).getText(0));
} else {
btnRemoveAuto.setEnabled(false);
}
}
}
);
// 在table中添加自动回复项
tc = new TableColumn(autoTable, SWT.LEFT);
tc.setWidth(200);
size = replies.getAutoReplySize();
for(int i = 0; i < size; i++) {
TableItem ti = new TableItem(autoTable, SWT.NONE);
ti.setText(0, replies.getAutoReply(i));
}
// 把当前自动回复打上勾
if(replies.getAutoReplySize() > 0)
autoTable.getItem(replies.getCurrentAutoReply()).setChecked(true);
// 添加按钮
btnAddAuto = new ShutterLabel(reply, MySWT.HOVER | SWT.CENTER, LumaQQ.getResourceString("sys.opt.message.button.add"), null);
btnAddAuto.setEnabled(false);
fd = new FormData();
fd.left = new FormAttachment(50, 5);
fd.right = new FormAttachment(75, -2);
fd.top = new FormAttachment(autoTable, 1, SWT.BOTTOM);
btnAddAuto.setLayoutData(fd);
btnAddAuto.addMouseListener(
new MouseAdapter() {
public void mouseUp(MouseEvent e) {
TableItem ti = new TableItem(autoTable, SWT.NONE);
ti.setText(0, textReply.getText());
replies.addAutoReply(ti.getText(0));
if(replies.getAutoReplySize() == 1)
ti.setChecked(true);
autoTable.showItem(ti);
}
}
);
// 删除按钮
btnRemoveAuto = new ShutterLabel(reply, MySWT.HOVER | SWT.CENTER, LumaQQ.getResourceString("sys.opt.message.button.remove"), null);
btnRemoveAuto.setEnabled(false);
fd = new FormData();
fd.left = new FormAttachment(75, 3);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(autoTable, 1, SWT.BOTTOM);
btnRemoveAuto.setLayoutData(fd);
btnRemoveAuto.addMouseListener(
new MouseAdapter() {
public void mouseUp(MouseEvent e) {
TableItem ti = autoTable.getItem(autoTable.getSelectionIndex());
if(ti.getChecked()) {
replies.setCurrentAutoReply(0);
if(replies.getAutoReplySize() > 0)
autoTable.getItem(0).setChecked(true);
}
replies.removeAutoReply(autoTable.getSelectionIndex());
autoTable.remove(autoTable.getSelectionIndex());
btnRemoveAuto.setEnabled(false);
}
}
);
// 编辑文本框
textReply = new Text(reply, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.right = new FormAttachment(100, -5);
fd.top = new FormAttachment(btnAddQuick, 3, SWT.BOTTOM);
fd.bottom = new FormAttachment(100, -5);
textReply.setLayoutData(fd);
textReply.addModifyListener(
new ModifyListener() {
public void modifyText(ModifyEvent e) {
if(textReply.getText().equals("")) {
btnAddQuick.setEnabled(false);
btnAddAuto.setEnabled(false);
} else {
btnAddQuick.setEnabled(true);
btnAddAuto.setEnabled(true);
}
}
}
);
}
/**
* 初始化消息设置面板
*/
private void initMessagePanel() {
Composite message = createPanel();
message.setVisible(false);
composites[MESSAGE] = message;
// banner
Label messageBanner = new Label(message, SWT.NONE);
messageBanner.setBackground(bannerBackground);
messageBanner.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
FormData fd = new FormData();
fd.left = fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(0, 24);
messageBanner.setLayoutData(fd);
messageBanner.addPaintListener(new BannerPaintListener(LumaQQ.getResourceString("sys.opt.banner.message")));
// 自动弹出check box
chkAutoEject = new Button(message, SWT.CHECK);
chkAutoEject.setBackground(panelBackground);
chkAutoEject.setText(LumaQQ.getResourceString("sys.opt.message.auto.eject"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(messageBanner, 5, SWT.BOTTOM);
chkAutoEject.setLayoutData(fd);
// 拒绝陌生人消息check box
chkRejectStranger = new Button(message, SWT.CHECK);
chkRejectStranger.setBackground(panelBackground);
chkRejectStranger.setText(LumaQQ.getResourceString("sys.opt.message.reject.stranger"));
fd = new FormData();
fd.left = new FormAttachment(50, 5);
fd.top = new FormAttachment(messageBanner, 5, SWT.BOTTOM);
chkRejectStranger.setLayoutData(fd);
// 使能声音提示
chkEnableSound = new Button(message, SWT.CHECK);
chkEnableSound.setBackground(panelBackground);
chkEnableSound.setText(LumaQQ.getResourceString("sys.opt.message.enable.sound"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(messageBanner, 30, SWT.BOTTOM);
chkEnableSound.setLayoutData(fd);
// 初始化值
chkAutoEject.setSelection(options.isAutoEject());
chkRejectStranger.setSelection(options.isRejectStranger());
chkEnableSound.setSelection(options.isEnableSound());
}
/**
* 初始化界面设置面板
*/
private void initGUIPanel() {
Composite gui = createPanel();
prevComposite = gui;
composites[GUI] = gui;
// banner
Label guiBanner = new Label(gui, SWT.NONE);
guiBanner.setBackground(bannerBackground);
guiBanner.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
FormData fd = new FormData();
fd.left = fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(0, 24);
guiBanner.setLayoutData(fd);
guiBanner.addPaintListener(new BannerPaintListener(LumaQQ.getResourceString("sys.opt.banner.gui")));
// 最小化时隐藏的check box
chkAutoHide = new Button(gui, SWT.CHECK);
chkAutoHide.setBackground(panelBackground);
chkAutoHide.setText(LumaQQ.getResourceString("sys.opt.gui.auto.hide"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(guiBanner, 5, SWT.BOTTOM);
chkAutoHide.setLayoutData(fd);
// 是否显示提示的check box
chkShowTip = new Button(gui, SWT.CHECK);
chkShowTip.setBackground(panelBackground);
chkShowTip.setText(LumaQQ.getResourceString("sys.opt.gui.show.tip"));
fd = new FormData();
fd.left = new FormAttachment(50, 0);
fd.top = new FormAttachment(guiBanner, 5, SWT.BOTTOM);
chkShowTip.setLayoutData(fd);
// 是否显示好友上站通知
chkShowOnlineTip = new Button(gui, SWT.CHECK);
chkShowOnlineTip.setBackground(panelBackground);
chkShowOnlineTip.setText(LumaQQ.getResourceString("sys.opt.gui.show.online.tip"));
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(guiBanner, 30, SWT.BOTTOM);
chkShowOnlineTip.setLayoutData(fd);
// 是否显示消息提示
chkShowMessageTip = new Button(gui, SWT.CHECK);
chkShowMessageTip.setBackground(panelBackground);
chkShowMessageTip.setText(LumaQQ.getResourceString("sys.opt.gui.show.message.tip"));
fd = new FormData();
fd.left = new FormAttachment(50, 0);
fd.top = new FormAttachment(guiBanner, 30, SWT.BOTTOM);
chkShowMessageTip.setLayoutData(fd);
// 初始化值
chkAutoHide.setSelection(options.isAutoHide());
chkShowTip.setSelection(options.isShowTip());
chkShowOnlineTip.setSelection(options.isShowOnlineTip());
chkShowMessageTip.setSelection(options.isShowMessageTip());
}
/**
* 当用户点确定时,执行改方法
*/
private void doOk() {
saveChange();
options.save();
replies.save();
proxies.save();
main.renewAawyMenu();
close();
}
/**
* 初始化登陆设置面板
*/
private void initLoginPanel() {
Composite login = createPanel();
login.setVisible(false);
composites[LOGIN] = login;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -