Added display of "NO PREVIEW" for modules not supporting such.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@873 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -68,7 +68,8 @@ PreviewView::PreviewView(BRect frame, const char *name)
|
|||||||
removeConfigView (false),
|
removeConfigView (false),
|
||||||
deleteSaver (false),
|
deleteSaver (false),
|
||||||
removePreviewArea (false),
|
removePreviewArea (false),
|
||||||
unloadAddon (false)
|
unloadAddon (false),
|
||||||
|
noPreview (false)
|
||||||
{
|
{
|
||||||
SetViewColor(216,216,216);
|
SetViewColor(216,216,216);
|
||||||
AddChild(previewArea=new BView (scale2(1,8,1,2,Bounds()),"sampleScreen",B_FOLLOW_NONE,B_WILL_DRAW));
|
AddChild(previewArea=new BView (scale2(1,8,1,2,Bounds()),"sampleScreen",B_FOLLOW_NONE,B_WILL_DRAW));
|
||||||
@@ -152,6 +153,7 @@ void PreviewView::LoadNewAddon(const char* addOnFilename)
|
|||||||
snooze( saver->TickSize() );
|
snooze( saver->TickSize() );
|
||||||
kill_thread( previewData.previewThreadId );
|
kill_thread( previewData.previewThreadId );
|
||||||
previewData.stopMe = false;
|
previewData.stopMe = false;
|
||||||
|
previewData.previewThreadId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t lastOpStatus;
|
status_t lastOpStatus;
|
||||||
@@ -186,6 +188,12 @@ void PreviewView::LoadNewAddon(const char* addOnFilename)
|
|||||||
removeConfigView = false;
|
removeConfigView = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noPreview)
|
||||||
|
{
|
||||||
|
noPreviewView->RemoveSelf();
|
||||||
|
delete noPreviewView;
|
||||||
|
}
|
||||||
|
|
||||||
if (removePreviewArea)
|
if (removePreviewArea)
|
||||||
{
|
{
|
||||||
previewArea->RemoveSelf();
|
previewArea->RemoveSelf();
|
||||||
@@ -240,9 +248,15 @@ void PreviewView::LoadNewAddon(const char* addOnFilename)
|
|||||||
|
|
||||||
lastOpStatus = saver->StartSaver(previewArea, true);
|
lastOpStatus = saver->StartSaver(previewArea, true);
|
||||||
if ( lastOpStatus != B_OK )
|
if ( lastOpStatus != B_OK )
|
||||||
|
{
|
||||||
std::cout << "StartSaver() said no go, returned " << lastOpStatus << '\n';
|
std::cout << "StartSaver() said no go, returned " << lastOpStatus << '\n';
|
||||||
else
|
noPreview = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
stopSaver = true;
|
stopSaver = true;
|
||||||
|
noPreview = false;
|
||||||
|
}
|
||||||
|
|
||||||
// make config view
|
// make config view
|
||||||
BRect configViewBounds = settingsBoxPtr->Bounds();
|
BRect configViewBounds = settingsBoxPtr->Bounds();
|
||||||
@@ -254,10 +268,21 @@ void PreviewView::LoadNewAddon(const char* addOnFilename)
|
|||||||
stopConfigView = true;
|
stopConfigView = true;
|
||||||
removeConfigView = true;
|
removeConfigView = true;
|
||||||
|
|
||||||
previewData.previewThreadId = spawn_thread( previewThread, "preview_thread", 50, NULL );
|
if ( noPreview )
|
||||||
resume_thread( previewData.previewThreadId );
|
{
|
||||||
|
noPreviewView = new BStringView(previewArea->Bounds(), "no_preview", "NO PREVIEW AVAILABLE");
|
||||||
removePreviewArea = true;
|
rgb_color white = { 255, 255, 255, 0};
|
||||||
|
noPreviewView->SetHighColor(white);
|
||||||
|
noPreviewView->SetAlignment(B_ALIGN_CENTER);
|
||||||
|
noPreviewView->Draw(previewArea->Bounds());
|
||||||
|
previewArea->AddChild(noPreviewView);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
previewData.previewThreadId = spawn_thread( previewThread, "preview_thread", 50, NULL );
|
||||||
|
resume_thread( previewData.previewThreadId );
|
||||||
|
removePreviewArea = true;
|
||||||
|
}
|
||||||
|
|
||||||
} // end PreviewView::LoadNewAddon()
|
} // end PreviewView::LoadNewAddon()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
class BScreenSaver;
|
class BScreenSaver;
|
||||||
|
|
||||||
@@ -31,6 +32,8 @@ private:
|
|||||||
bool deleteSaver;
|
bool deleteSaver;
|
||||||
bool removePreviewArea;
|
bool removePreviewArea;
|
||||||
bool unloadAddon;
|
bool unloadAddon;
|
||||||
|
bool noPreview;
|
||||||
|
BStringView *noPreviewView;
|
||||||
|
|
||||||
}; // end class PreviewView
|
}; // end class PreviewView
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user