diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-02-01 18:45:59 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-02-01 18:45:59 (GMT) |
| commit | 038da72c61ea6a251d805e2de3662f240da52b02 (patch) | |
| tree | 05170050b16f9d663ec44ae451211e686ba196ac /src/preview | |
| parent | 857b0cc1fc58f066acd59404d16ee5e566e20f00 (diff) | |
| download | powder-038da72c61ea6a251d805e2de3662f240da52b02.zip powder-038da72c61ea6a251d805e2de3662f240da52b02.tar.gz | |
Console UI, open in browser button, tab and enter shortcut for Login UI, various
Diffstat (limited to 'src/preview')
| -rw-r--r-- | src/preview/PreviewController.cpp | 11 | ||||
| -rw-r--r-- | src/preview/PreviewController.h | 1 | ||||
| -rw-r--r-- | src/preview/PreviewView.cpp | 18 | ||||
| -rw-r--r-- | src/preview/PreviewView.h | 1 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/preview/PreviewController.cpp b/src/preview/PreviewController.cpp index 558d705..558ccb4 100644 --- a/src/preview/PreviewController.cpp +++ b/src/preview/PreviewController.cpp @@ -5,6 +5,7 @@ * Author: Simon */ +#include <sstream> #include "PreviewController.h" #include "PreviewView.h" #include "PreviewModel.h" @@ -43,6 +44,16 @@ void PreviewController::DoOpen() previewModel->SetDoOpen(true); } +void PreviewController::OpenInBrowser() +{ + if(previewModel->GetSave()) + { + std::stringstream uriStream; + uriStream << "http://" << SERVER << "/Browse/View.html?ID=" << previewModel->GetSave()->id; + OpenURI(uriStream.str()); + } +} + void PreviewController::Exit() { if(ui::Engine::Ref().GetWindow() == previewView) diff --git a/src/preview/PreviewController.h b/src/preview/PreviewController.h index e9b0fb5..595a30f 100644 --- a/src/preview/PreviewController.h +++ b/src/preview/PreviewController.h @@ -24,6 +24,7 @@ public: PreviewController(int saveID, ControllerCallback * callback); void Exit(); void DoOpen(); + void OpenInBrowser(); bool GetDoOpen(); Save * GetSave(); PreviewView * GetView() { return previewView; } diff --git a/src/preview/PreviewView.cpp b/src/preview/PreviewView.cpp index 68a224b..3a731dc 100644 --- a/src/preview/PreviewView.cpp +++ b/src/preview/PreviewView.cpp @@ -25,12 +25,28 @@ PreviewView::PreviewView(): v->c->Exit(); } }; - openButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(75, 16), "Open"); + openButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(50, 16), "Open"); openButton->SetAlignment(AlignLeft, AlignMiddle); openButton->SetIcon(IconOpen); openButton->SetActionCallback(new OpenAction(this)); AddComponent(openButton); + class BrowserOpenAction: public ui::ButtonAction + { + PreviewView * v; + public: + BrowserOpenAction(PreviewView * v_){ v = v_; } + virtual void ActionCallback(ui::Button * sender) + { + v->c->OpenInBrowser(); + } + }; + browserOpenButton = new ui::Button(ui::Point((XRES/2)-90, Size.Y-16), ui::Point(90, 16), "Open in browser"); + browserOpenButton->SetAlignment(AlignLeft, AlignMiddle); + browserOpenButton->SetIcon(IconOpen); + browserOpenButton->SetActionCallback(new BrowserOpenAction(this)); + AddComponent(browserOpenButton); + saveNameLabel = new ui::Label(ui::Point(5, (YRES/2)+15), ui::Point(100, 16), ""); saveNameLabel->SetAlignment(AlignLeft, AlignBottom); AddComponent(saveNameLabel); diff --git a/src/preview/PreviewView.h b/src/preview/PreviewView.h index dbc3248..9368732 100644 --- a/src/preview/PreviewView.h +++ b/src/preview/PreviewView.h @@ -20,6 +20,7 @@ class PreviewView: public ui::Window { PreviewController * c; Thumbnail * savePreview; ui::Button * openButton; + ui::Button * browserOpenButton; ui::Label * saveNameLabel; ui::Label * authorDateLabel; int votesUp; |
