Changeset View
Changeset View
Standalone View
Standalone View
sublime/container.cpp
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | |||||
130 | 130 | | |||
131 | bool sortViews(const View* const lhs, const View* const rhs) | 131 | bool sortViews(const View* const lhs, const View* const rhs) | ||
132 | { | 132 | { | ||
133 | return lhs->document()->title().compare(rhs->document()->title(), Qt::CaseInsensitive) < 0; | 133 | return lhs->document()->title().compare(rhs->document()->title(), Qt::CaseInsensitive) < 0; | ||
134 | } | 134 | } | ||
135 | 135 | | |||
136 | struct ContainerPrivate { | 136 | struct ContainerPrivate { | ||
137 | QBoxLayout* layout; | 137 | QBoxLayout* layout; | ||
138 | QHash<QWidget*, View*> viewForWidget; | 138 | QHash<QWidget*, View*> viewForWidget; | ||
kfunk: `nullptr` | |||||
139 | 139 | | |||
140 | ContainerTabBar *tabBar; | 140 | ContainerTabBar *tabBar; | ||
141 | QStackedWidget *stack; | 141 | QStackedWidget *stack; | ||
142 | KSqueezedTextLabel *fileNameCorner; | 142 | KSqueezedTextLabel *fileNameCorner; | ||
143 | QLabel *fileStatus; | 143 | QLabel *fileStatus; | ||
144 | KSqueezedTextLabel *statusCorner; | 144 | KSqueezedTextLabel *statusCorner; | ||
145 | QPointer<QWidget> leftCornerWidget; | 145 | QPointer<QWidget> leftCornerWidget; | ||
146 | QToolButton* documentListButton; | 146 | QToolButton* documentListButton; | ||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
211 | protected: | 211 | protected: | ||
212 | void paintEvent(QPaintEvent *ev) override | 212 | void paintEvent(QPaintEvent *ev) override | ||
213 | { | 213 | { | ||
214 | #ifndef Q_OS_OSX | 214 | #ifndef Q_OS_OSX | ||
215 | // getting the underlining right on OS X is tricky; omitting | 215 | // getting the underlining right on OS X is tricky; omitting | ||
216 | // the underlining attracts the eye less than not getting it | 216 | // the underlining attracts the eye less than not getting it | ||
217 | // exactly right. | 217 | // exactly right. | ||
218 | if (m_tabBar->isVisible() && m_tabBar->count() > 0) | 218 | if (m_tabBar->isVisible() && m_tabBar->count() > 0) | ||
219 | { | 219 | { | ||
kfunk: `nullptr` | |||||
220 | QStylePainter p(this); | 220 | QStylePainter p(this); | ||
221 | QStyleOptionTabBarBase optTabBase; | 221 | QStyleOptionTabBarBase optTabBase; | ||
222 | optTabBase.init(m_tabBar); | 222 | optTabBase.init(m_tabBar); | ||
223 | optTabBase.shape = m_tabBar->shape(); | 223 | optTabBase.shape = m_tabBar->shape(); | ||
224 | optTabBase.tabBarRect = m_tabBar->rect(); | 224 | optTabBase.tabBarRect = m_tabBar->rect(); | ||
225 | optTabBase.tabBarRect.moveRight(0); | 225 | optTabBase.tabBarRect.moveRight(0); | ||
226 | 226 | | |||
227 | QStyleOptionTab tabOverlap; | 227 | QStyleOptionTab tabOverlap; | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 272 | { | |||
279 | d->layout = new QBoxLayout(QBoxLayout::LeftToRight); | 279 | d->layout = new QBoxLayout(QBoxLayout::LeftToRight); | ||
280 | d->layout->setMargin(0); | 280 | d->layout->setMargin(0); | ||
281 | d->layout->setSpacing(0); | 281 | d->layout->setSpacing(0); | ||
282 | 282 | | |||
283 | d->documentListMenu = new QMenu(this); | 283 | d->documentListMenu = new QMenu(this); | ||
284 | d->documentListButton = new QToolButton(this); | 284 | d->documentListButton = new QToolButton(this); | ||
285 | d->documentListButton->setIcon(QIcon::fromTheme(QStringLiteral("format-list-unordered"))); | 285 | d->documentListButton->setIcon(QIcon::fromTheme(QStringLiteral("format-list-unordered"))); | ||
286 | d->documentListButton->setMenu(d->documentListMenu); | 286 | d->documentListButton->setMenu(d->documentListMenu); | ||
287 | #ifdef Q_OS_MACOS | ||||
288 | d->documentListMenu->setAsDockMenu(); | ||||
289 | #endif | ||||
287 | d->documentListButton->setPopupMode(QToolButton::InstantPopup); | 290 | d->documentListButton->setPopupMode(QToolButton::InstantPopup); | ||
288 | d->documentListButton->setAutoRaise(true); | 291 | d->documentListButton->setAutoRaise(true); | ||
289 | d->documentListButton->setToolTip(i18n("Show sorted list of opened documents")); | 292 | d->documentListButton->setToolTip(i18n("Show sorted list of opened documents")); | ||
290 | d->documentListButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); | 293 | d->documentListButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); | ||
291 | d->layout->addWidget(d->documentListButton); | 294 | d->layout->addWidget(d->documentListButton); | ||
292 | d->tabBar = new ContainerTabBar(this); | 295 | d->tabBar = new ContainerTabBar(this); | ||
293 | d->tabBar->setContextMenuPolicy(Qt::CustomContextMenu); | 296 | d->tabBar->setContextMenuPolicy(Qt::CustomContextMenu); | ||
294 | d->layout->addWidget(d->tabBar); | 297 | d->layout->addWidget(d->tabBar); | ||
▲ Show 20 Lines • Show All 395 Lines • Show Last 20 Lines |
nullptr