Files
haiku-beta6/src/apps/haiku-depot/MainWindow.h
T
Rene Gollent d882cc2812 HaikuDepot: Move repo fetch to background worker thread.
- Factor out functions for refreshing the repositories and
  retrieving the package lists.

- Add a background worker thread which handles those tasks and
  then notifies the window when the model is ready.

- Check if we already have a repository cache, and if so, skip the
  refresh step, unless forced. The latter will eventually be possible
  via the UI.
2013-09-18 18:39:32 +02:00

63 lines
1.2 KiB
C++

/*
* Copyright 2013, Stephan Aßmus <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#include <Window.h>
#include "Model.h"
#include "PackageManager.h"
class BSplitView;
class FilterView;
class PackageActionsView;
class PackageInfoView;
class PackageListView;
enum {
MSG_MAIN_WINDOW_CLOSED = 'mwcl',
};
class MainWindow : public BWindow {
public:
MainWindow(BRect frame);
virtual ~MainWindow();
// BWindow interface
virtual bool QuitRequested();
virtual void MessageReceived(BMessage* message);
private:
void _BuildMenu(BMenuBar* menuBar);
void _AdoptModel();
void _AdoptPackage(const PackageInfoRef& package);
void _ClearPackage();
void _RefreshRepositories(bool force = false);
void _RefreshPackageList();
static status_t _RefreshModelThreadWorker(void* arg);
private:
FilterView* fFilterView;
PackageListView* fPackageListView;
PackageInfoView* fPackageInfoView;
BSplitView* fSplitView;
Model fModel;
PackageList fVisiblePackages;
PackageManager
fPackageManager;
bool fTerminating;
thread_id fModelWorker;
};
#endif // MAIN_WINDOW_H