Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ function(sono_add_custom_plugin_target target_name product_name formats is_instr
localization/localized_pt-pt.txt
localization/localized_ko.txt
localization/localized_ru.txt
localization/localized_zh-hans.txt
images/bar_click.wav
images/beat_click.wav
images/chat.svg
Expand Down
54 changes: 24 additions & 30 deletions Source/ChatView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,50 +648,44 @@ void ChatView::showSaveChat()
{
SafePointer<ChatView> safeThis (this);

if (FileChooser::isPlatformDialogAvailable())
{
File recdir; // = File::getSpecialLocation(File::userDocumentsDirectory).getChildFile("SonoBus Setups");
File recdir; // = File::getSpecialLocation(File::userDocumentsDirectory).getChildFile("SonoBus Setups");

// TODO - on iOS we need to give it a name first
// TODO - on iOS we need to give it a name first
//#if (JUCE_IOS || JUCE_ANDROID)
String filename = String("SonoBusChat_") + Time::getCurrentTime().formatted("%Y-%m-%d_%H.%M.%S");
recdir = File::getSpecialLocation(File::userDocumentsDirectory).getNonexistentChildFile (filename, ".txt");
String filename = String("SonoBusChat_") + Time::getCurrentTime().formatted("%Y-%m-%d_%H.%M.%S");
recdir = File::getSpecialLocation(File::userDocumentsDirectory).getNonexistentChildFile (filename, ".txt");
//#endif

mFileChooser.reset(new FileChooser(TRANS("Choose a location and name to store the setup"),
recdir,
"*.txt",
true, false, getTopLevelComponent()));
mFileChooser.reset(new FileChooser(TRANS("Choose a location and name to store the setup"),
recdir,
"*.txt",
true, false, getTopLevelComponent()));



mFileChooser->launchAsync (FileBrowserComponent::saveMode | FileBrowserComponent::doNotClearFileNameOnRootChange,
[safeThis] (const FileChooser& chooser) mutable
{
auto results = chooser.getURLResults();
if (safeThis != nullptr && results.size() > 0)
{
auto url = results.getReference (0);
mFileChooser->launchAsync (FileBrowserComponent::saveMode | FileBrowserComponent::doNotClearFileNameOnRootChange,
[safeThis] (const FileChooser& chooser) mutable
{
auto results = chooser.getURLResults();
if (safeThis != nullptr && results.size() > 0)
{
auto url = results.getReference (0);

DBG("Chose file to save chat: " << url.toString(false));
DBG("Chose file to save chat: " << url.toString(false));

if (url.isLocalFile()) {
File lfile = url.getLocalFile();
if (url.isLocalFile()) {
File lfile = url.getLocalFile();

lfile.replaceWithText(safeThis->mChatTextEditor->getText());
}
lfile.replaceWithText(safeThis->mChatTextEditor->getText());
}
}

if (safeThis) {
safeThis->mFileChooser.reset();
}
if (safeThis) {
safeThis->mFileChooser.reset();
}

}, nullptr);
}, nullptr);

}
else {
DBG("Need to enable code signing");
}
}


Expand Down
14 changes: 8 additions & 6 deletions Source/ConnectView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ void ConnectView::publicGroupLogin()
DBG("Public host enter pressed");
// parse it
StringArray toks = StringArray::fromTokens(hostport, ":", "");
String host = "aoo.sonobus.net";
String host = DEFAULT_SERVER_HOST;
int port = DEFAULT_SERVER_PORT;

if (toks.size() >= 1) {
Expand Down Expand Up @@ -866,7 +866,7 @@ bool ConnectView::copyInfoToClipboard(bool singleURL, String * retmessage)

String hostport = mServerHostEditor->getText();
if (hostport.isEmpty()) {
hostport = "aoo.sonobus.net";
hostport = DEFAULT_SERVER_HOST;
}

String groupName;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ void ConnectView::buttonClicked (Button* buttonThatWasClicked)

// parse it
StringArray toks = StringArray::fromTokens(hostport, ":", "");
String host = "aoo.sonobus.net";
String host = DEFAULT_SERVER_HOST;
int port = DEFAULT_SERVER_PORT;

if (toks.size() >= 1) {
Expand Down Expand Up @@ -1059,7 +1059,7 @@ void ConnectView::buttonClicked (Button* buttonThatWasClicked)

// parse it
StringArray toks = StringArray::fromTokens(hostport, ":", "");
String host = "aoo.sonobus.net";
String host = DEFAULT_SERVER_HOST;
int port = DEFAULT_SERVER_PORT;

if (toks.size() >= 1) {
Expand Down Expand Up @@ -1557,7 +1557,9 @@ void ConnectView::RecentsListModel::paintListBoxItem (int rowNumber, Graphics &g
float iconsize = height*yratio;
float groupheight = height*yratio;
g.drawImageWithin(groupImage, 0, 0, iconsize, iconsize, RectanglePlacement::fillDestination);
g.drawFittedText (info.groupName, iconsize + 4, 0, adjwidth*xratio - 8 - iconsize, groupheight, Justification::centredLeft, true);
String grouptext;
grouptext << (info.groupIsPublic ? TRANS("[P] ") : "") << info.groupName;
g.drawFittedText (grouptext, iconsize + 4, 0, adjwidth*xratio - 8 - iconsize, groupheight, Justification::centredLeft, true);

g.setFont (parent->recentsNameFont);
g.setColour (parent->findColour(nameTextColourId).withAlpha(0.8f));
Expand All @@ -1576,7 +1578,7 @@ void ConnectView::RecentsListModel::paintListBoxItem (int rowNumber, Graphics &g

infostr += TRANS("on") + " " + Time(info.timestamp).toString(true, true, false) + " " ;

if (info.serverHost != "aoo.sonobus.net") {
if (info.serverHost != DEFAULT_SERVER_HOST) {
infostr += TRANS("to") + " " + info.serverHost;
}

Expand Down
99 changes: 45 additions & 54 deletions Source/OptionsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ void OptionsView::initializeLanguages()
languages.add(TRANS("Korean")); languagesNative.add("Korean"); codes.add("ko"); // TODO fix and use above when we have a font that can display this all the time
languages.add(TRANS("Russian")); languagesNative.add(juce::CharPointer_UTF8 ("p\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9")); codes.add("ru");

//languages.add(TRANS("Chinese (Simplified)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xae\x80\xe4\xbd\x93\xef\xbc\x89")); codes.add("zh_hans");
//languages.add(TRANS("Chinese (Traditional)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xb9\x81\xe9\xab\x94\xef\xbc\x89")); codes.add("zh_hant");
languages.add(TRANS("Chinese (Simplified)")); languagesNative.add("Chinese (Simplified)"); codes.add("zh-hans");
//languages.add(TRANS("Chinese (Simplified)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xae\x80\xe4\xbd\x93\xef\xbc\x89")); codes.add("zh_hans");languages.add(TRANS("Chinese (Simplified)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xae\x80\xe4\xbd\x93\xef\xbc\x89")); codes.add("zh-hans");
//languages.add(TRANS("Chinese (Traditional)")); languagesNative.add(CharPointer_UTF8 ("\xe4\xb8\xad\xe6\x96\x87\xef\xbc\x88\xe7\xb9\x81\xe9\xab\x94\xef\xbc\x89")); codes.add("zh-hant");

// TOOD - parse any user files with localized_%s.txt in our settings folder and add as options if not existing already

Expand Down Expand Up @@ -331,11 +332,7 @@ OptionsView::OptionsView(SonobusAudioProcessor& proc, std::function<AudioDeviceM



#if JUCE_IOS
mVersionLabel = std::make_unique<Label>("", TRANS("Version: ") + String(SONOBUS_BUILD_VERSION)); // temporary
#else
mVersionLabel = std::make_unique<Label>("", TRANS("Version: ") + ProjectInfo::versionString);
#endif
configLabel(mVersionLabel.get(), true);
mVersionLabel->setJustificationType(Justification::centredRight);

Expand Down Expand Up @@ -1207,69 +1204,63 @@ void OptionsView::chooseRecDirBrowser()
{
SafePointer<OptionsView> safeThis (this);

if (FileChooser::isPlatformDialogAvailable())
{
File recdir;
if (processor.getDefaultRecordingDirectory().isLocalFile()) {
recdir = processor.getDefaultRecordingDirectory().getLocalFile();
}
File recdir;
if (processor.getDefaultRecordingDirectory().isLocalFile()) {
recdir = processor.getDefaultRecordingDirectory().getLocalFile();
}

mFileChooser.reset(new FileChooser(TRANS("Choose the folder for new recordings"),
recdir,
"",
true, false, getTopLevelComponent()));
mFileChooser.reset(new FileChooser(TRANS("Choose the folder for new recordings"),
recdir,
"",
true, false, getTopLevelComponent()));


int modes = FileBrowserComponent::canSelectDirectories | FileBrowserComponent::openMode;
mFileChooser->launchAsync (modes,
[safeThis] (const FileChooser& chooser) mutable
{
auto results = chooser.getURLResults();
if (safeThis != nullptr && results.size() > 0)
{
auto url = results.getReference (0);
int modes = FileBrowserComponent::canSelectDirectories | FileBrowserComponent::openMode;
mFileChooser->launchAsync (modes,
[safeThis] (const FileChooser& chooser) mutable
{
auto results = chooser.getURLResults();
if (safeThis != nullptr && results.size() > 0)
{
auto url = results.getReference (0);

DBG("Chose directory: " << url.toString(false));
DBG("Chose directory: " << url.toString(false));

#if JUCE_ANDROID
auto docdir = AndroidDocument::fromTree(url);
if (!docdir.hasValue()) {
docdir = AndroidDocument::fromFile(url.getLocalFile());
}

if (docdir.hasValue()) {
AndroidDocumentPermission::takePersistentReadWriteAccess(url);
if (docdir.getInfo().isDirectory()) {
safeThis->processor.setDefaultRecordingDirectory(url);
}
auto docdir = AndroidDocument::fromTree(url);
if (!docdir.hasValue()) {
docdir = AndroidDocument::fromFile(url.getLocalFile());
}

if (docdir.hasValue()) {
AndroidDocumentPermission::takePersistentReadWriteAccess(url);
if (docdir.getInfo().isDirectory()) {
safeThis->processor.setDefaultRecordingDirectory(url);
}
}
#else
if (url.isLocalFile()) {
File lfile = url.getLocalFile();
if (lfile.isDirectory()) {
safeThis->processor.setDefaultRecordingDirectory(url);
} else {
auto parurl = URL(lfile.getParentDirectory());
safeThis->processor.setDefaultRecordingDirectory(parurl);
}

if (url.isLocalFile()) {
File lfile = url.getLocalFile();
if (lfile.isDirectory()) {
safeThis->processor.setDefaultRecordingDirectory(url);
} else {
auto parurl = URL(lfile.getParentDirectory());
safeThis->processor.setDefaultRecordingDirectory(parurl);
}

}
#endif

safeThis->updateState();
safeThis->updateState();

}
}

if (safeThis) {
safeThis->mFileChooser.reset();
}
if (safeThis) {
safeThis->mFileChooser.reset();
}

}, nullptr);
}, nullptr);

}
else {
DBG("Need to enable code signing");
}
}


Expand Down
Loading