}
MAclWindow::MAclWindow(QWidget*par)
- :QMainWindow(par)
+ :MTabWin(req->profileId(),par)
{
- profilekey=req->profileId();
setAttribute(Qt::WA_DeleteOnClose);
- setWindowTitle(tr("MagicSmoke ACL Editor [%1@%2]") .arg(req->currentUser()) .arg(QSettings().value("profiles/"+profilekey+"/name").toString()));
+ setWindowTitle(tr("ACL Editor"));
rtimer.setInterval(QSettings().value("profiles/"+profilekey+"/refresh",300).toInt()*1000);
rtimer.start();
m->addAction(tr("&Close"),this,SLOT(close()));
//tabs
- setCentralWidget(tab=new QTabWidget);
//user tab
- tab->addTab(usertab=new MUserTab(profilekey),tr("Users"));
+ addTab(usertab=new MUserTab(profilekey),tr("Users"));
//role tab
- tab->addTab(roletab=new MRoleTab(profilekey),tr("Roles"));
+ addTab(roletab=new MRoleTab(profilekey),tr("Roles"));
//host tab
- tab->addTab(hosttab=new MHostTab(profilekey),tr("Hosts"));
+ addTab(hosttab=new MHostTab(profilekey),tr("Hosts"));
//flags tab
- tab->addTab(flagtab=new MFlagTab(profilekey),tr("Flags"));
-
- mb->addMenu(MApplication::helpMenu());
-
- //status bar
- statusBar()->setSizeGripEnabled(true);
+ addTab(flagtab=new MFlagTab(profilekey),tr("Flags"));
//unused tab disabling...
if(!req->hasRight(req->RGetAllUsers)){
- tab->setTabEnabled(tab->indexOf(usertab),false);
+ setTabEnabled(usertab,false);
}
if(!req->hasRight(req->RGetAllHosts)){
- tab->setTabEnabled(tab->indexOf(hosttab),false);
+ setTabEnabled(hosttab,false);
}
if(!req->hasRight(req->RGetAllRoles)){
- tab->setTabEnabled(tab->indexOf(roletab),false);
+ setTabEnabled(roletab,false);
}
}
#include <QPointer>
#include <QTimer>
+#include "tabwin.h"
+
class MUserTab;
class MHostTab;
class MRoleTab;
class MFlagTab;
-class MAclWindow:public QMainWindow
+class MAclWindow:public MTabWin
{
Q_OBJECT
public:
static QPointer<MAclWindow>instance;
- //the profile associated with this session
- QString profilekey;
//widgets
- QTabWidget*tab;
MUserTab*usertab;
MHostTab*hosttab;
MRoleTab*roletab;
m->addSeparator();
m->addAction(tr("Switch to Wizard..."),this,SLOT(wizardMode()));
m->addSeparator();
- m->addAction(tr("&Edit Templates..."),this,SLOT(editTemplates()));
- m->addAction(tr("&Update Templates Now"),req,SLOT(updateTemplates()));
- m->addSeparator();
m->addAction(tr("&Close Session"),this,SLOT(close()));
//menus not connected to any specific tab...
m=mb->addMenu(tr("&Actions"));
- m->addSeparator()->setText(tr("Customer"));
- m->addAction(tr("&Show all customers"),this,SLOT(customerMgmt()));
+ QMenu*m2=m->addMenu(tr("&Customer"));
+ m2->addAction(tr("&Show all customers"),this,SLOT(customerMgmt()));
- m->addSeparator()->setText(tr("Tickets/Vouchers"));
- m->addAction(tr("Return &ticket or voucher..."),this,SLOT(ticketReturn()))
+ m2=m->addMenu(tr("Tickets and &Vouchers"));
+ m2->addAction(tr("Return &ticket or voucher..."),this,SLOT(ticketReturn()))
->setEnabled(req->RReturnTicketVoucher);
- m->addSeparator();
- m->addAction(tr("&Deduct from voucher..."),this,SLOT(deductVoucher()));
- m->addAction(tr("&Empty voucher..."),this,SLOT(emptyVoucher()));
- m->addSeparator()->setText(tr("Shipping"));
+ m2->addSeparator();
+ m2->addAction(tr("&Deduct from voucher..."),this,SLOT(deductVoucher()));
+ m2->addAction(tr("&Empty voucher..."),this,SLOT(emptyVoucher()));
m->addAction(tr("Edit &Shipping Options..."),this,SLOT(editShipping()));
- m->addSeparator()->setText(tr("Configuration"));
- m->addAction(tr("&Auto-Refresh settings..."),this,SLOT(setRefresh()));
- m->addAction(tr("&Server Access settings..."),this,SLOT(webSettings()));
- m->addAction(tr("&Display settings..."),this,SLOT(displaySettings()));
+ m2=m->addMenu(tr("&Templates"));
+ m2->addAction(tr("&Edit Templates..."),this,SLOT(editTemplates()));
+ m2->addAction(tr("&Update Templates Now"),req,SLOT(updateTemplates()));
+
+ m2=m->addMenu(tr("C&onfiguration"));
+ m2->addAction(tr("&Auto-Refresh settings..."),this,SLOT(setRefresh()));
+ m2->addAction(tr("&Server Access settings..."),this,SLOT(webSettings()));
+ m2->addAction(tr("&Display settings..."),this,SLOT(displaySettings()));
- m->addSeparator()->setText(tr("Administration"));
- m->addAction(tr("&User Administration..."),this,SLOT(aclWindow()))
+ m2=m->addMenu(tr("&Administration"));
+ m2->addAction(tr("&User Administration..."),this,SLOT(aclWindow()))
->setEnabled(req->hasRight(req->RGetAllUsers) || req->hasRight(req->RGetAllHosts) || req->hasRight(req->RGetAllRoles));
- m->addSeparator();
- m->addAction(tr("Backup &Settings..."),this,SLOT(backupSettings()))
+ m2->addSeparator();
+ m2->addAction(tr("Backup &Settings..."),this,SLOT(backupSettings()))
->setEnabled(req->hasRight(req->RBackup));
- m->addAction(tr("&Backup now..."),this,SLOT(doBackup()))
+ m2->addAction(tr("&Backup now..."),this,SLOT(doBackup()))
->setEnabled(req->hasRight(req->RBackup));
//make sure webrequest knows its settings
{
profilekey=pk;
setAttribute(Qt::WA_DeleteOnClose);
- setWindowTitle("MagicSmoke: "+req->currentUser()+"@"+QSettings().value("profiles/"+pk+"/name").toString());
+ setWindowTitle(QString());
//menu
- QWidget*mmb=new QWidget;
+ QFrame*mmb=new QFrame;
setMenuWidget(mmb);
QHBoxLayout*hl;
mmb->setLayout(hl=new QHBoxLayout);
+ mmb->setBackgroundRole(QPalette::Button);
+ mmb->setFrameStyle(QFrame::StyledPanel|QFrame::Plain);
hl->setMargin(0);
+ hl->setContentsMargins(0,0,0,0);
hl->addWidget(leftmenu=new QMenuBar,0);
QFrame*frm;
hl->addWidget(frm=new QFrame,0);
frm->setFrameStyle(QFrame::VLine|QFrame::Sunken);
hl->addWidget(middlemenu=new QStackedWidget,1);
+ middlemenu->setContentsMargins(0,0,0,0);
hl->addWidget(frm=new QFrame,0);
frm->setFrameStyle(QFrame::VLine|QFrame::Sunken);
hl->addWidget(rightmenu=new QMenuBar,0);
rightmenu->addMenu(helpmenu=MApplication::helpMenu());
- nullmenu=middlemenu->addWidget(new QWidget);
+ QWidget*nm;
+ nullmenu=middlemenu->addWidget(nm=new QWidget);
+ nm->setBackgroundRole(QPalette::Button);
//tabs
setCentralWidget(tabw=new QTabWidget);
{
return helpmenu;
}
+
+void MTabWin::setWindowTitle(const QString& t)
+{
+ QString nt;
+ if(t=="")nt="MagicSmoke: ";
+ else nt="MagicSmoke "+t+": ";
+ QMainWindow::setWindowTitle(nt+ req->currentUser()+ "@"+ QSettings().value("profiles/"+ profilekey+ "/name").toString());
+}
+
///set the current tab
void setCurrentTab(QWidget*);
+ ///overrides QWidget::setWindowTitle(const QString&) - adds basic session info
+ void setWindowTitle(const QString&);
+
protected:
//the profile associated with this session
QString profilekey;