-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
147 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
~ This file is part of Bisq. | ||
~ | ||
~ Bisq is free software: you can redistribute it and/or modify it | ||
~ under the terms of the GNU Affero General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or (at | ||
~ your option) any later version. | ||
~ | ||
~ Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
~ License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Affero General Public License | ||
~ along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<?import javafx.scene.layout.GridPane?> | ||
<?import javafx.geometry.Insets?> | ||
<GridPane fx:id="root" fx:controller="bisq.desktop.main.dao.news.NewsView" | ||
xmlns:fx="http://javafx.com/fxml" hgap="5.0" vgap="5.0"> | ||
<padding> | ||
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/> | ||
</padding> | ||
</GridPane> |
92 changes: 92 additions & 0 deletions
92
desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package bisq.desktop.main.dao.news; | ||
|
||
import bisq.desktop.common.view.ActivatableView; | ||
import bisq.desktop.common.view.FxmlView; | ||
import bisq.desktop.components.BsqAddressTextField; | ||
import bisq.desktop.main.presentation.DaoPresentation; | ||
import bisq.desktop.util.FormBuilder; | ||
import bisq.desktop.util.GUIUtil; | ||
|
||
import bisq.core.btc.wallet.BsqWalletService; | ||
import bisq.core.locale.Res; | ||
import bisq.core.user.Preferences; | ||
import bisq.core.util.BsqFormatter; | ||
|
||
import bisq.common.app.DevEnv; | ||
import bisq.common.util.Tuple3; | ||
|
||
import javax.inject.Inject; | ||
|
||
import javafx.scene.control.Button; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.layout.VBox; | ||
|
||
import static bisq.desktop.util.FormBuilder.addLabelBsqAddressTextField; | ||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg; | ||
|
||
@FxmlView | ||
public class NewsView extends ActivatableView<GridPane, Void> { | ||
|
||
private final Preferences preferences; | ||
private final BsqWalletService bsqWalletService; | ||
private final BsqFormatter bsqFormatter; | ||
private BsqAddressTextField addressTextField; | ||
|
||
@Inject | ||
private NewsView(Preferences preferences, BsqWalletService bsqWalletService, | ||
BsqFormatter bsqFormatter) { | ||
this.preferences = preferences; | ||
this.bsqWalletService = bsqWalletService; | ||
this.bsqFormatter = bsqFormatter; | ||
} | ||
|
||
@Override | ||
protected void initialize() { | ||
int gridRow = 0; | ||
|
||
addTitledGroupBg(root, gridRow, 6, | ||
Res.get("dao.wallet.receive.dao.headline"), 0); | ||
FormBuilder.addMultilineLabel(root, gridRow, Res.get("dao.wallet.receive.daoInfo"), 10); | ||
|
||
Button daoInfoButton = FormBuilder.addButton(root, ++gridRow, Res.get("dao.wallet.receive.daoInfo.button")); | ||
daoInfoButton.setOnAction(e -> { | ||
GUIUtil.openWebPage("https://bisq.network/dao"); | ||
}); | ||
|
||
FormBuilder.addMultilineLabel(root, ++gridRow, Res.get("dao.wallet.receive.daoTestnetInfo")); | ||
Button daoContributorInfoButton = FormBuilder.addButton(root, ++gridRow, Res.get("dao.wallet.receive.daoTestnetInfo.button")); | ||
daoContributorInfoButton.setOnAction(e -> { | ||
GUIUtil.openWebPage("https://bisq.network/dao-testnet"); | ||
}); | ||
|
||
FormBuilder.addMultilineLabel(root, ++gridRow, Res.get("dao.wallet.receive.daoContributorInfo")); | ||
|
||
Button daoTestnetInfoButton = FormBuilder.addButton(root, ++gridRow, Res.get("dao.wallet.receive.daoContributorInfo.button")); | ||
daoTestnetInfoButton.setOnAction(e -> { | ||
GUIUtil.openWebPage("https://bisq.network/dao-genesis"); | ||
}); | ||
|
||
addTitledGroupBg(root, ++gridRow, 1, | ||
Res.get("dao.wallet.receive.fundYourWallet"), 20); | ||
Tuple3<Label, BsqAddressTextField, VBox> tuple = addLabelBsqAddressTextField(root, gridRow, | ||
Res.get("dao.wallet.receive.bsqAddress"), | ||
40); | ||
addressTextField = tuple.second; | ||
GridPane.setColumnSpan(tuple.third, 3); | ||
} | ||
|
||
@Override | ||
protected void activate() { | ||
// Hide dao new badge if user saw this page | ||
if (!DevEnv.isDaoActivated()) | ||
preferences.dontShowAgain(DaoPresentation.DAO_NEWS, true); | ||
|
||
addressTextField.setAddress(bsqFormatter.getBsqAddressStringFromAddress(bsqWalletService.getUnusedAddress())); | ||
} | ||
|
||
@Override | ||
protected void deactivate() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters