From dec9376c2617d70881e8ee1385ab661d229f4174 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 11 Aug 2009 11:36:25 +0200 Subject: [PATCH] connect button callback --- bacula/src/qt-console/storage/content.cpp | 129 ++++++++++------------ bacula/src/qt-console/storage/content.h | 13 +-- bacula/src/qt-console/storage/content.ui | 26 ++++- 3 files changed, 88 insertions(+), 80 deletions(-) diff --git a/bacula/src/qt-console/storage/content.cpp b/bacula/src/qt-console/storage/content.cpp index 8c42aedd48..6b8c1a40d5 100644 --- a/bacula/src/qt-console/storage/content.cpp +++ b/bacula/src/qt-console/storage/content.cpp @@ -48,10 +48,68 @@ Content::Content(QString storage) m_closeable = true; m_currentStorage = storage; + connect(pbUpdate, SIGNAL(clicked()), this, + SLOT(consoleUpdateSlots())); + + connect(pbLabel, SIGNAL(clicked()), this, + SLOT(consoleLabelStorage())); + + connect(pbMount, SIGNAL(clicked()), this, + SLOT(consoleMountStorage())); + + connect(pbUnmount, SIGNAL(clicked()), this, + SLOT(consoleUnMountStorage())); + + connect(pbStatus, SIGNAL(clicked()), this, + SLOT(statusStorageWindow())); + + connect(pbRelease, SIGNAL(clicked()), this, + SLOT(consoleRelease())); + dockPage(); setCurrent(); } +/* Label Media populating current storage by default */ +void Content::consoleLabelStorage() +{ + new labelPage(m_currentStorage); +} + +/* Mount currently selected storage */ +void Content::consoleMountStorage() +{ + setConsoleCurrent(); + /* if this storage is an autochanger, lets ask for the slot */ + new mountDialog(m_console, m_currentStorage); +} + +/* Unmount Currently selected storage */ +void Content::consoleUnMountStorage() +{ + QString cmd("umount storage="); + cmd += m_currentStorage; + consoleCommand(cmd); +} + +void Content::statusStorageWindow() +{ + /* if one exists, then just set it current */ + bool found = false; + foreach(Pages *page, mainWin->m_pagehash) { + if (mainWin->currentConsole() == page->console()) { + if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) { + found = true; + page->setCurrent(); + } + } + } + if (!found) { + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + new StorStat(m_currentStorage, parentItem); + } +} + /* * The main meat of the class!! The function that querries the director and * creates the widgets with appropriate values. @@ -158,68 +216,20 @@ void Content::currentStackItem() } } -/* - * Functions to respond to local context sensitive menu sending console - * commands If I could figure out how to make these one function passing a - * string, Yaaaaaa - */ -void Content::consoleStatusStorage() -{ - QString cmd("status storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - -/* Label Media populating current storage by default */ -void Content::consoleLabelStorage() -{ - new labelPage(m_currentStorage); -} - void Content::treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *) { } -/* Mount currently selected storage */ -void Content::consoleMountStorage() -{ - if (m_currentAutoChanger == 0){ - /* no autochanger, just execute the command in the console */ - QString cmd("mount storage="); - cmd += m_currentStorage; - consoleCommand(cmd); - } else { - setConsoleCurrent(); - /* if this storage is an autochanger, lets ask for the slot */ - new mountDialog(m_console, m_currentStorage); - } -} - -/* Unmount Currently selected storage */ -void Content::consoleUnMountStorage() -{ - QString cmd("umount storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - /* Update Slots */ void Content::consoleUpdateSlots() { + // TODO: get selected slots QString cmd("update slots storage="); cmd += m_currentStorage; consoleCommand(cmd); } -/* Update Slots Scan*/ -void Content::consoleUpdateSlotsScan() -{ - QString cmd("update slots scan storage="); - cmd += m_currentStorage; - consoleCommand(cmd); -} - /* Release a tape in the drive */ void Content::consoleRelease() { @@ -227,24 +237,3 @@ void Content::consoleRelease() cmd += m_currentStorage; consoleCommand(cmd); } - -/* - * Open a status storage window - */ -void Content::statusStorageWindow() -{ - /* if one exists, then just set it current */ - bool found = false; - foreach(Pages *page, mainWin->m_pagehash) { - if (mainWin->currentConsole() == page->console()) { - if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) { - found = true; - page->setCurrent(); - } - } - } - if (!found) { - QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - new StorStat(m_currentStorage, parentItem); - } -} diff --git a/bacula/src/qt-console/storage/content.h b/bacula/src/qt-console/storage/content.h index a4abad4953..b4cf68bc75 100644 --- a/bacula/src/qt-console/storage/content.h +++ b/bacula/src/qt-console/storage/content.h @@ -41,17 +41,16 @@ public: Content(QString storage); // virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - void consoleUnMountStorage(); + +public slots: + void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); + + void consoleRelease(); void consoleUpdateSlots(); - void consoleUpdateSlotsScan(); void consoleLabelStorage(); - void consoleStatusStorage(); void consoleMountStorage(); void statusStorageWindow(); - void consoleRelease(); - -public slots: - void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); + void consoleUnMountStorage(); private slots: void populateContent(); diff --git a/bacula/src/qt-console/storage/content.ui b/bacula/src/qt-console/storage/content.ui index ad6c540f32..db53fe4834 100644 --- a/bacula/src/qt-console/storage/content.ui +++ b/bacula/src/qt-console/storage/content.ui @@ -36,7 +36,7 @@ - Update + Update slots :/images/view-refresh.png @@ -55,6 +55,9 @@ + + false + Move to tray @@ -65,6 +68,9 @@ + + false + Empty tray @@ -74,19 +80,33 @@ - + Mount - + Unmount + + + + Status + + + + + + + Release + + + -- 2.39.5