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