[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krusader] krusader/Panel: Panel: set default panel popup position to left side
From: Alexander Bikadorov <null () kde ! org>
Date: 2017-05-31 19:23:13
Message-ID: E1dG9D7-00015r-3F () code ! kde ! org
[Download RAW message or body]
Git commit 687d7fbdbe4bf68fdfc6d469ea0e554e981798ec by Alexander Bikadorov.
Committed on 31/05/2017 at 18:31.
Pushed by abikadorov into branch 'master'.
Panel: set default panel popup position to left side
I believe this is much more convenient for most layouts.
+ Code cleanup (including removable of setting splitter sizes twice).
M +7 -6 krusader/Panel/listpanel.cpp
M +5 -17 krusader/Panel/panelpopup.cpp
M +1 -10 krusader/Panel/panelpopup.h
https://commits.kde.org/krusader/687d7fbdbe4bf68fdfc6d469ea0e554e981798ec
diff --git a/krusader/Panel/listpanel.cpp b/krusader/Panel/listpanel.cpp
index ef0ebfbd..52893fb4 100644
--- a/krusader/Panel/listpanel.cpp
+++ b/krusader/Panel/listpanel.cpp
@@ -277,7 +277,7 @@ ListPanel::ListPanel(QWidget *parent, AbstractPanelManager \
*manager, KConfigGrou popupBtn = new QToolButton(this);
popupBtn->setAutoRaise(true);
popupBtn->setIcon(krLoader->loadIcon("arrow-up", KIconLoader::Toolbar, 16));
- connect(popupBtn, SIGNAL(clicked()), this, SLOT(togglePanelPopup()));
+ connect(popupBtn, &QToolButton::clicked, this, &ListPanel::togglePanelPopup);
popupBtn->setToolTip(i18n("Open the popup panel"));
ADD_WIDGET(popupBtn);
@@ -318,7 +318,7 @@ ListPanel::ListPanel(QWidget *parent, AbstractPanelManager \
*manager, KConfigGrou // create a splitter to hold the view and the popup
splt = new PercentalSplitter(clientArea);
splt->setChildrenCollapsible(true);
- splt->setOrientation(Qt::Vertical);
+ splt->setOrientation(Qt::Horizontal);
// expand vertical if splitter orientation is horizontal
QSizePolicy sizePolicy = splt->sizePolicy();
sizePolicy.setVerticalPolicy(QSizePolicy::Expanding);
@@ -555,15 +555,16 @@ bool ListPanel::eventFilter(QObject * watched, QEvent * e)
void ListPanel::togglePanelPopup()
{
if(!popup) {
- popup = new PanelPopup(splt, isLeft(), krApp);
+ popup = new PanelPopup(splt);
// fix vertical grow of splitter (and entire window) if its content
// demands more space
QSizePolicy sizePolicy = popup->sizePolicy();
sizePolicy.setVerticalPolicy(QSizePolicy::Ignored);
popup->setSizePolicy(sizePolicy);
- connect(this, SIGNAL(pathChanged(QUrl)), popup, \
SLOT(onPanelPathChange(QUrl)));
- connect(popup, SIGNAL(selection(QUrl)), SLOTS, SLOT(refresh(QUrl)));
- connect(popup, SIGNAL(hideMe()), this, SLOT(togglePanelPopup()));
+ connect(this, &ListPanel::pathChanged, popup, \
&PanelPopup::onPanelPathChange); + connect(popup, &PanelPopup::selection, \
SLOTS, &KRslots::refresh); + connect(popup, &PanelPopup::hideMe, this, \
&ListPanel::togglePanelPopup); + splt->insertWidget(0, popup);
}
if (popup->isHidden()) {
diff --git a/krusader/Panel/panelpopup.cpp b/krusader/Panel/panelpopup.cpp
index 9d43b583..dfce1c06 100644
--- a/krusader/Panel/panelpopup.cpp
+++ b/krusader/Panel/panelpopup.cpp
@@ -27,7 +27,6 @@
#include "viewactions.h"
#include "../defaults.h"
#include "../kicons.h"
-#include "../krmainwindow.h"
#include "../Dialogs/krsqueezedtextlabel.h"
#include "../FileSystem/fileitem.h"
#include "../FileSystem/filesystem.h"
@@ -45,16 +44,11 @@
#include <KI18n/KLocalizedString>
#include <KIconThemes/KIconLoader>
-
-PanelPopup::PanelPopup(QSplitter *parent, bool left, KrMainWindow *mainWindow) : \
QWidget(parent),
- _left(left), _hidden(true), _mainWindow(mainWindow), stack(0), \
imageFilePreview(0), pjob(0), splitterSizes() +PanelPopup::PanelPopup(QWidget \
*parent) : QWidget(parent), stack(0), imageFilePreview(0), pjob(0) {
- splitter = parent;
QGridLayout * layout = new QGridLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
- splitterSizes << 100 << 100;
-
// create the label+buttons setup
dataLine = new KrSqueezedTextLabel(this);
KConfigGroup lg(krConfig, "Look&Feel");
@@ -117,8 +111,8 @@ PanelPopup::PanelPopup(QSplitter *parent, bool left, KrMainWindow \
*mainWindow) : tree->setDirOnlyMode(true);
// NOTE: the F2 key press event is caught before it gets to the tree
tree->setEditTriggers(QAbstractItemView::EditKeyPressed);
- connect(tree, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(treeSelection()));
- connect(tree, SIGNAL(activated(QUrl)), this, SLOT(treeSelection()));
+ connect(tree, &KrFileTreeView::doubleClicked, this, &PanelPopup::treeSelection);
+ connect(tree, &KrFileTreeView::activated, this, &PanelPopup::treeSelection);
// create the quickview part ------
imageFilePreview = new KImageFilePreview(stack);
@@ -130,7 +124,7 @@ PanelPopup::PanelPopup(QSplitter *parent, bool left, KrMainWindow \
*mainWindow) : fileViewer = new PanelViewer(stack);
fileViewer->setProperty("KrusaderWidgetId", QVariant(View));
stack->addWidget(fileViewer);
- connect(fileViewer, SIGNAL(openUrlRequest(QUrl)), this, \
SLOT(handleOpenUrlRequest(QUrl))); + connect(fileViewer, \
&PanelViewer::openUrlRequest, this, &PanelPopup::handleOpenUrlRequest);
// create the disk usage view
@@ -138,7 +132,7 @@ PanelPopup::PanelPopup(QSplitter *parent, bool left, KrMainWindow \
*mainWindow) : diskusage->setStatusLabel(dataLine, i18n("Disk Usage:"));
diskusage->setProperty("KrusaderWidgetId", QVariant(DskUsage));
stack->addWidget(diskusage);
- connect(diskusage, SIGNAL(openUrlRequest(QUrl)), this, \
SLOT(handleOpenUrlRequest(QUrl))); + connect(diskusage, \
&DiskUsageViewer::openUrlRequest, this, &PanelPopup::handleOpenUrlRequest);
// -------- finish the layout (General one)
layout->addWidget(stack, 1, 0, 1, 5);
@@ -172,18 +166,12 @@ void PanelPopup::setCurrentPage(int id)
void PanelPopup::show()
{
QWidget::show();
- if (_hidden)
- splitter->setSizes(splitterSizes);
- _hidden = false;
tabSelected(currentPage());
}
void PanelPopup::hide()
{
- if (!_hidden)
- splitterSizes = splitter->sizes();
QWidget::hide();
- _hidden = true;
if (currentPage() == View) fileViewer->closeUrl();
if (currentPage() == DskUsage) diskusage->closeUrl();
}
diff --git a/krusader/Panel/panelpopup.h b/krusader/Panel/panelpopup.h
index 8810f234..51228297 100644
--- a/krusader/Panel/panelpopup.h
+++ b/krusader/Panel/panelpopup.h
@@ -22,15 +22,12 @@
// QtCore
#include <QPointer>
-// QtGui
// QtWidgets
#include <QButtonGroup>
-#include <QSplitter>
#include <QStackedWidget>
#include <QToolButton>
#include <QWidget>
-#include <KCompletion/KComboBox>
#include <KConfigCore/KConfigGroup>
#include <KIO/PreviewJob>
#include <KIOFileWidgets/KImageFilePreview>
@@ -40,7 +37,6 @@ class PanelViewer;
class DiskUsageViewer;
class KrFileTreeView;
class FileItem;
-class KrMainWindow;
/**
* Additional side widget showing various meta information for the current \
file/directories. @@ -63,7 +59,7 @@ class PanelPopup: public QWidget
};
public:
- PanelPopup(QSplitter *splitter, bool left, KrMainWindow *mainWindow);
+ explicit PanelPopup(QWidget *parent);
~PanelPopup();
inline int currentPage() const {
return stack->currentWidget()->property("KrusaderWidgetId").toInt();
@@ -90,9 +86,7 @@ protected slots:
protected:
virtual void focusInEvent(QFocusEvent*) Q_DECL_OVERRIDE;
- bool _left;
bool _hidden;
- KrMainWindow *_mainWindow;
QStackedWidget *stack;
KImageFilePreview *imageFilePreview;
KrSqueezedTextLabel *dataLine;
@@ -100,11 +94,8 @@ protected:
KrFileTreeView *tree;
QToolButton *treeBtn, *previewBtn, *viewerBtn, *duBtn;
QButtonGroup *btns;
- KComboBox *quickSelectCombo;
PanelViewer *fileViewer;
DiskUsageViewer *diskusage;
- QList<int> splitterSizes;
- QSplitter *splitter;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic