VirtualBox

Changeset 93185 in vbox for trunk


Ignore:
Timestamp:
Jan 11, 2022 2:18:59 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9371. Relocating the warning label.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r93180 r93185  
    378378    , m_comMachine(comMachine)
    379379    , m_pGuestSessionPanel(0)
     380    , m_pWarningLabelContainer(0)
     381    , m_pWarningLabel(0)
     382    , m_pWarningIconLabel(0)
    380383    , m_fIsCurrent(false)
    381384{
     
    383386        m_strTableName = m_comMachine.GetName();
    384387    prepareToolbar();
     388    prepareWarningLabels();
    385389    prepareGuestSessionPanel();
    386390    prepareActionConnections();
     
    420424        m_pLocationLabel->setText(UIFileManager::tr("Guest File System:"));
    421425
    422     if (m_pWarningLabel)
     426    if (m_pWarningLabel && m_pWarningIconLabel)
    423427    {
    424428        QString strWarningText;
     
    427431            case State_InvalidMachineReference:
    428432                strWarningText = UIFileManager::tr("Machine reference is invalid.");
     433                m_pWarningIconLabel->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(QSize(16, 16)));
    429434                break;
    430435            case State_MachineNotRunning:
    431436                strWarningText = UIFileManager::tr("File manager cannot work since the selected guest is not currenly running.");
     437                m_pWarningIconLabel->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 16)));
    432438                break;
    433439            case State_NoGuestAdditions:
    434440                strWarningText = UIFileManager::tr("File manager cannot work since the selected guest does not have the guest additions.");
     441                m_pWarningIconLabel->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(16, 16)));
    435442                break;
    436443            case State_SessionPossible:
     444                strWarningText = UIFileManager::tr("Enter a valid user name and password to initiate the file manager.");
     445                m_pWarningIconLabel->setPixmap(QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView).pixmap(QSize(16, 16)));
     446                break;
    437447            default:
    438448                break;
     
    440450        m_pWarningLabel->setText(QString("<p>%1</p>").arg(strWarningText));
    441451    }
    442 
     452    if (m_pWarningIconLabel)
     453    {
     454
     455    }
    443456    UIFileManagerTable::retranslateUi();
    444457}
     
    10321045            m_pMainLayout->addWidget(m_pGuestSessionPanel, m_pMainLayout->rowCount(), 0, 1, m_pMainLayout->columnCount());
    10331046            m_pGuestSessionPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    1034             //sltHandleGuestSessionPanelShown();
    10351047            connect(m_pGuestSessionPanel, &UIGuestSessionCreateWidget::sigCreateSession,
    10361048                    this, &UIFileManagerGuestTable::sltCreateGuestSession);
    10371049            connect(m_pGuestSessionPanel, &UIGuestSessionCreateWidget::sigCloseSession,
    10381050                    this, &UIFileManagerGuestTable::sltHandleCloseSessionRequest);
    1039             // connect(m_pGuestSessionPanel, &UIFileManagerGuestSessionPanel::sigHidePanel,
    1040             //         this, &UIFileManagerGuestTable::sltHandleGuestSessionPanelHidden);
    1041             // connect(m_pGuestSessionPanel, &UIFileManagerGuestSessionPanel::sigShowPanel,
    1042             //         this, &UIFileManagerGuestTable::sltHandleGuestSessionPanelShown);
     1051        }
     1052    }
     1053}
     1054
     1055void UIFileManagerGuestTable::prepareWarningLabels()
     1056{
     1057    if (m_pMainLayout)
     1058    {
     1059        m_pWarningLabelContainer = new QWidget(this);
     1060        QHBoxLayout *pContainerLayout = new QHBoxLayout(m_pWarningLabelContainer);
     1061        m_pWarningLabelContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
     1062        m_pMainLayout->addWidget(m_pWarningLabelContainer, m_pMainLayout->rowCount(), 0, 1, m_pMainLayout->columnCount());
     1063
     1064        m_pWarningIconLabel = new QILabel(this);
     1065        if (m_pWarningIconLabel)
     1066        {
     1067            pContainerLayout->addWidget(m_pWarningIconLabel);
     1068            m_pWarningIconLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
     1069        }
     1070        m_pWarningLabel = new QILabel(this);
     1071        if (m_pWarningLabel)
     1072        {
     1073            pContainerLayout->addWidget(m_pWarningLabel);
     1074            m_pWarningLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
     1075            m_pWarningLabel->setVisible(false);
    10431076        }
    10441077    }
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.h

    r93180 r93185  
    135135    void cleanupConsoleListener();
    136136    void prepareGuestSessionPanel();
     137    void prepareWarningLabels();
    137138    bool openGuestSession(const QString& strUserName, const QString& strPassword);
    138139    void closeGuestSession();
     
    158159    CEventListener m_comConsoleListener;
    159160    UIGuestSessionCreateWidget *m_pGuestSessionPanel;
     161    QWidget         *m_pWarningLabelContainer;
     162    QILabel         *m_pWarningLabel;
     163    QILabel         *m_pWarningIconLabel;
    160164    /** True if this table is the current table in parents tab widget. */
    161165    bool m_fIsCurrent;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.cpp

    r93180 r93185  
    705705    , m_pToolBar(0)
    706706    , m_pMainLayout(0)
    707     , m_pWarningLabel(0)
    708707    , m_pModel(0)
    709708    , m_pView(0)
     
    813812        m_sessionWidgets << m_pView;
    814813    }
    815     m_pWarningLabel = new QILabel(this);
    816     if (m_pWarningLabel)
    817     {
    818         m_pMainLayout->addWidget(m_pWarningLabel, 2, 0, 5, 7);
    819         QFont labelFont = m_pWarningLabel->font();
    820         float fSizeMultiplier = 1.f;
    821         if (labelFont.pointSize() != -1)
    822             labelFont.setPointSize(fSizeMultiplier * labelFont.pointSize());
    823         else
    824             labelFont.setPixelSize(fSizeMultiplier * labelFont.pixelSize());
    825         labelFont.setBold(false);
    826         m_pWarningLabel->setFont(labelFont);
    827         m_pWarningLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    828         m_pWarningLabel->setWordWrap(true);
    829     }
    830     m_pWarningLabel->setVisible(false);
    831814
    832815    m_pSearchLineEdit = new QILineEdit;
     
    14711454    if (pEvent->type() == QEvent::EnabledChange)
    14721455    {
    1473         m_pWarningLabel->setVisible(!isEnabled());
    14741456        m_pView->setVisible(isEnabled());
    14751457        retranslateUi();
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerTable.h

    r93115 r93185  
    257257    /** This name is appended to the log messages which are shown in the log panel. */
    258258    QString          m_strTableName;
    259     QILabel         *m_pWarningLabel;
    260259
    261260private slots:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette