xref: /haiku/src/apps/haikudepot/ui/RatePackageWindow.h (revision 6eafb4b041ad79cb936b2041fdb9c56b1209cc10)
1 /*
2  * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef RATE_PACKAGE_WINDOW_H
6 #define RATE_PACKAGE_WINDOW_H
7 
8 #include <Window.h>
9 
10 #include "Model.h"
11 #include "PackageInfo.h"
12 #include "TextDocument.h"
13 #include "TextEditor.h"
14 
15 
16 class BButton;
17 class BCheckBox;
18 class BMenuField;
19 class SetRatingView;
20 class TextDocumentView;
21 
22 
23 class RatePackageWindow : public BWindow {
24 public:
25 								RatePackageWindow(BWindow* parent, BRect frame,
26 									Model& model);
27 	virtual						~RatePackageWindow();
28 
29 	virtual	void				MessageReceived(BMessage* message);
30 
31 			void				SetPackage(const PackageInfoRef& package);
32 
33 private:
34 			void				_SendRating();
35 
36 			void				_SetWorkerThread(thread_id thread);
37 
38 	static	int32				_QueryRatingThreadEntry(void* data);
39 			void				_QueryRatingThread();
40 
41 	static	int32				_SendRatingThreadEntry(void* data);
42 			void				_SendRatingThread();
43 
44 private:
45 			Model&				fModel;
46 			TextDocumentRef		fRatingText;
47 			TextEditorRef		fTextEditor;
48 			float				fRating;
49 			BString				fStability;
50 			StabilityRatingList	fStabilityCodes;
51 			BString				fCommentLanguage;
52 			BString				fRatingID;
53 			bool				fRatingActive;
54 			PackageInfoRef		fPackage;
55 
56 			SetRatingView*		fSetRatingView;
57 			BMenuField*			fStabilityField;
58 			BMenuField*			fCommentLanguageField;
59 			TextDocumentView*	fTextView;
60 			BCheckBox*			fRatingActiveCheckBox;
61 			BButton*			fCancelButton;
62 			BButton*			fSendButton;
63 
64 			thread_id			fWorkerThread;
65 };
66 
67 
68 #endif // RATE_PACKAGE_WINDOW_H
69