From 43e7113f7e02dd79b392e68d0ef8f8f775a896e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=94=80?= Date: Mon, 22 Aug 2016 21:07:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84=E9=80=80=E5=87=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=EF=BC=8C=E8=BF=98=E6=9C=89?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/bbs/LoginDialog.java | 2 +- .../design/mainframe/bbs/UserInfoLabel.java | 21 +++++++++++-------- .../src/com/fr/design/extra/LoginPane.java | 13 ++++++++++-- .../com/fr/design/extra/LoginWebBridge.java | 4 ++-- .../src/com/fr/design/extra/LoginWebPane.java | 2 +- .../com/fr/design/extra/QQLoginWebBridge.java | 8 ++++++- .../com/fr/design/extra/QQLoginWebPane.java | 2 +- .../extra/exe/GetLoginInfoExecutor.java | 4 ++-- 8 files changed, 37 insertions(+), 19 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java index 1d1926bf9..b5fe200ea 100644 --- a/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java +++ b/designer/src/com/fr/design/mainframe/bbs/LoginDialog.java @@ -15,7 +15,7 @@ import java.awt.*; * Created by zhaohehe on 16/7/26. */ public class LoginDialog extends UIDialog { - private static final Dimension DEFAULT_SHOP = new Dimension(404, 234); + private static final Dimension DEFAULT_SHOP = new Dimension(404, 204); public LoginDialog(Frame frame, BasicPane pane) { super(frame); diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index a2e0946c5..7be5f1fc2 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -54,7 +54,7 @@ public class UserInfoLabel extends UILabel{ private UserInfoPane userInfoPane; private BBSLoginDialog bbsLoginDialog; - + public UserInfoPane getUserInfoPane() { return userInfoPane; } @@ -101,9 +101,19 @@ public class UserInfoLabel extends UILabel{ LoginWebBridge.getHelper().setUILabel(UserInfoLabel.this); QQLoginWebBridge.getHelper().setLoginlabel(); qqdlg.setVisible(true); + clearLoingInformation(); + updateInfoPane(); } }); + } + private void clearLoingInformation(){ + DesignerEnvManager.getEnvManager().setBBSName(StringUtils.EMPTY); + DesignerEnvManager.getEnvManager().setBBSPassword(StringUtils.EMPTY); + } + + private void updateInfoPane(){ + userInfoPane.markUnSignIn(); } /** @@ -117,9 +127,7 @@ public class UserInfoLabel extends UILabel{ if(!FRContext.isChineseEnv()){ return; } - String lastBBSNewsTime = DesignerEnvManager.getEnvManager().getLastShowBBSNewsTime(); - try { String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); if (ComparatorUtils.equals(lastBBSNewsTime, today)) { @@ -129,25 +137,20 @@ public class UserInfoLabel extends UILabel{ } catch (InterruptedException e) { FRContext.getLogger().error(e.getMessage()); } - HttpClient hc = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); if (!hc.isServerAlive()){ return; } - String res = hc.getResponseText(); if (res.indexOf(BBSConstants.UPDATE_KEY) == -1){ return; } - try { BBSDialog bbsLabel = new BBSDialog(DesignerContext.getDesignerFrame()); bbsLabel.showWindow(SiteCenter.getInstance().acquireUrlByKind("bbs.popup")); DesignerEnvManager.getEnvManager().setLastShowBBSNewsTime(DateUtils.DATEFORMAT2.format(new Date())); } catch (Throwable e) { - } - } }); showBBSThread.start(); @@ -259,6 +262,7 @@ public class UserInfoLabel extends UILabel{ @Override public void mouseClicked(MouseEvent e) { + userName = DesignerEnvManager.getEnvManager().getBBSName(); if(StringUtils.isNotEmpty(userName)) { UIPopupMenu menu = new UIPopupMenu(); menu.setOnlyText(true); @@ -295,5 +299,4 @@ public class UserInfoLabel extends UILabel{ } } }; - } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/LoginPane.java b/designer_base/src/com/fr/design/extra/LoginPane.java index c8c231b24..41a2ce8ce 100644 --- a/designer_base/src/com/fr/design/extra/LoginPane.java +++ b/designer_base/src/com/fr/design/extra/LoginPane.java @@ -4,6 +4,7 @@ import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.frpane.UITabbedPane; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.general.Inter; @@ -53,6 +54,7 @@ public class LoginPane extends BasicPane { } } } else { + initTraditionalStore(); } } @@ -91,7 +93,6 @@ public class LoginPane extends BasicPane { @Override protected void done() { - try { if (get()) { IOUtils.unzip(new File(StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE)), StableUtils.getInstallHome()); @@ -112,7 +113,6 @@ public class LoginPane extends BasicPane { } catch (InterruptedException | ExecutionException e) { FRContext.getLogger().error(e.getMessage(), e); } - } }.execute(); } @@ -140,4 +140,13 @@ public class LoginPane extends BasicPane { } }.execute(); } + + private void initTraditionalStore() { + UITabbedPane tabbedPane = new UITabbedPane(); + add(tabbedPane, BorderLayout.CENTER); + PluginInstalledPane installedPane = new PluginInstalledPane(); + tabbedPane.addTab(installedPane.tabTitle(), installedPane); + tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_Update"), new PluginUpdatePane(tabbedPane)); + tabbedPane.addTab(Inter.getLocText("FR-Designer-Plugin_All_Plugins"), new PluginFromStorePane(tabbedPane)); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/LoginWebBridge.java b/designer_base/src/com/fr/design/extra/LoginWebBridge.java index 514967693..855ed447a 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/LoginWebBridge.java @@ -28,7 +28,7 @@ public class LoginWebBridge { private static final String LOGININ = "0"; private static final String LOGIN_INFO_EMPTY = "-1"; private static final String DISCONNECTED = "-2"; - private static final String UNKNOWN_ERROR = "-3"; + private static final String LOGININFO_ERROR = "-3"; private static final int TIME_OUT = 10000; private static com.fr.design.extra.LoginWebBridge helper; @@ -115,7 +115,7 @@ public class LoginWebBridge { loginSuccess(username); return LOGININ; }else { - return UNKNOWN_ERROR; + return LOGININFO_ERROR; } } diff --git a/designer_base/src/com/fr/design/extra/LoginWebPane.java b/designer_base/src/com/fr/design/extra/LoginWebPane.java index f31889c28..b49db6ace 100644 --- a/designer_base/src/com/fr/design/extra/LoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/LoginWebPane.java @@ -31,7 +31,7 @@ public class LoginWebPane extends JFXPanel { LoginWebPane.this.setScene(scene); WebView webView = new WebView(); webEngine = webView.getEngine(); - webEngine.load("file:///" + installHome + "/scripts/store/web/login.html"); + webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/login.html"); webEngine.setOnAlert(new EventHandler>() { @Override public void handle(WebEvent event) { diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index a038d56ce..f566d2e69 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -7,6 +7,8 @@ import javafx.scene.web.WebEngine; import org.json.JSONObject; import javax.swing.*; +import java.awt.*; +import java.net.URI; /** * Created by lp on 2016/8/10. @@ -17,6 +19,7 @@ public class QQLoginWebBridge { private WebEngine webEngine; private static String LOGINSUCCESS = "ok"; private static String LOGINFAILED = "failed"; + private static String BBS_URL = "http://bbs.fanruan.com"; private UIDialog uiDialog; private UILabel uiLabel; private UIDialog qqDialog; @@ -99,7 +102,10 @@ public class QQLoginWebBridge { DesignerEnvManager.getEnvManager().setBBSName(username); }else if (status.equals(LOGINFAILED)){ //账号没有QQ授权 - closeQQWindow(); + try { + Desktop.getDesktop().browse(new URI(BBS_URL)); + }catch (Exception exp) { + } } } } diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java index 9644f0666..229e92f12 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java @@ -29,7 +29,7 @@ public class QQLoginWebPane extends JFXPanel { QQLoginWebPane.this.setScene(scene); WebView webView = new WebView(); webEngine = webView.getEngine(); - webEngine.load("file:///" + installHome + "/scripts/store/web/qqLogin.html"); + webEngine.load("file:///" + installHome + "/scripts/qqLogin/web/qqLogin.html"); webEngine.setOnAlert(new EventHandler>() { @Override public void handle(WebEvent event) { diff --git a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java index 79fb20dce..52211c757 100644 --- a/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java +++ b/designer_base/src/com/fr/design/extra/exe/GetLoginInfoExecutor.java @@ -26,7 +26,7 @@ public class GetLoginInfoExecutor implements Executor { @Override public void run(Process process) { String username = DesignerEnvManager.getEnvManager().getBBSName(); - if (username == null) { + if (username == null || username.equals("")) { }else { result = username; } @@ -34,4 +34,4 @@ public class GetLoginInfoExecutor implements Executor { } }; } -} +} \ No newline at end of file