this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
this, SLOT(zoomOut()));
- connect(controller->dolphinView(), SIGNAL(showHiddenFilesChanged()),
- this, SLOT(slotShowHiddenFilesChanged()));
- connect(controller, SIGNAL(showPreviewChanged(bool)),
- this, SLOT(slotShowPreviewChanged(bool)));
connect(controller, SIGNAL(activationChanged(bool)),
this, SLOT(updateColumnsBackground(bool)));
+ const DolphinView* view = controller->dolphinView();
+ connect(view, SIGNAL(showHiddenFilesChanged()),
+ this, SLOT(slotShowHiddenFilesChanged()));
+ connect(view, SIGNAL(showPreviewChanged()),
+ this, SLOT(slotShowPreviewChanged()));
+
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(moveContentHorizontally(int)));
}
}
-void DolphinColumnView::slotShowPreviewChanged(bool show)
+void DolphinColumnView::slotShowPreviewChanged()
{
+ const bool show = m_controller->dolphinView()->showPreview();
foreach (DolphinColumnWidget* column, m_columns) {
column->setShowPreview(show);
}
void updateColumnsBackground(bool active);
void slotShowHiddenFilesChanged();
- void slotShowPreviewChanged(bool show);
+ void slotShowPreviewChanged();
private:
bool isZoomInPossible() const;
// TODO: same implementation as in DolphinView; create helper class
// for generatePreviews(), showPreview() and isCutItem()
- if (m_view->m_controller->showPreview()) {
+ if (m_view->m_controller->dolphinView()->showPreview()) {
KIO::PreviewJob* job = KIO::filePreview(items, 128);
connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)),
this, SLOT(showPreview(const KFileItem&, const QPixmap&)));
DolphinController::DolphinController(DolphinView* dolphinView) :
QObject(dolphinView),
- m_showPreview(false),
m_zoomInPossible(false),
m_zoomOutPossible(false),
m_url(),
emit additionalInfoChanged(info);
}
-void DolphinController::setShowPreview(bool show)
-{
- if (m_showPreview != show) {
- m_showPreview = show;
- emit showPreviewChanged(show);
- }
-}
-
void DolphinController::indicateActivationChange(bool active)
{
emit activationChanged(active);
*/
void indicateAdditionalInfoChange(const KFileItemDelegate::InformationList& info);
- /**
- * Informs the view implementation about a change of the show preview
- * state and is invoked by the abstract Dolphin view.
- * The signal showPreviewChanged() is emitted.
- */
- void setShowPreview(bool show);
- bool showPreview() const;
-
/**
* Informs the view implementation about a change of the activation
* state and is invoked by the abstract Dolphin view. The signal
*/
void additionalInfoChanged(const KFileItemDelegate::InformationList& info);
- /**
- * Is emitted if the state for showing previews has been
- * changed to \a show by the abstract Dolphin view.
- * The view implementation might connect to this signal if custom
- * updates are required in this case.
- */
- void showPreviewChanged(bool show);
-
/**
* Is emitted if the activation state has been changed to \a active
* by the abstract Dolphin view.
void zoomOut();
private:
- bool m_showPreview;
bool m_zoomInPossible;
bool m_zoomOutPossible;
KUrl m_url;
return m_url;
}
-inline bool DolphinController::showPreview() const
-{
- return m_showPreview;
-}
-
inline void DolphinController::setZoomInPossible(bool possible)
{
m_zoomInPossible = possible;
}
connect(this, SIGNAL(viewportEntered()),
controller, SLOT(emitViewportEntered()));
- connect(controller, SIGNAL(showPreviewChanged(bool)),
- this, SLOT(slotShowPreviewChanged(bool)));
- connect(controller->dolphinView(), SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
- this, SLOT(slotAdditionalInfoChanged(const KFileItemDelegate::InformationList&)));
connect(controller, SIGNAL(zoomIn()),
this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
this, SLOT(zoomOut()));
+ const DolphinView* view = controller->dolphinView();
+ connect(view, SIGNAL(showPreviewChanged()),
+ this, SLOT(slotShowPreviewChanged()));
+ connect(view, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
+ this, SLOT(slotAdditionalInfoChanged(const KFileItemDelegate::InformationList&)));
+
connect(this, SIGNAL(entered(const QModelIndex&)),
this, SLOT(slotEntered(const QModelIndex&)));
m_viewOptions.font = font;
setWordWrap(settings->numberOfTextlines() > 1);
- updateGridSize(controller->showPreview(), 0);
+ updateGridSize(view->showPreview(), 0);
if (settings->arrangement() == QListView::TopToBottom) {
setFlow(QListView::LeftToRight);
m_controller->emitItemEntered(itemForIndex(index));
}
-void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
+void DolphinIconsView::slotShowPreviewChanged()
{
- const int infoCount = m_controller->dolphinView()->additionalInfo().count();
- updateGridSize(showPreview, infoCount);
+ const DolphinView* view = m_controller->dolphinView();
+ const int infoCount = view->additionalInfo().count();
+ updateGridSize(view->showPreview(), infoCount);
}
void DolphinIconsView::slotAdditionalInfoChanged(const KFileItemDelegate::InformationList& info)
{
- updateGridSize(m_controller->showPreview(), info.count());
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ updateGridSize(showPreview, info.count());
}
void DolphinIconsView::zoomIn()
const int oldIconSize = settings->iconSize();
int newIconSize = oldIconSize;
- const bool showPreview = m_controller->showPreview();
+ const bool showPreview = m_controller->dolphinView()->showPreview();
if (showPreview) {
const int previewSize = increasedIconSize(settings->previewSize());
settings->setPreviewSize(previewSize);
const int oldIconSize = settings->iconSize();
int newIconSize = oldIconSize;
- const bool showPreview = m_controller->showPreview();
+ const bool showPreview = m_controller->dolphinView()->showPreview();
if (showPreview) {
const int previewSize = decreasedIconSize(settings->previewSize());
settings->setPreviewSize(previewSize);
bool DolphinIconsView::isZoomInPossible() const
{
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- const int size = m_controller->showPreview() ? settings->previewSize() : settings->iconSize();
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ const int size = showPreview ? settings->previewSize() : settings->iconSize();
return size < KIconLoader::SizeEnormous;
}
bool DolphinIconsView::isZoomOutPossible() const
{
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
- const int size = m_controller->showPreview() ? settings->previewSize() : settings->iconSize();
+ const bool showPreview = m_controller->dolphinView()->showPreview();
+ const int size = showPreview ? settings->previewSize() : settings->iconSize();
return size > KIconLoader::SizeSmall;
}
private slots:
void triggerItem(const QModelIndex& index);
void slotEntered(const QModelIndex& index);
- void slotShowPreviewChanged(bool show);
+ void slotShowPreviewChanged();
void slotAdditionalInfoChanged(const KFileItemDelegate::InformationList& info);
void zoomIn();
void zoomOut();
DolphinSortFilterProxyModel* proxyModel) :
QWidget(parent),
m_active(true),
+ m_showPreview(false),
m_loadingDirectory(false),
m_storedCategorizedSorting(false),
m_mode(DolphinView::IconsView),
void DolphinView::setShowPreview(bool show)
{
+ if (m_showPreview == show) {
+ return;
+ }
+
const KUrl viewPropsUrl = viewPropertiesUrl();
ViewProperties props(viewPropsUrl);
props.setShowPreview(show);
- m_controller->setShowPreview(show);
+ m_showPreview = show;
+
emit showPreviewChanged();
loadDirectory(viewPropsUrl, true);
bool DolphinView::showPreview() const
{
- return m_controller->showPreview();
+ return m_showPreview;
}
void DolphinView::setShowHiddenFiles(bool show)
void DolphinView::generatePreviews(const KFileItemList& items)
{
- if (m_controller->showPreview()) {
+ if (m_controller->dolphinView()->showPreview()) {
KIO::PreviewJob* job = KIO::filePreview(items, 128);
connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)),
this, SLOT(showPreview(const KFileItem&, const QPixmap&)));
}
const bool showPreview = props.showPreview();
- if (showPreview != m_controller->showPreview()) {
- m_controller->setShowPreview(showPreview);
+ if (showPreview != m_showPreview) {
+ m_showPreview = showPreview;
emit showPreviewChanged();
}
}
};
bool m_active;
+ bool m_showPreview;
bool m_loadingDirectory;
bool m_storedCategorizedSorting;
Mode m_mode;