fix: wrong usage of shared pointer

pull/23/head
JuanJakobo 2020-11-05 10:54:19 +01:00
parent 18d219175d
commit b74d3bd8ee
3 changed files with 7 additions and 8 deletions

View File

@ -19,7 +19,7 @@
using std::string; using std::string;
using std::vector; using std::vector;
ListView::ListView(irect *contentRect, const vector<Item> *items) : _contentRect(contentRect), _items(items) ListView::ListView(irect *contentRect, const std::shared_ptr<vector<Item>> items) : _contentRect(contentRect), _items(items)
{ {
FillAreaRect(_contentRect, WHITE); FillAreaRect(_contentRect, WHITE);

View File

@ -29,7 +29,7 @@ public:
* @param ContentRect area of the screen where the list view is placed * @param ContentRect area of the screen where the list view is placed
* @param Items items that shall be shown in the listview * @param Items items that shall be shown in the listview
*/ */
ListView(irect *contentRect, const vector<Item> *items); ListView(irect *contentRect, const std::shared_ptr<vector<Item>> items);
/** /**
* Destructor * Destructor
@ -67,7 +67,7 @@ public:
private: private:
irect *_contentRect; irect *_contentRect;
const vector<Item> *_items; const std::shared_ptr<vector<Item>> _items = nullptr;
vector<ListViewEntry> _entries; vector<ListViewEntry> _entries;
std::unique_ptr<ifont> _titleFont; std::unique_ptr<ifont> _titleFont;
std::unique_ptr<ifont> _footerFont; std::unique_ptr<ifont> _footerFont;

View File

@ -48,7 +48,6 @@ public:
bool removeFile(int itemID); bool removeFile(int itemID);
/** /**
* gets the dataStructure of the given URL and writes its WEBDAV items to the items vector, reads Userdata from configfile * gets the dataStructure of the given URL and writes its WEBDAV items to the items vector, reads Userdata from configfile
* *
@ -61,9 +60,9 @@ public:
void setUsername(const string &Username); void setUsername(const string &Username);
void setPassword(const string &Pass); void setPassword(const string &Pass);
vector<Item> *getItems() { return _items.get(); }; std::shared_ptr<vector<Item>> getItems() const { return _items; };
bool isLoggedIn() { return _loggedIn; }; bool isLoggedIn() const { return _loggedIn; };
bool isWorkOffline() { return _workOffline; }; bool isWorkOffline() const { return _workOffline; };
void switchWorkOffline() { _workOffline = !_workOffline; }; void switchWorkOffline() { _workOffline = !_workOffline; };
static string getLocalPath(string path); static string getLocalPath(string path);
@ -71,7 +70,7 @@ public:
private: private:
static Nextcloud *nextcloudStatic; static Nextcloud *nextcloudStatic;
std::shared_ptr<vector<Item>> _items = nullptr; std::shared_ptr<vector<Item>> _items = nullptr;
bool _loggedIn{false}; bool _loggedIn{false};
string _url; string _url;
bool _workOffline{false}; bool _workOffline{false};