mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Added completion for buddy, divemaster, location and suit.
Added completion for buddy, divemaster, location and suit. The completions uses some models that I created in the last commit - everytime that a divelog file is loaded, it creates a list of completion items. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
		
							parent
							
								
									84f73a5fb1
								
							
						
					
					
						commit
						6da2d40d3c
					
				
					 2 changed files with 26 additions and 0 deletions
				
			
		| 
						 | 
					@ -12,8 +12,10 @@
 | 
				
			||||||
#include "divelistview.h"
 | 
					#include "divelistview.h"
 | 
				
			||||||
#include "modeldelegates.h"
 | 
					#include "modeldelegates.h"
 | 
				
			||||||
#include "globe.h"
 | 
					#include "globe.h"
 | 
				
			||||||
 | 
					#include "completionmodels.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QLabel>
 | 
					#include <QLabel>
 | 
				
			||||||
 | 
					#include <QCompleter>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
#include <QSet>
 | 
					#include <QSet>
 | 
				
			||||||
#include <QSettings>
 | 
					#include <QSettings>
 | 
				
			||||||
| 
						 | 
					@ -94,6 +96,16 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
 | 
				
			||||||
	ui->weights->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate());
 | 
						ui->weights->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
 | 
						connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						completers.buddy = new QCompleter(BuddyCompletionModel::instance(), ui->buddy);
 | 
				
			||||||
 | 
						completers.divemaster = new QCompleter(DiveMasterCompletionModel::instance(), ui->divemaster);
 | 
				
			||||||
 | 
						completers.location = new QCompleter(LocationCompletionModel::instance(), ui->location);
 | 
				
			||||||
 | 
						completers.suit = new QCompleter(SuitCompletionModel::instance(), ui->suit);
 | 
				
			||||||
 | 
						ui->buddy->setCompleter(completers.buddy);
 | 
				
			||||||
 | 
						ui->divemaster->setCompleter(completers.divemaster);
 | 
				
			||||||
 | 
						ui->location->setCompleter(completers.location);
 | 
				
			||||||
 | 
						ui->suit->setCompleter(completers.suit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	initialUiSetup();
 | 
						initialUiSetup();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -348,6 +360,10 @@ void MainTab::addWeight_clicked()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainTab::reload()
 | 
					void MainTab::reload()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						SuitCompletionModel::instance()->updateModel();
 | 
				
			||||||
 | 
						BuddyCompletionModel::instance()->updateModel();
 | 
				
			||||||
 | 
						LocationCompletionModel::instance()->updateModel();
 | 
				
			||||||
 | 
						DiveMasterCompletionModel::instance()->updateModel();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainTab::on_editAccept_clicked(bool edit)
 | 
					void MainTab::on_editAccept_clicked(bool edit)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,6 +12,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "models.h"
 | 
					#include "models.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class QCompleter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Ui
 | 
					namespace Ui
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	class MainTab;
 | 
						class MainTab;
 | 
				
			||||||
| 
						 | 
					@ -27,6 +29,13 @@ struct NotesBackup{
 | 
				
			||||||
	QString divemaster;
 | 
						QString divemaster;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct Completers{
 | 
				
			||||||
 | 
						QCompleter *location;
 | 
				
			||||||
 | 
						QCompleter *divemaster;
 | 
				
			||||||
 | 
						QCompleter *buddy;
 | 
				
			||||||
 | 
						QCompleter *suit;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MainTab : public QTabWidget
 | 
					class MainTab : public QTabWidget
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
| 
						 | 
					@ -72,6 +81,7 @@ private:
 | 
				
			||||||
	QPushButton *addCylinder;
 | 
						QPushButton *addCylinder;
 | 
				
			||||||
	QPushButton *addWeight;
 | 
						QPushButton *addWeight;
 | 
				
			||||||
	enum { NONE, DIVE, TRIP } editMode;
 | 
						enum { NONE, DIVE, TRIP } editMode;
 | 
				
			||||||
 | 
						Completers completers;
 | 
				
			||||||
	void enableEdition();
 | 
						void enableEdition();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue