[BeFree CVS] panel/src ChangeLog,1.2,1.3 Makefile.am,1.1.1.1,1.2 taskicon.cpp,1.1.1.1,1.2 taskwindow
Status: Planning
Brought to you by:
plfiorini
|
From: Pier L. F. <plf...@us...> - 2005-01-07 02:11:54
|
Update of /cvsroot/befree/panel/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25810 Modified Files: ChangeLog Makefile.am taskicon.cpp taskwindow.cpp taskwindow.h taskwindowview.cpp taskwindowview.h Log Message: Close task window Index: taskwindowview.h =================================================================== RCS file: /cvsroot/befree/panel/src/taskwindowview.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- taskwindowview.h 5 Jan 2005 19:15:01 -0000 1.1.1.1 +++ taskwindowview.h 7 Jan 2005 02:11:40 -0000 1.2 @@ -24,18 +24,25 @@ #include <QWidget> -class TaskWindow; +#include "taskwindow.h" + class QToolButton; class QLabel; class QHBoxLayout; class TaskWindowView : public QWidget { + Q_OBJECT + public: TaskWindowView(const TaskWindow &window); ~TaskWindowView(); +private slots: + void closeTaskWindow(); + private: + TaskWindow fTaskWindow; QToolButton *fClose; QLabel *fIcon; QLabel *fTitle; Index: taskwindowview.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/taskwindowview.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- taskwindowview.cpp 5 Jan 2005 22:47:56 -0000 1.1.1.1 +++ taskwindowview.cpp 7 Jan 2005 02:11:40 -0000 1.2 @@ -25,10 +25,12 @@ #include <QHBoxLayout> #include "taskwindowview.h" -#include "taskwindow.h" TaskWindowView::TaskWindowView(const TaskWindow &window) { + // Save task window object + fTaskWindow = TaskWindow(window); + // Scale icon down to small size QPixmap icon = window.icon().scale(16, 16); @@ -48,6 +50,10 @@ fLayout->addWidget(fClose); fLayout->addWidget(fIcon); fLayout->addWidget(fTitle); + + // Connect signals + connect(fClose, SIGNAL(clicked()), + this, SLOT(closeTaskWindow())); } TaskWindowView::~TaskWindowView() @@ -57,3 +63,8 @@ delete fTitle; delete fLayout; } + +void TaskWindowView::closeTaskWindow() +{ + fTaskWindow.close(); +} Index: taskwindow.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/taskwindow.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- taskwindow.cpp 5 Jan 2005 10:14:34 -0000 1.1.1.1 +++ taskwindow.cpp 7 Jan 2005 02:11:40 -0000 1.2 @@ -21,9 +21,33 @@ #include "taskwindow.h" +#ifdef Q_WS_X11 +# include <X11/Xlib.h> +#endif + +TaskWindow::TaskWindow() +{ +} + TaskWindow::TaskWindow(Task *parent, const QString &title, const QPixmap &icon) { fParent = parent; fTitle = title; fIcon = icon; } + +TaskWindow::TaskWindow(const TaskWindow &w) +{ + fParent = w.parent(); + fTitle = w.title(); + fIcon = w.icon(); + fId = w.id(); +} + +void TaskWindow::close() +{ +#ifdef Q_WS_X11 + // Close window + XDestroyWindow(qt_xdisplay(), fId); +#endif +} Index: Makefile.am =================================================================== RCS file: /cvsroot/befree/panel/src/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 5 Jan 2005 19:12:08 -0000 1.1.1.1 +++ Makefile.am 7 Jan 2005 02:11:40 -0000 1.2 @@ -21,6 +21,8 @@ bin_PROGRAMS = befree-panel +befree_panel_MOC = \ + moc_taskwindowview.cpp befree_panel_SOURCES = \ main.cpp \ task.cpp task.h \ @@ -30,5 +32,13 @@ tasklistwindow.cpp tasklistwindow.h \ taskwindowview.cpp taskwindowview.h \ x11panelwindow.cpp x11panelwindow.h \ - xutils.cpp xutils.h + xutils.cpp xutils.h \ + $(befree_panel_MOC) befree_panel_LDADD = $(NEPTUNE_LIBS) + +moc_%.cpp: %.h + $(MOC) -o $@ $< + +BUILT_SOURCES = $(befree_panel_MOC) + +CLEANFILES = $(BUILT_SOURCES) Index: ChangeLog =================================================================== RCS file: /cvsroot/befree/panel/src/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ChangeLog 6 Jan 2005 18:06:38 -0000 1.2 +++ ChangeLog 7 Jan 2005 02:11:40 -0000 1.3 @@ -1,3 +1,9 @@ +2005-01-07 Pier Luigi Fiorini <pie...@mo...> + + * taskwindow.cpp (TaskWindow::close): + * taskwindowview.cpp (TaskWindowView::closeTaskWindow): + Close task window. + 2005-01-06 Pier Luigi Fiorini <pie...@mo...> * panelwindow.cpp (PanelWindow::PanelWindow): Set palette instead of fill a Index: taskwindow.h =================================================================== RCS file: /cvsroot/befree/panel/src/taskwindow.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- taskwindow.h 5 Jan 2005 10:14:26 -0000 1.1.1.1 +++ taskwindow.h 7 Jan 2005 02:11:40 -0000 1.2 @@ -30,16 +30,26 @@ class TaskWindow { public: + TaskWindow(); TaskWindow(Task *parent, const QString &title, const QPixmap &icon); + TaskWindow(const TaskWindow &w); Task *parent() const; + Q_ULONG id() const; + void setId(Q_ULONG id); + QString title() const; + void setTitle(const QString &title); QPixmap icon() const; + void setIcon(const QPixmap &icon); + + void close(); private: Task *fParent; + Q_ULONG fId; QString fTitle; QPixmap fIcon; }; @@ -49,14 +59,34 @@ return fParent; } +inline Q_ULONG TaskWindow::id() const +{ + return fId; +} + +inline void TaskWindow::setId(Q_ULONG id) +{ + fId = id; +} + inline QString TaskWindow::title() const { return fTitle; } +inline void TaskWindow::setTitle(const QString &title) +{ + fTitle = title; +} + inline QPixmap TaskWindow::icon() const { return fIcon; } +inline void TaskWindow::setIcon(const QPixmap &icon) +{ + fIcon = icon; +} + #endif // TASKWINDOW_H Index: taskicon.cpp =================================================================== RCS file: /cvsroot/befree/panel/src/taskicon.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- taskicon.cpp 5 Jan 2005 22:44:51 -0000 1.1.1.1 +++ taskicon.cpp 7 Jan 2005 02:11:40 -0000 1.2 @@ -22,7 +22,6 @@ #include <QDesktopWidget> #include <QCursor> #include <QEvent> -#include <QStyle> #include <libneptune/bapplication.h> @@ -49,18 +48,12 @@ QPoint mouse = QCursor::pos(); QSize size = sizeHint() + contentsMarginSize(); QRect screen = BApplication::desktop()->screenGeometry(pos); - //const int parentHeight = ( parentWidget() ? parentWidget()->sizeHint().height() : 0 ); if (pos.x() + size.width() > screen.right()) pos.setX(mouse.x() - size.width()); - if (pos.y() + size.height() + 2 > screen.bottom()) - pos.setY(mouse.y() - size.height()); - if (pos.x() < screen.left()) pos.setX(mouse.x()); - if (pos.y() < screen.top()) - pos.setY(screen.top()); - //pos.setY((screen.height() - parentHeight) - size.height()); + pos.setY(pos.y() - rect().height()); // Show task list window fTaskList->move(pos); |