MCPcopy Create free account
hub / github.com/comaps/comaps / UpdateDialog

Method UpdateDialog

qt/update_dialog.cpp:84–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82namespace qt
83{
84UpdateDialog::UpdateDialog(QWidget * parent, Framework & framework)
85 : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
86 , m_framework(framework)
87 , m_observerSlotId(0)
88{
89 setWindowModality(Qt::WindowModal);
90
91 m_pCheckUpdatesLabel = new QLabel();
92 m_pCheckUpdatesButton = new QPushButton(QObject::tr("Check for updates"), this);
93 connect(m_pCheckUpdatesButton, &QAbstractButton::clicked, this, &UpdateDialog::OnCheckUpdatesClick);
94
95 QPushButton * closeButton = new QPushButton(QObject::tr("Close"), this);
96 closeButton->setDefault(true);
97 connect(closeButton, &QAbstractButton::clicked, this, &UpdateDialog::OnCloseClick);
98
99 m_tree = new QTreeWidget(this);
100 m_tree->setColumnCount(KNumberOfColumns);
101 QStringList columnLabels;
102 columnLabels << tr("Country") << tr("Status") << tr("Size") << tr("Matched by") << tr("Rank");
103 m_tree->setHeaderLabels(columnLabels);
104
105 m_tree->setColumnHidden(KColumnIndexPositionInRanking, true);
106
107 m_tree->header()->setSectionResizeMode(KColumnIndexCountry, QHeaderView::ResizeToContents);
108 m_tree->header()->setSectionResizeMode(KColumnIndexStatus, QHeaderView::ResizeToContents);
109 m_tree->header()->setSectionResizeMode(KColumnIndexMatchedBy, QHeaderView::ResizeToContents);
110 m_tree->header()->setSectionResizeMode(KColumnIndexPositionInRanking, QHeaderView::ResizeToContents);
111
112 connect(m_tree, &QTreeWidget::itemClicked, this, &UpdateDialog::OnItemClick);
113
114 QHBoxLayout * horizontalLayout = new QHBoxLayout();
115 horizontalLayout->addStretch();
116 horizontalLayout->addWidget(m_pCheckUpdatesLabel);
117 horizontalLayout->addWidget(m_pCheckUpdatesButton);
118 horizontalLayout->addWidget(closeButton);
119
120 QLabel * localeLabel = new QLabel(tr("locale:"));
121 QLineEdit * localeEdit = new QLineEdit(this);
122 localeEdit->setText(m_locale.c_str());
123 connect(localeEdit, &QLineEdit::textChanged, this, &UpdateDialog::OnLocaleTextChanged);
124
125 QLabel * queryLabel = new QLabel(tr("search query:"));
126 QLineEdit * queryEdit = new QLineEdit(this);
127 connect(queryEdit, &QLineEdit::textChanged, this, &UpdateDialog::OnQueryTextChanged);
128
129 QGridLayout * inputLayout = new QGridLayout();
130 // widget, row, column
131 inputLayout->addWidget(localeLabel, 0, 0);
132 inputLayout->addWidget(localeEdit, 0, 1);
133 inputLayout->addWidget(queryLabel, 1, 0);
134 inputLayout->addWidget(queryEdit, 1, 1);
135
136 QVBoxLayout * verticalLayout = new QVBoxLayout();
137 verticalLayout->addLayout(inputLayout);
138 verticalLayout->addWidget(m_tree);
139 verticalLayout->addLayout(horizontalLayout);
140 setLayout(verticalLayout);
141

Callers

nothing calls this directly

Calls 1

SubscribeMethod · 0.45

Tested by

no test coverage detected