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.
216 lines
5.8 KiB
216 lines
5.8 KiB
12 years ago
|
/***************************************************************************
|
||
|
* Copyright (C) 2003 by *
|
||
|
* Unai Garro <ugarro@users.sourceforge.net> *
|
||
|
* Cyril Bosselut (bosselut@b1project.com) *
|
||
|
* Jason Kivlighn (jkivlighn@gmail.com) *
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#ifndef KRECIPESVIEW_H
|
||
|
#define KRECIPESVIEW_H
|
||
|
|
||
7 months ago
|
#include <tqbitmap.h>
|
||
|
#include <tqbuttongroup.h>
|
||
|
#include <tqevent.h>
|
||
|
#include <tqlabel.h>
|
||
|
#include <tqpushbutton.h>
|
||
|
#include <tqtooltip.h>
|
||
|
#include <tqhbox.h>
|
||
|
#include <tqvaluelist.h>
|
||
|
#include <tqvbox.h>
|
||
|
#include <tqwidget.h>
|
||
|
#include <tqwidgetstack.h>
|
||
12 years ago
|
|
||
|
#include <kiconloader.h>
|
||
|
#include <kpixmap.h>
|
||
|
#include <kpixmapeffect.h>
|
||
|
#include <kimageeffect.h>
|
||
12 years ago
|
#include <tdeparts/part.h>
|
||
|
#include <tdestyle.h>
|
||
12 years ago
|
#include <ktextbrowser.h>
|
||
|
|
||
|
#include "importers/baseimporter.h"
|
||
|
#include "backends/recipedb.h"
|
||
|
#include "krecipesiface.h"
|
||
|
|
||
|
class AuthorsDialog;
|
||
|
class PrepMethodsDialog;
|
||
|
class CategoriesEditorDialog;
|
||
|
class DietWizardDialog;
|
||
|
class IngredientsDialog;
|
||
|
class Menu;
|
||
|
class KreMenu;
|
||
|
class KreMenuButton;
|
||
|
class IngredientMatcherDialog;
|
||
|
class PanelDeco;
|
||
|
class PropertiesDialog;
|
||
12 years ago
|
class TQPainter;
|
||
12 years ago
|
class RecipeInputDialog;
|
||
|
class RecipeViewDialog;
|
||
|
class SelectRecipeDialog;
|
||
|
class ShoppingListDialog;
|
||
|
class UnitsDialog;
|
||
12 years ago
|
typedef TQValueList <Menu>::Iterator MenuId;
|
||
12 years ago
|
|
||
|
|
||
|
/**
|
||
|
* This is the main view class for Krecipes. Most of the non-menu,
|
||
|
* non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
|
||
|
* here.
|
||
|
*
|
||
|
* This krecipes uses an HTML component as an example.
|
||
|
*
|
||
|
* @short Main view
|
||
|
* @author Unai Garro <ugarro@users.sourceforge.net>
|
||
|
* @version 0.4
|
||
|
*/
|
||
|
|
||
|
|
||
|
// Declarations
|
||
|
|
||
|
|
||
|
|
||
|
// Some constants
|
||
6 years ago
|
enum KrePanel {SelectP = 0, ShoppingP, DietP, MatcherP, IngredientsP, PropertiesP, UnitsP, PrepMethodsP, CategoriesP, AuthorsP, RecipeEdit, RecipeView };
|
||
12 years ago
|
|
||
|
|
||
|
// Class KrecipesView
|
||
12 years ago
|
class KrecipesView : public TQVBox, virtual public KrecipesIface
|
||
12 years ago
|
{
|
||
1 year ago
|
TQ_OBJECT
|
||
12 years ago
|
public:
|
||
|
/**
|
||
|
* Default constructor
|
||
|
*/
|
||
12 years ago
|
KrecipesView( TQWidget *parent );
|
||
12 years ago
|
|
||
|
/**
|
||
|
* Destructor
|
||
|
*/
|
||
|
virtual ~KrecipesView();
|
||
|
|
||
|
virtual DCOPRef currentDatabase() const;
|
||
|
RecipeDB *database;
|
||
|
|
||
|
/**
|
||
|
* Print this view to any medium -- paper or not
|
||
|
*/
|
||
|
void print();
|
||
|
|
||
|
virtual void show ( void ); //Needed to make sure that the raise() is done after the construction of all the widgets, otherwise childEvent in the PanelDeco is called only _after_ the raise(), and can't be shown.
|
||
|
|
||
|
signals:
|
||
|
/**
|
||
|
* Use this signal to change the content of the statusbar
|
||
|
*/
|
||
12 years ago
|
void signalChangeStatusbar( const TQString& text );
|
||
12 years ago
|
|
||
|
/**
|
||
|
* Use this signal to change the content of the caption
|
||
|
*/
|
||
12 years ago
|
void signalChangeCaption( const TQString& text );
|
||
12 years ago
|
|
||
|
void panelShown( KrePanel, bool );
|
||
|
|
||
|
|
||
|
public:
|
||
|
|
||
|
// public widgets
|
||
|
RecipeInputDialog *inputPanel;
|
||
|
RecipeViewDialog *viewPanel;
|
||
|
SelectRecipeDialog *selectPanel;
|
||
|
IngredientsDialog *ingredientsPanel;
|
||
|
PropertiesDialog *propertiesPanel;
|
||
|
UnitsDialog* unitsPanel;
|
||
|
ShoppingListDialog* shoppingListPanel;
|
||
|
DietWizardDialog* dietPanel;
|
||
|
CategoriesEditorDialog *categoriesPanel;
|
||
|
AuthorsDialog *authorsPanel;
|
||
|
PrepMethodsDialog *prepMethodsPanel;
|
||
|
IngredientMatcherDialog *ingredientMatcherPanel;
|
||
|
|
||
|
// public methods
|
||
|
void createNewRecipe( void );
|
||
|
void createNewElement( void );
|
||
|
|
||
12 years ago
|
void exportRecipes( const TQValueList<int> &ids );
|
||
12 years ago
|
|
||
|
private:
|
||
|
|
||
|
// Internal methods
|
||
12 years ago
|
TQString checkCorrectDBType( TDEConfig *config );
|
||
12 years ago
|
void initializeData( const TQString &host, const TQString &dbName, const TQString &user, const TQString &pass, int port );
|
||
12 years ago
|
void initDatabase( TDEConfig *config );
|
||
12 years ago
|
bool questionRerunWizard( const TQString &message, const TQString &error = "" );
|
||
|
void setupUserPermissions( const TQString &host, const TQString &client, const TQString &dbName, const TQString &newUser, const TQString &newPass, const TQString &adminUser = TQString::null, const TQString &adminPass = TQString::null, int port = 0 );
|
||
12 years ago
|
void wizard( bool force = false );
|
||
|
|
||
|
|
||
|
|
||
|
// Widgets
|
||
12 years ago
|
TQHBox *splitter;
|
||
12 years ago
|
KreMenu *leftPanel;
|
||
|
MenuId dataMenu;
|
||
|
PanelDeco *rightPanel;
|
||
12 years ago
|
TQPtrList<KreMenuButton> *buttonsList;
|
||
12 years ago
|
KreMenuButton *button0;
|
||
|
KreMenuButton *button1;
|
||
|
KreMenuButton *button2;
|
||
|
KreMenuButton *button3;
|
||
|
KreMenuButton *button4;
|
||
|
KreMenuButton *button5;
|
||
|
KreMenuButton *button6;
|
||
|
KreMenuButton *button7;
|
||
|
KreMenuButton *button8;
|
||
|
KreMenuButton *button9;
|
||
12 years ago
|
TQPushButton* contextButton;
|
||
12 years ago
|
|
||
|
KreMenuButton *recipeButton;
|
||
12 years ago
|
TQWidget *recipeWidget;
|
||
12 years ago
|
|
||
|
// Internal variables
|
||
12 years ago
|
TQString dbType;
|
||
12 years ago
|
KrePanel m_activePanel;
|
||
|
|
||
12 years ago
|
TQMap<TQWidget*, KrePanel> panelMap;
|
||
12 years ago
|
|
||
|
// i18n
|
||
|
void translate();
|
||
|
|
||
|
|
||
|
signals:
|
||
|
void enableSaveOption( bool en );
|
||
|
void recipeSelected( bool );
|
||
|
|
||
|
public slots:
|
||
|
bool save( void );
|
||
|
void exportRecipe();
|
||
|
void exportToClipboard();
|
||
|
void reloadDisplay();
|
||
|
virtual void reload();
|
||
|
void activateContextHelp();
|
||
|
|
||
|
private slots:
|
||
|
void actionRecipe( int recipeID, int action );
|
||
12 years ago
|
void actionRecipes( const TQValueList<int> &ids, int action );
|
||
|
void addRecipeButton( TQWidget *w, const TQString &title );
|
||
12 years ago
|
void closeRecipe( void );
|
||
|
void showRecipe( int recipeID );
|
||
12 years ago
|
void showRecipes( const TQValueList<int> &recipeIDs );
|
||
|
void slotSetTitle( const TQString& title );
|
||
12 years ago
|
void slotSetPanel( KrePanel );
|
||
|
void switchToRecipe( void );
|
||
|
void createShoppingListFromDiet( void );
|
||
|
void moveTipButton( int, int );
|
||
|
void resizeRightPane( int lpw, int lph );
|
||
12 years ago
|
void panelRaised( TQWidget *w, TQWidget *old_w );
|
||
12 years ago
|
void editRecipe();
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif // KRECIPESVIEW_H
|