You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.2 KiB
131 lines
3.2 KiB
/* -*- C++ -*- */
|
|
#ifndef TESTUI_APP_H
|
|
#define TESTUI_APP_H
|
|
|
|
#include <tdemainwindow.h>
|
|
#include <tdeparts/part.h>
|
|
#include <tdeactionclasses.h>
|
|
#include <apt-front/cache/observer.h>
|
|
#include <apt-front/cache/component/state.h>
|
|
#include <apt-front/cache/component/history.h>
|
|
#include <apt-front/cache/component/desktop.h>
|
|
#include <adept/view.h>
|
|
#include <adept/commitprogress.h>
|
|
#include <adept/installerview.h>
|
|
#include <adept/application.h>
|
|
|
|
class TQVBox;
|
|
class TQWidgetStack;
|
|
class TQSplitter;
|
|
class TDEAction;
|
|
class KPushButton;
|
|
class TDEProcess;
|
|
namespace adept {
|
|
class AcqProgressWidget;
|
|
}
|
|
|
|
using namespace aptFront;
|
|
using namespace adept;
|
|
|
|
struct GroupPolicy : cache::component::Desktop::GroupPolicy {
|
|
virtual std::string groupForCategories( utils::Range< std::string > );
|
|
};
|
|
|
|
struct IconPolicy : GroupedDesktopSelector::IconPolicy {
|
|
virtual TQString iconForGroup( TQString );
|
|
};
|
|
|
|
class App : public TDEMainWindow, Application {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum State { Select, Preview, Inspect, Commit };
|
|
void setupActions();
|
|
ExtTerminalInterface *terminal();
|
|
App();
|
|
|
|
// check if the changes in cache are consistent with what is
|
|
// checked in the tree and we don't have any suspicious removals
|
|
// or other artifacts (broken packages)
|
|
bool consistent();
|
|
|
|
protected slots:
|
|
void start();
|
|
void commit();
|
|
void inspect();
|
|
|
|
void delayed();
|
|
|
|
void undo() { Application::undo(); }
|
|
void redo() { Application::redo(); }
|
|
void checkpoint() { Application::checkpoint(); }
|
|
|
|
void setHistoryEnabled( bool );
|
|
|
|
void disableNext();
|
|
void disableButtons();
|
|
void setNext( TQString str, const char *slot );
|
|
void togglePreview();
|
|
void editSources();
|
|
|
|
void request( cache::entity::Package, cache::component::State::Action );
|
|
|
|
bool confirmRequest( entity::Package, component::State::Action );
|
|
void requestOk() { m_currentRequestOk = true; }
|
|
|
|
protected:
|
|
friend class WaitForLister;
|
|
|
|
void setState( State s ) { m_lastState = m_state; m_state = s; }
|
|
|
|
virtual void notifyPreRebuild( cache::component::Base * );
|
|
virtual void notifyPostChange( cache::component::Base * );
|
|
virtual void notifyPreChange( cache::component::Base * );
|
|
|
|
TQWidgetStack *m_stack;
|
|
TQVBox *m_all;
|
|
TQHBox *m_buttons;
|
|
TQLabel *m_bye, *m_loading;
|
|
KPushButton *m_next, *m_quit;
|
|
KPushButton *m_editSources, *m_reviewChanges;
|
|
|
|
// stacked widgets
|
|
adept::AcqProgressWidget *m_progress;
|
|
adept::CommitProgress *m_commitProgress;
|
|
// adept::GroupedDesktopSelector *m_desktopSelector;
|
|
adept::InstallerView *m_view;
|
|
adept::Browser *m_preview;
|
|
|
|
// other stuff
|
|
std::vector<TDEAction *> m_actions;
|
|
TQMap< TQString, TQString > m_icons;
|
|
TDEAction *m_undo, *m_redo;
|
|
TDEToggleAction *m_previewAction;
|
|
State m_state, m_lastState;
|
|
|
|
typedef std::list< component::State::Request > RequestList;
|
|
RequestList m_requests;
|
|
|
|
// XXX hack
|
|
bool m_currentRequestOk;
|
|
};
|
|
|
|
class WaitForLister : public TQObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
WaitForLister( App *a, const char *s )
|
|
: app( a ), slot( s )
|
|
{
|
|
waiting();
|
|
}
|
|
protected slots:
|
|
void waiting();
|
|
protected:
|
|
App *app;
|
|
const char *slot;
|
|
|
|
};
|
|
|
|
#endif
|