summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/game/GameController.cpp8
-rw-r--r--src/gui/game/GameController.h2
-rw-r--r--src/gui/preview/PreviewController.cpp9
-rw-r--r--src/gui/preview/PreviewController.h4
-rw-r--r--src/gui/preview/PreviewModel.cpp15
-rw-r--r--src/gui/search/SearchController.cpp13
-rw-r--r--src/gui/search/SearchController.h2
-rw-r--r--src/gui/search/SearchView.cpp4
8 files changed, 34 insertions, 23 deletions
diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp
index f4ad0b2..488d30a 100644
--- a/src/gui/game/GameController.cpp
+++ b/src/gui/game/GameController.cpp
@@ -588,7 +588,7 @@ bool GameController::MouseUp(int x, int y, unsigned button)
if (tempSaveID)
{
if ((*iter).text.c_str()[1] == 'c')
- OpenSavePreview(tempSaveID, 0);
+ OpenSavePreview(tempSaveID, 0, false);
else if ((*iter).text.c_str()[1] == 't')
{
char url[256];
@@ -1096,9 +1096,9 @@ void GameController::LoadSave(SaveInfo * save)
gameModel->SetSave(save);
}
-void GameController::OpenSavePreview(int saveID, int saveDate)
+void GameController::OpenSavePreview(int saveID, int saveDate, bool instant)
{
- activePreview = new PreviewController(saveID, saveDate, new SaveOpenCallback(this));
+ activePreview = new PreviewController(saveID, saveDate, instant, new SaveOpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView());
}
@@ -1106,7 +1106,7 @@ void GameController::OpenSavePreview()
{
if(gameModel->GetSave())
{
- activePreview = new PreviewController(gameModel->GetSave()->GetID(), new SaveOpenCallback(this));
+ activePreview = new PreviewController(gameModel->GetSave()->GetID(), false, new SaveOpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView());
}
}
diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h
index 88f426b..d723ccb 100644
--- a/src/gui/game/GameController.h
+++ b/src/gui/game/GameController.h
@@ -113,7 +113,7 @@ public:
void OpenLogin();
void OpenProfile();
void OpenTags();
- void OpenSavePreview(int saveID, int saveDate);
+ void OpenSavePreview(int saveID, int saveDate, bool instant);
void OpenSavePreview();
void OpenLocalSaveWindow(bool asCurrent);
void OpenLocalBrowse();
diff --git a/src/gui/preview/PreviewController.cpp b/src/gui/preview/PreviewController.cpp
index 3a7961a..f63c623 100644
--- a/src/gui/preview/PreviewController.cpp
+++ b/src/gui/preview/PreviewController.cpp
@@ -8,7 +8,7 @@
#include "gui/login/LoginController.h"
#include "Controller.h"
-PreviewController::PreviewController(int saveID, int saveDate, ControllerCallback * callback):
+PreviewController::PreviewController(int saveID, int saveDate, bool instant, ControllerCallback * callback):
HasExited(false),
saveId(saveID),
saveDate(saveDate),
@@ -18,6 +18,7 @@ PreviewController::PreviewController(int saveID, int saveDate, ControllerCallbac
previewView = new PreviewView();
previewModel->AddObserver(previewView);
previewView->AttachController(this);
+ previewModel->SetDoOpen(instant);
previewModel->UpdateSave(saveID, saveDate);
@@ -31,7 +32,7 @@ PreviewController::PreviewController(int saveID, int saveDate, ControllerCallbac
this->callback = callback;
}
-PreviewController::PreviewController(int saveID, ControllerCallback * callback):
+PreviewController::PreviewController(int saveID, bool instant, ControllerCallback * callback):
HasExited(false),
saveId(saveID),
saveDate(0),
@@ -164,7 +165,7 @@ void PreviewController::OpenInBrowser()
bool PreviewController::NextCommentPage()
{
- if(previewModel->GetCommentsPageNum() < previewModel->GetCommentsPageCount() && previewModel->GetCommentsLoaded())
+ if(previewModel->GetCommentsPageNum() < previewModel->GetCommentsPageCount() && previewModel->GetCommentsLoaded() && !previewModel->GetDoOpen())
{
previewModel->UpdateComments(previewModel->GetCommentsPageNum()+1);
return true;
@@ -174,7 +175,7 @@ bool PreviewController::NextCommentPage()
bool PreviewController::PrevCommentPage()
{
- if(previewModel->GetCommentsPageNum()>1 && previewModel->GetCommentsLoaded())
+ if(previewModel->GetCommentsPageNum() > 1 && previewModel->GetCommentsLoaded() && !previewModel->GetDoOpen())
{
previewModel->UpdateComments(previewModel->GetCommentsPageNum()-1);
return true;
diff --git a/src/gui/preview/PreviewController.h b/src/gui/preview/PreviewController.h
index c5a4306..223d846 100644
--- a/src/gui/preview/PreviewController.h
+++ b/src/gui/preview/PreviewController.h
@@ -22,8 +22,8 @@ public:
inline int SaveID() { return saveId; };
bool HasExited;
- PreviewController(int saveID, ControllerCallback * callback);
- PreviewController(int saveID, int saveDate, ControllerCallback * callback);
+ PreviewController(int saveID, bool instant, ControllerCallback * callback);
+ PreviewController(int saveID, int saveDate, bool instant, ControllerCallback * callback);
void Exit();
void DoOpen();
void OpenInBrowser();
diff --git a/src/gui/preview/PreviewModel.cpp b/src/gui/preview/PreviewModel.cpp
index 88b281b..6776445 100644
--- a/src/gui/preview/PreviewModel.cpp
+++ b/src/gui/preview/PreviewModel.cpp
@@ -139,13 +139,16 @@ void PreviewModel::UpdateSave(int saveID, int saveDate)
pthread_create(&updateSaveInfoThread, 0, &PreviewModel::updateSaveInfoT, updateSaveInfoInfo);
}
- if (!updateSaveCommentsInfo)
- updateSaveCommentsInfo = new threadInfo(saveID, commentsPageNumber);
- if (updateSaveCommentsInfo->threadFinished)
+ if (!GetDoOpen())
{
- commentsLoaded = false;
- updateSaveCommentsInfo->threadFinished = false;
- pthread_create(&updateSaveCommentsThread, 0, &PreviewModel::updateSaveCommentsT, updateSaveCommentsInfo);
+ if (!updateSaveCommentsInfo)
+ updateSaveCommentsInfo = new threadInfo(saveID, commentsPageNumber);
+ if (updateSaveCommentsInfo->threadFinished)
+ {
+ commentsLoaded = false;
+ updateSaveCommentsInfo->threadFinished = false;
+ pthread_create(&updateSaveCommentsThread, 0, &PreviewModel::updateSaveCommentsT, updateSaveCommentsInfo);
+ }
}
}
diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp
index 0a8ad9e..bd3e4d8 100644
--- a/src/gui/search/SearchController.cpp
+++ b/src/gui/search/SearchController.cpp
@@ -36,6 +36,7 @@ SearchController::SearchController(ControllerCallback * callback):
HasExited(false),
nextQueryTime(0.0f),
nextQueryDone(true),
+ instantOpen(false),
searchModel(NULL)
{
searchModel = new SearchModel();
@@ -46,9 +47,6 @@ SearchController::SearchController(ControllerCallback * callback):
searchModel->UpdateSaveList(1, "");
this->callback = callback;
-
- //Set up interface
- //windowPanel.AddChild();
}
SaveInfo * SearchController::GetLoadedSave()
@@ -180,13 +178,18 @@ void SearchController::Selected(int saveID, bool selected)
searchModel->DeselectSave(saveID);
}
+void SearchController::InstantOpen(bool instant)
+{
+ instantOpen = instant;
+}
+
void SearchController::OpenSave(int saveID)
{
if(activePreview)
delete activePreview;
Graphics * g = ui::Engine::Ref().g;
g->fillrect(XRES/3, YRES+MENUSIZE-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
- activePreview = new PreviewController(saveID, new OpenCallback(this));
+ activePreview = new PreviewController(saveID, instantOpen, new OpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView());
}
@@ -196,7 +199,7 @@ void SearchController::OpenSave(int saveID, int saveDate)
delete activePreview;
Graphics * g = ui::Engine::Ref().g;
g->fillrect(XRES/3, YRES+MENUSIZE-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
- activePreview = new PreviewController(saveID, saveDate, new OpenCallback(this));
+ activePreview = new PreviewController(saveID, saveDate, instantOpen, new OpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView());
}
diff --git a/src/gui/search/SearchController.h b/src/gui/search/SearchController.h
index 8d811ab..40e0b4a 100644
--- a/src/gui/search/SearchController.h
+++ b/src/gui/search/SearchController.h
@@ -21,6 +21,7 @@ private:
double nextQueryTime;
std::string nextQuery;
bool nextQueryDone;
+ bool instantOpen;
void removeSelectedC();
void unpublishSelectedC();
public:
@@ -37,6 +38,7 @@ public:
void ShowOwn(bool show);
void ShowFavourite(bool show);
void Selected(int saveID, bool selected);
+ void InstantOpen(bool instant);
void OpenSave(int saveID);
void OpenSave(int saveID, int saveDate);
void Update();
diff --git a/src/gui/search/SearchView.cpp b/src/gui/search/SearchView.cpp
index cfa1a3b..662e756 100644
--- a/src/gui/search/SearchView.cpp
+++ b/src/gui/search/SearchView.cpp
@@ -712,7 +712,9 @@ void SearchView::OnMouseWheel(int x, int y, int d)
}
void SearchView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
- if(key==KEY_ESCAPE)
+ if (key == KEY_ESCAPE)
c->Exit();
+ if (ctrl)
+ c->InstantOpen(ctrl);
}