MainStatusBar::MainStatusBar(QWidget *parent) : QStatusBar(parent) { QSplitter *splitter = new QSplitter(this); QString ready_msg(DEF_READY_MESSAGE); QWidget *info_progress = new QWidget(this); QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress); #if defined(Q_WS_WIN) // Handles are the same color as widgets, at least on Windows 7. splitter->setHandleWidth(3); splitter->setStyleSheet(QString( "QSplitter::handle {" " border-left: 1px solid palette(mid);" " border-right: 1px solid palette(mid);" "}" )); #elif defined(Q_WS_MAC) expert_status_.setAttribute(Qt::WA_MacSmallSize, true); #endif expert_status_.setTextFormat(Qt::RichText); expert_status_.hide(); // XXX Add the comment icon info_progress_hb->setContentsMargins(0, 0, 0, 0); info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY); info_progress_hb->addWidget(&expert_status_); info_progress_hb->addWidget(&info_status_); info_progress_hb->addWidget(&progress_bar_); info_progress_hb->addStretch(10); splitter->addWidget(info_progress); splitter->addWidget(&packet_status_); splitter->addWidget(&profile_status_); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 3); splitter->setStretchFactor(2, 1); addWidget(splitter, 1); cur_main_status_bar_ = this; splitter->hide(); info_status_.pushText(ready_msg, STATUS_CTX_MAIN); packets_bar_update(); connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show())); connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)), this, SLOT(toggleBackground(bool))); }
MainStatusBar::MainStatusBar(QWidget *parent) : QStatusBar(parent), cap_file_(NULL), edit_action_(NULL), delete_action_(NULL) { QSplitter *splitter = new QSplitter(this); #ifdef HAVE_LIBPCAP QString ready_msg(tr("Ready to load or capture")); #else QString ready_msg(tr("Ready to load file")); #endif QWidget *info_progress = new QWidget(this); QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress); QAction *action; #if defined(Q_OS_WIN) // Handles are the same color as widgets, at least on Windows 7. splitter->setHandleWidth(3); splitter->setStyleSheet(QString( "QSplitter::handle {" " border-left: 1px solid palette(mid);" " border-right: 1px solid palette(mid);" "}" )); #elif defined(Q_OS_MAC) expert_status_.setAttribute(Qt::WA_MacSmallSize, true); #endif expert_status_.setTextFormat(Qt::RichText); expert_status_.hide(); // XXX Add the comment icon info_progress_hb->setContentsMargins(0, 0, 0, 0); info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY); info_progress_hb->addWidget(&expert_status_); info_progress_hb->addWidget(&info_status_); info_progress_hb->addWidget(&progress_bar_); info_progress_hb->addStretch(10); splitter->addWidget(info_progress); splitter->addWidget(&packet_status_); splitter->addWidget(&profile_status_); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 3); splitter->setStretchFactor(2, 1); addWidget(splitter, 1); cur_main_status_bar_ = this; splitter->hide(); info_status_.pushText(ready_msg, STATUS_CTX_MAIN); packets_bar_update(); action = ctx_menu_.addAction(tr("Manage Profiles...")); action->setData(ProfileDialog::ShowProfiles); connect(action, SIGNAL(triggered()), this, SLOT(manageProfile())); ctx_menu_.addSeparator(); action = ctx_menu_.addAction(tr("New...")); action->setData(ProfileDialog::NewProfile); connect(action, SIGNAL(triggered()), this, SLOT(manageProfile())); edit_action_ = ctx_menu_.addAction(tr("Edit...")); edit_action_->setData(ProfileDialog::EditCurrentProfile); connect(edit_action_, SIGNAL(triggered()), this, SLOT(manageProfile())); delete_action_ = ctx_menu_.addAction(tr("Delete")); delete_action_->setData(ProfileDialog::DeleteCurrentProfile); connect(delete_action_, SIGNAL(triggered()), this, SLOT(manageProfile())); ctx_menu_.addSeparator(); profile_menu_.setTitle(tr("Switch to")); ctx_menu_.addMenu(&profile_menu_); connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName())); connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)), this, SLOT(toggleBackground(bool))); connect(wsApp, SIGNAL(captureCaptureUpdateContinue(capture_session*)), this, SLOT(updateCaptureStatistics(capture_session*))); connect(wsApp, SIGNAL(configurationProfileChanged(const gchar *)), this, SLOT(pushProfileName())); connect(&profile_status_, SIGNAL(mousePressedAt(QPoint,Qt::MouseButton)), this, SLOT(showProfileMenu(QPoint,Qt::MouseButton))); }
MainStatusBar::MainStatusBar(QWidget *parent) : QStatusBar(parent), cap_file_(NULL), edit_action_(NULL), delete_action_(NULL) { QSplitter *splitter = new QSplitter(this); #ifdef HAVE_LIBPCAP QString ready_msg(tr("Ready to load or capture")); #else QString ready_msg(tr("Ready to load file")); #endif QWidget *info_progress = new QWidget(this); QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress); QAction *action; #if defined(Q_OS_WIN) // Handles are the same color as widgets, at least on Windows 7. splitter->setHandleWidth(3); splitter->setStyleSheet(QString( "QSplitter::handle {" " border-left: 1px solid palette(mid);" " border-right: 1px solid palette(mid);" "}" )); #endif QString button_ss = "QToolButton {" " border: none;" " background: transparent;" // Disables platform style on Windows. " padding: 0px;" " margin: 0px;" "}"; expert_button_ = new QToolButton(this); expert_button_->setIconSize(QSize(icon_size, icon_size)); expert_button_->setStyleSheet(button_ss); expert_button_->hide(); // We just want a clickable image. Using a QPushButton or QToolButton would require // a lot of adjustment. StockIcon comment_icon("x-capture-comment-update"); comment_button_ = new QToolButton(this); comment_button_->setIcon(comment_icon); comment_button_->setIconSize(QSize(icon_size, icon_size)); comment_button_->setStyleSheet(button_ss); comment_button_->setToolTip(tr("Open the Capture File Properties dialog")); comment_button_->setEnabled(false); connect(expert_button_, SIGNAL(clicked(bool)), this, SIGNAL(showExpertInfo())); connect(comment_button_, SIGNAL(clicked(bool)), this, SIGNAL(editCaptureComment())); info_progress_hb->setContentsMargins(icon_size / 2, 0, 0, 0); info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY); info_status_.setShrinkable(true); info_progress_hb->addWidget(expert_button_); info_progress_hb->addWidget(comment_button_); info_progress_hb->addWidget(&info_status_); info_progress_hb->addWidget(&progress_frame_); info_progress_hb->addStretch(10); splitter->addWidget(info_progress); splitter->addWidget(&packet_status_); splitter->addWidget(&profile_status_); splitter->setStretchFactor(0, 3); splitter->setStretchFactor(1, 3); splitter->setStretchFactor(2, 1); addWidget(splitter, 1); cur_main_status_bar_ = this; splitter->hide(); info_status_.pushText(ready_msg, STATUS_CTX_MAIN); packets_bar_update(); action = ctx_menu_.addAction(tr("Manage Profiles" UTF8_HORIZONTAL_ELLIPSIS)); action->setData(ProfileDialog::ShowProfiles); connect(action, SIGNAL(triggered()), this, SLOT(manageProfile())); ctx_menu_.addSeparator(); action = ctx_menu_.addAction(tr("New" UTF8_HORIZONTAL_ELLIPSIS)); action->setData(ProfileDialog::NewProfile); connect(action, SIGNAL(triggered()), this, SLOT(manageProfile())); edit_action_ = ctx_menu_.addAction(tr("Edit" UTF8_HORIZONTAL_ELLIPSIS)); edit_action_->setData(ProfileDialog::EditCurrentProfile); connect(edit_action_, SIGNAL(triggered()), this, SLOT(manageProfile())); delete_action_ = ctx_menu_.addAction(tr("Delete")); delete_action_->setData(ProfileDialog::DeleteCurrentProfile); connect(delete_action_, SIGNAL(triggered()), this, SLOT(manageProfile())); ctx_menu_.addSeparator(); profile_menu_.setTitle(tr("Switch to")); ctx_menu_.addMenu(&profile_menu_); #ifdef QWINTASKBARPROGRESS_H progress_frame_.enableTaskbarUpdates(true); #endif connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName())); connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)), this, SLOT(toggleBackground(bool))); connect(wsApp, SIGNAL(profileNameChanged(const gchar *)), this, SLOT(pushProfileName())); connect(&profile_status_, SIGNAL(mousePressedAt(QPoint,Qt::MouseButton)), this, SLOT(showProfileMenu(QPoint,Qt::MouseButton))); connect(&progress_frame_, SIGNAL(stopLoading()), this, SIGNAL(stopLoading())); }
void KateViewManager::removeViewSpace (KateViewSpace *viewspace) { // abort if viewspace is 0 if (!viewspace) return; // abort if this is the last viewspace if (m_viewSpaceList.count() < 2) return; // get current splitter QSplitter *currentSplitter = qobject_cast<QSplitter*>(viewspace->parentWidget()); // no splitter found, bah if (!currentSplitter) return; // delete views of the viewspace while (viewspace->viewCount() > 0 && viewspace->currentView()) { deleteView( viewspace->currentView(), false ); } // cu viewspace m_viewSpaceList.removeAt( m_viewSpaceList.indexOf( viewspace ) ); delete viewspace; // at this point, the splitter has exactly 1 child Q_ASSERT( currentSplitter->count() == 1 ); // if we are not the root splitter, move the child one level up and delete // the splitter then. if (currentSplitter != this) { // get parent splitter QSplitter *parentSplitter = qobject_cast<QSplitter*>(currentSplitter->parentWidget()); // only do magic if found ;) if (parentSplitter) { int index = parentSplitter->indexOf (currentSplitter); // save current splitter size, as the removal of currentSplitter looses the info QList<int> parentSizes = parentSplitter->sizes(); parentSplitter->insertWidget (index, currentSplitter->widget (0)); if (qVersion() == QLatin1String("4.6.2")) currentSplitter->hide(); // bug in Qt v4.6.2, prevents crash (bug:232140), line can be removed once we are sure that noone uses Qt 4.6.2 anymore. delete currentSplitter; // now restore the sizes again parentSplitter->setSizes(parentSizes); } } else if( QSplitter* splitter = qobject_cast<QSplitter*>(currentSplitter->widget(0)) ) { // we are the root splitter and have only one child, which is also a splitter // -> eliminate the redundant splitter and move both children into the root splitter QList<int> sizes = splitter->sizes(); // adapt splitter orientation to the splitter we are about to delete currentSplitter->setOrientation(splitter->orientation()); currentSplitter->addWidget( splitter->widget(0) ); currentSplitter->addWidget( splitter->widget(0) ); delete splitter; currentSplitter->setSizes( sizes ); } // find the view that is now active. KTextEditor::View* v = activeViewSpace()->currentView(); if ( v ) activateView( v ); updateViewSpaceActions (); emit viewChanged(); }