From b84dfddd1b24e82dccb5a20d9c30570d26846e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 16 Mar 2013 03:01:51 +0100 Subject: Use the actual selection for instance launch. --- gui/mainwindow.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index e691c8c4..676ec45e 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -198,10 +198,18 @@ void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos void MainWindow::on_actionLaunchInstance_triggered() { - QModelIndex index = view->currentIndex(); - if(index.isValid()) + QAbstractItemView * iv = view; + auto smodel = iv->selectionModel(); + QModelIndex mindex; + if(smodel->hasSelection()) { - Instance * inst = (Instance *) index.data(InstanceModel::InstancePointerRole).value(); + auto rows = smodel->selectedRows(); + mindex = rows.at(0); + } + + if(mindex.isValid()) + { + Instance * inst = (Instance *) mindex.data(InstanceModel::InstancePointerRole).value(); doLogin(inst->id()); } } -- cgit v1.2.3 From 65faabeed48584c461ca21d784c3f1d46f67f832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 18 Mar 2013 23:00:46 +0100 Subject: Connect instance list to model. --- gui/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 676ec45e..b799bdcf 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -64,8 +64,6 @@ MainWindow::MainWindow ( QWidget *parent ) : { ui->setupUi ( this ); // Create the widget - instList.loadList(); - view = new KCategorizedView ( ui->centralWidget ); drawer = new KCategoryDrawer ( view ); @@ -100,7 +98,9 @@ MainWindow::MainWindow ( QWidget *parent ) : view->setModel ( proxymodel ); connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(instanceActivated(const QModelIndex &))); - + + // Load the instances. + instList.loadList(); } MainWindow::~MainWindow() -- cgit v1.2.3 From d67d58e662159d53ee5fde37a6f60903f6350731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 19 Mar 2013 03:20:49 +0100 Subject: Added background cat. Proof of concept :3 --- gui/mainwindow.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b799bdcf..a96d80a7 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -66,7 +66,22 @@ MainWindow::MainWindow ( QWidget *parent ) : // Create the widget view = new KCategorizedView ( ui->centralWidget ); drawer = new KCategoryDrawer ( view ); - + /* + QPalette pal = view->palette(); + pal.setBrush(QPalette::Base, QBrush(QPixmap(QString::fromUtf8(":/backgrounds/kitteh")))); + view->setPalette(pal); + */ + view->setStyleSheet( + "QListView\ + {\ + background-image: url(:/backgrounds/kitteh);\ + background-attachment: fixed;\ + background-clip: padding;\ + background-position: top right;\ + background-repeat: none;\ + background-color:palette(base);\ + }"); + view->setSelectionMode ( QAbstractItemView::SingleSelection ); //view->setSpacing( KDialog::spacingHint() ); view->setCategoryDrawer ( drawer ); -- cgit v1.2.3 From 7d7e4034f48b578c87a4651075c2b73dc236181b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 19 Mar 2013 06:24:34 +0100 Subject: Property change propagation, changing instance groups, icon preview --- gui/mainwindow.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a96d80a7..78f58713 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -116,6 +116,11 @@ MainWindow::MainWindow ( QWidget *parent ) : // Load the instances. instList.loadList(); + // just a test + /* + instList.at(0)->setGroup("TEST GROUP"); + instList.at(0)->setName("TEST ITEM"); + */ } MainWindow::~MainWindow() @@ -140,6 +145,18 @@ void MainWindow::on_actionAddInstance_triggered() newInstDlg->exec(); } +void MainWindow::on_actionChangeInstGroup_triggered() +{ + Instance* inst = selectedInstance(); + if(inst) + { + QString name ( inst->group() ); + name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ), QLineEdit::Normal, name ); + inst->setGroup(name); + } +} + + void MainWindow::on_actionViewInstanceFolder_triggered() { openInDefaultProgram ( globalSettings->get ( "InstanceDir" ).toString() ); @@ -210,8 +227,7 @@ void MainWindow::on_instanceView_customContextMenuRequested ( const QPoint &pos instContextMenu->exec ( view->mapToGlobal ( pos ) ); } - -void MainWindow::on_actionLaunchInstance_triggered() +Instance* MainWindow::selectedInstance() { QAbstractItemView * iv = view; auto smodel = iv->selectionModel(); @@ -224,7 +240,18 @@ void MainWindow::on_actionLaunchInstance_triggered() if(mindex.isValid()) { - Instance * inst = (Instance *) mindex.data(InstanceModel::InstancePointerRole).value(); + return (Instance *) mindex.data(InstanceModel::InstancePointerRole).value(); + } + else + return nullptr; +} + + +void MainWindow::on_actionLaunchInstance_triggered() +{ + Instance* inst = selectedInstance(); + if(inst) + { doLogin(inst->id()); } } -- cgit v1.2.3 From e4806ab08d0293d395c1718ab16d28ba2ae9d0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 20 Mar 2013 07:59:35 +0100 Subject: Add SVG icon rendering/cache --- gui/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 78f58713..5a915e8c 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -71,6 +71,7 @@ MainWindow::MainWindow ( QWidget *parent ) : pal.setBrush(QPalette::Base, QBrush(QPixmap(QString::fromUtf8(":/backgrounds/kitteh")))); view->setPalette(pal); */ + view->setStyleSheet( "QListView\ {\ -- cgit v1.2.3 From 40570c321069b832722b807227fd8ff9bbd7c10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 24 Mar 2013 15:36:00 +0100 Subject: Fix settings objects, instances can be started from the GUI now --- gui/mainwindow.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5a915e8c..408a61c5 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -39,6 +39,7 @@ #include "gui/taskdialog.h" #include "gui/browserdialog.h" #include "gui/aboutdialog.h" +#include "gui/consolewindow.h" #include "kcategorizedview.h" #include "kcategorydrawer.h" @@ -49,6 +50,7 @@ #include "logintask.h" #include +#include "minecraftprocess.h" #include "instancemodel.h" #include "instancedelegate.h" @@ -276,9 +278,27 @@ void MainWindow::doLogin ( QString inst, const QString& errorMsg ) void MainWindow::onLoginComplete ( QString inst, LoginResponse response ) { + // TODO: console + console = new ConsoleWindow(); + auto instance = instList.getInstanceById(inst); + if(instance) + { + proc = new MinecraftProcess(instance, response.username(), response.sessionID()); + + console->show(); + //connect(proc, SIGNAL(ended()), SLOT(onTerminated())); + connect(proc, SIGNAL(log(QString,MessageLevel::Enum)), console, SLOT(write(QString,MessageLevel::Enum))); + proc->launch(); + } + else + { + + } + /* QMessageBox::information ( this, "Login Successful", QString ( "Logged in as %1 with session ID %2. Instance: %3" ). arg ( response.username(), response.sessionID(), inst ) ); + */ } void MainWindow::onLoginFailed ( QString inst, const QString& errorMsg ) -- cgit v1.2.3 From 65dc5d44f147fa70710b651f1d6cab8d09fad3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 25 Mar 2013 17:39:52 +0100 Subject: Add instance view up/down keyboard navigation, fix some layout glitches (not all) --- gui/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 408a61c5..68654889 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -97,6 +97,8 @@ MainWindow::MainWindow ( QWidget *parent ) : auto delegate = new ListViewDelegate(); view->setItemDelegate(delegate); view->setSpacing(10); + //view->setCategorySpacing(10); + view->setUniformItemWidths(true); model = new InstanceModel ( instList,this ); proxymodel = new InstanceProxyModel ( this ); -- cgit v1.2.3 From d2eef6974be6c9d65f0108bb86fc94e141330c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 25 Mar 2013 20:58:45 +0100 Subject: Mystery meat layout hack to get things aligned --- gui/mainwindow.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gui/mainwindow.cpp') diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 68654889..642f67d2 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -73,7 +73,7 @@ MainWindow::MainWindow ( QWidget *parent ) : pal.setBrush(QPalette::Base, QBrush(QPixmap(QString::fromUtf8(":/backgrounds/kitteh")))); view->setPalette(pal); */ - + /* view->setStyleSheet( "QListView\ {\ @@ -84,7 +84,7 @@ MainWindow::MainWindow ( QWidget *parent ) : background-repeat: none;\ background-color:palette(base);\ }"); - + */ view->setSelectionMode ( QAbstractItemView::SingleSelection ); //view->setSpacing( KDialog::spacingHint() ); view->setCategoryDrawer ( drawer ); @@ -97,7 +97,6 @@ MainWindow::MainWindow ( QWidget *parent ) : auto delegate = new ListViewDelegate(); view->setItemDelegate(delegate); view->setSpacing(10); - //view->setCategorySpacing(10); view->setUniformItemWidths(true); model = new InstanceModel ( instList,this ); -- cgit v1.2.3