@@ -37,14 +37,16 @@ class MNHolder : public FurListRow<QWidget*>
3737public:
3838 MNHolder ();
3939
40- explicit MNHolder (bool _isLightTheme) : FurListRow(), isLightTheme(_isLightTheme){}
40+ explicit MNHolder (bool _isLightTheme) : FurListRow(), isLightTheme(_isLightTheme) {}
4141
42- MNRow* createHolder (int pos) override {
43- if (!cachedRow) cachedRow = new MNRow ();
42+ MNRow* createHolder (int pos) override
43+ {
44+ if (!cachedRow) cachedRow = new MNRow ();
4445 return cachedRow;
4546 }
4647
47- void init (QWidget* holder,const QModelIndex &index, bool isHovered, bool isSelected) const override {
48+ void init (QWidget* holder,const QModelIndex &index, bool isHovered, bool isSelected) const override
49+ {
4850 MNRow* row = static_cast <MNRow*>(holder);
4951 QString label = index.data (Qt::DisplayRole).toString ();
5052 QString address = index.sibling (index.row (), MNModel::ADDRESS).data (Qt::DisplayRole).toString ();
@@ -53,7 +55,8 @@ class MNHolder : public FurListRow<QWidget*>
5355 row->updateView (" Address: " + address, label, status, wasCollateralAccepted);
5456 }
5557
56- QColor rectColor (bool isHovered, bool isSelected) override {
58+ QColor rectColor (bool isHovered, bool isSelected) override
59+ {
5760 return getRowColor (isLightTheme, isHovered, isSelected);
5861 }
5962
@@ -133,41 +136,46 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
133136 connect (ui->btnAboutController , &OptionButton::clicked, [this ](){window->openFAQ (10 );});
134137}
135138
136- void MasterNodesWidget::showEvent (QShowEvent *event){
139+ void MasterNodesWidget::showEvent (QShowEvent *event)
140+ {
137141 if (mnModel) mnModel->updateMNList ();
138- if (!timer) {
142+ if (!timer) {
139143 timer = new QTimer (this );
140144 connect (timer, &QTimer::timeout, [this ]() {mnModel->updateMNList ();});
141145 }
142146 timer->start (30000 );
143147}
144148
145- void MasterNodesWidget::hideEvent (QHideEvent *event){
146- if (timer) timer->stop ();
149+ void MasterNodesWidget::hideEvent (QHideEvent *event)
150+ {
151+ if (timer) timer->stop ();
147152}
148153
149- void MasterNodesWidget::loadWalletModel (){
150- if (walletModel) {
154+ void MasterNodesWidget::loadWalletModel ()
155+ {
156+ if (walletModel) {
151157 ui->listMn ->setModel (mnModel);
152158 ui->listMn ->setModelColumn (AddressTableModel::Label);
153159 updateListState ();
154160 }
155161}
156162
157- void MasterNodesWidget::updateListState () {
163+ void MasterNodesWidget::updateListState ()
164+ {
158165 bool show = mnModel->rowCount () > 0 ;
159166 ui->listMn ->setVisible (show);
160167 ui->emptyContainer ->setVisible (!show);
161168 ui->pushButtonStartAll ->setVisible (show);
162169}
163170
164- void MasterNodesWidget::onMNClicked (const QModelIndex &index){
171+ void MasterNodesWidget::onMNClicked (const QModelIndex &index)
172+ {
165173 ui->listMn ->setCurrentIndex (index);
166174 QRect rect = ui->listMn ->visualRect (index);
167175 QPoint pos = rect.topRight ();
168176 pos.setX (pos.x () - (DECORATION_SIZE * 2 ));
169177 pos.setY (pos.y () + (DECORATION_SIZE * 1.5 ));
170- if (!this ->menu ){
178+ if (!this ->menu ) {
171179 this ->menu = new TooltipMenu (window, this );
172180 this ->menu ->setEditBtnText (tr (" Start" ));
173181 this ->menu ->setDeleteBtnText (tr (" Delete" ));
@@ -190,14 +198,16 @@ void MasterNodesWidget::onMNClicked(const QModelIndex &index){
190198 ui->listMn ->setFocus ();
191199}
192200
193- bool MasterNodesWidget::checkMNsNetwork () {
201+ bool MasterNodesWidget::checkMNsNetwork ()
202+ {
194203 bool isTierTwoSync = mnModel->isMNsNetworkSynced ();
195204 if (!isTierTwoSync) inform (tr (" Please wait until the node is fully synced" ));
196205 return isTierTwoSync;
197206}
198207
199- void MasterNodesWidget::onEditMNClicked (){
200- if (walletModel) {
208+ void MasterNodesWidget::onEditMNClicked ()
209+ {
210+ if (walletModel) {
201211 if (!checkMNsNetwork ()) return ;
202212 if (index.sibling (index.row (), MNModel::WAS_COLLATERAL_ACCEPTED).data (Qt::DisplayRole).toBool ()) {
203213 // Start MN
@@ -212,7 +222,8 @@ void MasterNodesWidget::onEditMNClicked(){
212222 }
213223}
214224
215- void MasterNodesWidget::startAlias (QString strAlias) {
225+ void MasterNodesWidget::startAlias (QString strAlias)
226+ {
216227 QString strStatusHtml;
217228 strStatusHtml += " Alias: " + strAlias + " " ;
218229
@@ -227,12 +238,14 @@ void MasterNodesWidget::startAlias(QString strAlias) {
227238 updateModelAndInform (strStatusHtml);
228239}
229240
230- void MasterNodesWidget::updateModelAndInform (QString informText) {
241+ void MasterNodesWidget::updateModelAndInform (QString informText)
242+ {
231243 mnModel->updateMNList ();
232244 inform (informText);
233245}
234246
235- bool MasterNodesWidget::startMN (CMasternodeConfig::CMasternodeEntry mne, std::string& strError) {
247+ bool MasterNodesWidget::startMN (CMasternodeConfig::CMasternodeEntry mne, std::string& strError)
248+ {
236249 CMasternodeBroadcast mnb;
237250 if (!CMasternodeBroadcast::Create (mne.getIp (), mne.getPrivKey (), mne.getTxHash (), mne.getOutputIndex (), strError, mnb))
238251 return false ;
@@ -242,7 +255,8 @@ bool MasterNodesWidget::startMN(CMasternodeConfig::CMasternodeEntry mne, std::st
242255 return true ;
243256}
244257
245- void MasterNodesWidget::onStartAllClicked (int type) {
258+ void MasterNodesWidget::onStartAllClicked (int type)
259+ {
246260 if (!verifyWalletUnlocked ()) return ;
247261 if (!checkMNsNetwork ()) return ;
248262 if (isLoading) {
@@ -256,7 +270,8 @@ void MasterNodesWidget::onStartAllClicked(int type) {
256270 }
257271}
258272
259- bool MasterNodesWidget::startAll (QString& failText, bool onlyMissing) {
273+ bool MasterNodesWidget::startAll (QString& failText, bool onlyMissing)
274+ {
260275 int amountOfMnFailed = 0 ;
261276 int amountOfMnStarted = 0 ;
262277 for (CMasternodeConfig::CMasternodeEntry mne : masternodeConfig.getEntries ()) {
@@ -282,7 +297,8 @@ bool MasterNodesWidget::startAll(QString& failText, bool onlyMissing) {
282297 return true ;
283298}
284299
285- void MasterNodesWidget::run (int type) {
300+ void MasterNodesWidget::run (int type)
301+ {
286302 bool isStartMissing = type == REQUEST_START_MISSING;
287303 if (type == REQUEST_START_ALL || isStartMissing) {
288304 QString failText;
@@ -294,15 +310,17 @@ void MasterNodesWidget::run(int type) {
294310 isLoading = false ;
295311}
296312
297- void MasterNodesWidget::onError (QString error, int type) {
313+ void MasterNodesWidget::onError (QString error, int type)
314+ {
298315 if (type == REQUEST_START_ALL) {
299316 QMetaObject::invokeMethod (this , " inform" , Qt::QueuedConnection,
300317 Q_ARG (QString, " Error starting all Masternodes" ));
301318 }
302319}
303320
304- void MasterNodesWidget::onInfoMNClicked () {
305- if (!verifyWalletUnlocked ()) return ;
321+ void MasterNodesWidget::onInfoMNClicked ()
322+ {
323+ if (!verifyWalletUnlocked ()) return ;
306324 showHideOp (true );
307325 MnInfoDialog* dialog = new MnInfoDialog (window);
308326 QString label = index.data (Qt::DisplayRole).toString ();
@@ -314,7 +332,7 @@ void MasterNodesWidget::onInfoMNClicked() {
314332 dialog->setData (pubKey, label, address, txId, outIndex, status);
315333 dialog->adjustSize ();
316334 showDialog (dialog, 3 , 17 );
317- if (dialog->exportMN ){
335+ if (dialog->exportMN ) {
318336 if (ask (tr (" Remote Masternode Data" ),
319337 tr (" You are just about to export the required data to run a Masternode\n on a remote server to your clipboard.\n\n\n "
320338 " You will only have to paste the data in the pivx.conf file\n of your remote server and start it, "
@@ -333,7 +351,8 @@ void MasterNodesWidget::onInfoMNClicked() {
333351 dialog->deleteLater ();
334352}
335353
336- void MasterNodesWidget::onDeleteMNClicked (){
354+ void MasterNodesWidget::onDeleteMNClicked ()
355+ {
337356 QString qAliasString = index.data (Qt::DisplayRole).toString ();
338357 std::string aliasToRemove = qAliasString.toStdString ();
339358
@@ -342,7 +361,7 @@ void MasterNodesWidget::onDeleteMNClicked(){
342361
343362 std::string strConfFile = " masternode.conf" ;
344363 std::string strDataDir = GetDataDir ().string ();
345- if (strConfFile != boost::filesystem::basename (strConfFile) + boost::filesystem::extension (strConfFile)){
364+ if (strConfFile != boost::filesystem::basename (strConfFile) + boost::filesystem::extension (strConfFile)) {
346365 throw std::runtime_error (strprintf (_ (" masternode.conf %s resides outside data directory %s" ), strConfFile, strDataDir));
347366 }
348367
@@ -425,15 +444,16 @@ void MasterNodesWidget::onDeleteMNClicked(){
425444 }
426445}
427446
428- void MasterNodesWidget::onCreateMNClicked (){
429- if (verifyWalletUnlocked ()) {
430- if (walletModel->getBalance () <= (COIN * 10000 )){
447+ void MasterNodesWidget::onCreateMNClicked ()
448+ {
449+ if (verifyWalletUnlocked ()) {
450+ if (walletModel->getBalance () <= (COIN * 10000 )) {
431451 inform (tr (" Not enough balance to create a masternode, 10,000 PIV required." ));
432452 return ;
433453 }
434454 showHideOp (true );
435455 MasterNodeWizardDialog *dialog = new MasterNodeWizardDialog (walletModel, window);
436- if (openDialogWithOpaqueBackgroundY (dialog, window, 5 , 7 )) {
456+ if (openDialogWithOpaqueBackgroundY (dialog, window, 5 , 7 )) {
437457 if (dialog->isOk ) {
438458 // Update list
439459 mnModel->addMn (dialog->mnEntry );
@@ -448,7 +468,8 @@ void MasterNodesWidget::onCreateMNClicked(){
448468 }
449469}
450470
451- void MasterNodesWidget::changeTheme (bool isLightTheme, QString& theme){
471+ void MasterNodesWidget::changeTheme (bool isLightTheme, QString& theme)
472+ {
452473 static_cast <MNHolder*>(this ->delegate ->getRowFactory ())->isLightTheme = isLightTheme;
453474}
454475
0 commit comments