setupTopicWidget();
setupChatMonitor();
setupInputWidget();
+
+ QAction *toggleLockDocksAction = ui.menuViews->addAction(tr("Lock dock positions"));
+ toggleLockDocksAction->setCheckable(true);
+ connect(toggleLockDocksAction, SIGNAL(toggled(bool)), this, SLOT(lockVerticalDocks(bool)));
+ toggleLockDocksAction->setChecked(s.value("LockDocks", false).toBool());
+
setupStatusBar();
setupSystray();
dlg.exec();
}
+void MainWin::lockVerticalDocks(bool lock) {
+ QList<VerticalDock *> docks = findChildren<VerticalDock *>();
+ foreach(VerticalDock *dock, docks) {
+ dock->showTitle(!lock);
+ }
+ QtUiSettings().setValue("LockDocks", lock);
+}
+
void MainWin::setupNickWidget() {
// create nick dock
NickListDock *nickDock = new NickListDock(tr("Nicks"), this);
void showSettingsDlg();
void showNetworkDlg();
void showManageViewsDlg();
+ void lockVerticalDocks(bool lock);
void showAboutDlg();
void showDebugConsole();
{
}
-VerticalDockTitle::~VerticalDockTitle() {
-}
-
QSize VerticalDockTitle::sizeHint() const {
return QSize(10, 15);
}
void VerticalDockTitle::paintEvent(QPaintEvent *event) {
Q_UNUSED(event);
-
+
QPainter painter(this);
if(rect().isValid() && rect().height() > minimumSizeHint().height()) {
qDrawShadeLine(&painter, topLeft, bottomRight, palette());
}
}
-
+
}
+
// ==============================
// Vertical Dock
// ==============================
setDefaultTitleWidget();
}
-VerticalDock::~VerticalDock() {
-}
-
void VerticalDock::setDefaultTitleWidget() {
QWidget *oldDockTitle = titleBarWidget();
QWidget *newDockTitle = new VerticalDockTitle(this);
if(oldDockTitle)
oldDockTitle->deleteLater();
}
+
+void VerticalDock::showTitle(bool show) {
+ QWidget *oldDockTitle = titleBarWidget();
+ QWidget *newDockTitle = 0;
+
+ if(show)
+ newDockTitle = new VerticalDockTitle(this);
+ else
+ newDockTitle = new EmptyDockTitle(this);
+
+ setTitleBarWidget(newDockTitle);
+ if(oldDockTitle)
+ oldDockTitle->deleteLater();
+}
public:
VerticalDockTitle(QDockWidget *parent);
- virtual ~VerticalDockTitle();
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
+ void show(bool show_);
protected:
virtual void paintEvent(QPaintEvent *event);
+
+private:
+ bool _show;
+};
+
+class EmptyDockTitle : public QWidget {
+ Q_OBJECT
+
+public:
+ inline EmptyDockTitle(QDockWidget *parent) : QWidget(parent) {}
+
+ inline virtual QSize sizeHint() const { return QSize(0,0); }
};
+
class VerticalDock : public QDockWidget {
Q_OBJECT
public:
VerticalDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
VerticalDock(QWidget *parent = 0, Qt::WindowFlags flags = 0);
- virtual ~VerticalDock();
+ void showTitle(bool show);
void setDefaultTitleWidget();
};