Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
osxmidi authored Aug 9, 2023
1 parent 5d7a7b5 commit 0d129d5
Showing 1 changed file with 96 additions and 5 deletions.
101 changes: 96 additions & 5 deletions convert/linvstconvertgtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
int filecopy = 0;

int intimer = 0;
int dofullup = 0;
int vst2filehit = 0;

size_t find_last(std::string searchstr, std::string searcharg)
Expand Down Expand Up @@ -85,13 +86,30 @@

if(vst2filehit == 1)
{
if(dofullup == 1)
{
std::string sourcename = linvst;
std::ifstream source(sourcename.c_str(), std::ios::binary);
std::ofstream dest(convertname.c_str(), std::ios::binary);
dest << source.rdbuf();
source.close();
dest.close();
}
}
else
{
test = std::ifstream(convertname).good();

if(!test)
{
std::string sourcename = linvst;
std::ifstream source(sourcename.c_str(), std::ios::binary);
std::ofstream dest(convertname.c_str(), std::ios::binary);
dest << source.rdbuf();
source.close();
dest.close();
}
}
}
}

if(fs)
Expand Down Expand Up @@ -139,7 +157,18 @@ filehit = 1;
gboolean dolabelupdate(gpointer data)
{

gtk_button_set_label(GTK_BUTTON (data), "Start");
gtk_button_set_label(GTK_BUTTON (data), "Update Newly Added Plugins");

intimer = 0;

return FALSE;

}

gboolean dolabelupdate2(gpointer data)
{

gtk_button_set_label(GTK_BUTTON (data), "Update All Plugins (Upgrade All Plugins)");

intimer = 0;

Expand Down Expand Up @@ -201,15 +230,72 @@ void buttoncallback(GtkFileChooser *button, gpointer data)

}

void buttoncallback2(GtkFileChooser *button, gpointer data)
{
std::string name;

if((filehit == 1) && (folderhit == 1) && (intimer == 0))
{

name = filepath;

if(name.find("linvst.so") == std::string::npos)
{
gtk_button_set_label(GTK_BUTTON (button), "Not Found");

filecopy = 0;
filehit = 0;
folderhit = 0;

intimer = 1;

g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data);

return;
}

dofullup = 1;

if(doconvert(filepath, folderpath) == 1)
{
gtk_button_set_label(GTK_BUTTON (button), "Not Found");

filecopy = 0;
filehit = 0;
folderhit = 0;
dofullup = 0;

intimer = 1;

g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data);

return;
}

filecopy = 0;
filehit = 1;
folderhit = 0;
dofullup = 0;

gtk_button_set_label(GTK_BUTTON (button), "Done");

intimer = 1;

g_timeout_add_seconds(3, dolabelupdate2, (GtkWidget *)data);

}
}


int main (int argc, char *argv[])
{
GtkWidget *window, *folderselect, *fileselect, *spacertext, *spacertext2, *spacertext3, *vbox, *button;
GtkWidget *window, *folderselect, *fileselect, *spacertext, *spacertext2, *spacertext3, *vbox, *button, *button2;
GtkFileFilter *extfilter;

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
gtk_window_set_title (GTK_WINDOW (window), "LinVst");
gtk_container_set_border_width (GTK_CONTAINER (window), 8);

Expand All @@ -221,7 +307,10 @@ int main (int argc, char *argv[])
fileselect = gtk_file_chooser_button_new ("Choose linvst.so", GTK_FILE_CHOOSER_ACTION_OPEN);

button = gtk_button_new ();
gtk_button_set_label(GTK_BUTTON (button), "Start");
gtk_button_set_label(GTK_BUTTON (button), "Update Newly Added Plugins");

button2 = gtk_button_new ();
gtk_button_set_label(GTK_BUTTON (button2), "Update All Plugins (Upgrade All Plugins)");

vbox = gtk_vbox_new (FALSE, 8);
gtk_box_pack_start(GTK_BOX (vbox), spacertext, FALSE, FALSE, 0);
Expand All @@ -230,11 +319,13 @@ int main (int argc, char *argv[])
gtk_box_pack_start(GTK_BOX (vbox), folderselect, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), spacertext3, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX (vbox), button2, FALSE, FALSE, 0);

g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (quitcallback), NULL);
g_signal_connect (G_OBJECT (folderselect), "selection_changed", G_CALLBACK (foldercallback), NULL);
g_signal_connect (G_OBJECT (fileselect), "selection_changed", G_CALLBACK (filecallback), NULL);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (buttoncallback), button);
g_signal_connect (G_OBJECT (button2), "clicked", G_CALLBACK (buttoncallback2), button2);

gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(folderselect), TRUE);
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(fileselect), TRUE);
Expand Down

0 comments on commit 0d129d5

Please sign in to comment.